Everything about this works except for the last hop from 191 to 255 so if I look at the group light settings, the brightness is at 191
entity_id: light.family_lamps
brightness: >-
{% set current = state_attr('light.family_lamps', 'brightness') | default(0)
| int %} {% set state = states('light.family_lamps') %} {{
log.info("Up_Press: Current State: " ~ state ~ ", Current Brightness: " ~
current) }} {% set new_brightness =
64 if state == 'off'
else 64 if current < 64
else 128 if current < 128
else 192 if current < 192
else 255 %}
{{ log.info("Up_Press: New Brightness Calculated: " ~ new_brightness) }} {{
new_brightness }}
transition: 1.5
action: light.turn_on
Ok I can get the lights to turn on when off with the up button, one click goes to 25%, then 50% then 75%, and nothing I have tried gets it to 100%. Maybe a different method is better? I dont really understand the default filter or missing data key. I’ll need to google some more. here is what I have from AI hehe but sitll no 100%.
Up_Press:
- service: light.turn_on
data_template:
entity_id: light.family_lamps
brightness: >-
{% set current_brightness = state_attr('light.family_lamps', 'brightness') %}
{% set state = states('light.family_lamps') %}
{% set current = current_brightness | default(0) | int(0) %}
{% if state == 'off' %}
64
{% elif current_brightness is none %}
64
{% elif current < 64 %}
64
{% elif current < 128 %}
128
{% elif current < 192 %}
192
{% else %}
255
{% endif %}
transition: 1.5`
I did this for Down_Press and it works but wont go to 5% so I guess I just trick it and stop at 99% and 5% then put 100 and 5 after that if it all works but the last else.
Down_Press:
- service: light.turn_on
data_template:
entity_id: light.family_lamps
brightness: >-
{% set current_brightness = state_attr('light.family_lamps', 'brightness') %}
{% set current = current_brightness | default(255) | int(255) %}
{% if current > 192 %}
192
{% elif current > 128 %}
128
{% elif current > 64 %}
64
{% elif current > 25 %}
25
{% elif current > 10 %}
10
{% else %}
5
{% endif %}
transition: 1.5