Evening, trying to create an automation to set the brightness of a group of lights based on current value of the group of lights. When I look at the Developer Tools → States, I can find my light group just fine and it has a brightness attribute. However I cannot seem to actually get the brightness value in an automation.
This is my first time trying something that isn’t easy or copied from somewhere else. Everything looks right to me so not sure where the error is happening. Any help is appreciated!
Here is my automation:
service: light.turn_on
data:
brightness: >-
{% set currbright = state_attr('light.living_room_chandelier', 'brightness') | int %}
{% if currbright <= 220 %}
currbright + 25
{% else %}
255
{% endif %}
target:
entity_id: light.living_room_chandelier
and here are the states for the entity with values when the automation was triggered:
min_color_temp_kelvin: 2000
max_color_temp_kelvin: 6493
min_mireds: 154
max_mireds: 500
supported_color_modes: color_temp, xy
color_mode: color_temp
brightness: 26
color_temp_kelvin: 2958
color_temp: 338
hs_color: 27.896, 58.048
rgb_color: 255, 175, 106
xy_color: 0.501, 0.384
entity_id: light.chandelier_1_light_3, light.chandelier_2_light, light.chandelier_3_light_2
icon: mdi:lightbulb-group
friendly_name: Living room chandelier
supported_features: 40
but the error I get is this and I am thinking it is returning None but as you can see from the state attributes above, it definitely has an integer value:
expected int for dictionary value @ data['brightness']