#Automation to increase brightness of a light states its not a float

1 messages · Page 1 of 1 (latest)

digital wagon
#

I would like to control a light using an Elgato Streamdeck and for this I want to make a service to increase and decrease the light level by 10.

The entity in question is: light.nicci_cosylight_light

In the developer tools section I can retrieve the value of the brightness using the following template

{{state_attr('light.nicci_cosylight_light', 'brightness') | float(0)}}

the result is: 10 as number type

the automation looks like the following

description: ""
trigger: []
condition:
  - condition: device
    type: is_on
    device_id: 40e4847e34ce5368e8816fd86043d0be
    entity_id: b4dc2f7cf9032fd17c296ee833ffb3f0
    domain: light
action: 
  - type: turn_on
    device_id: 40e4847e34ce5368e8816fd86043d0be
    entity_id: b4dc2f7cf9032fd17c296ee833ffb3f0
    brightness_pct: "{{state_attr('light.nicci_cosylight_light', 'brightness') + 10 | float(0)}}"
    domain: light
mode: single

but I am getting the following error message

Message malformed: expected float for dictionary value @ data['brightness_pct']

I also tried to remove the "" within the brightness_pct but this also did not work.

steady dome
#

Two things... I don't think you can use templates with device IDs - try entity IDs instead. Secondly, your automation doesn't have a trigger, so it's never goping to run in any case! 😁

weary peak
#

Yes, though it is device actions that don’t work with templates. In the UI dropdown for the action, search for light.turn_on. That action will support templates.

digital wagon
digital wagon