I am new to HA template, I want to set an automation to increase/decrease light brightness and temperature on trigger. However, when I test the below action in development/service page, the code is not working.
I can only update the light by put a static value to the brightness/color_temp attribute, but not a template. Any advise on how to inc/dec light brightness/temperature?
I am using HA version 2022.5. Thanks!
service: light.turn_on
data_template:
transition: 1
# the templates statement below is not working
brightness: {{ state_attr('light.livingroom_tv_lightbulbs','brightness')|int + 10 }}
color_temp: {{ state_attr('light.livingroom_tv_lightbulbs','color_temp')|int + 10 }}
# replace to below code will work
# brightness: 50
# color_temp: 100
target:
entity_id: light.livingroom_tv_lightbulbs
8 posts - 2 participants