Im building a replica of the Hue Dimmer switch, using my own ESP based wall mounted switches. In the project, I need to control a slider, that will be used for dimming the hue lights later on. When I press a key on the switch the slider must increment 25, or decrements 25 depending on witch button. I have it working, exept the logic for decremented the slider,
I have build in some tests so it always goes to zero.it does not exceed the boundaries (0-255), and it is in this test, it will not detect that the slider has a value, and just set it to 0. (automation test hue 3:)
Any help is appreciated
automation test hue 2:
- alias: Set temp slider
trigger:
platform: state
entity_id: input_boolean.3_short
to: 'on'
action:
service: input_slider.select_value
data_template:
entity_id: input_slider.slider1
value: >
{% if states('input_slider.slider1.state') | float + 25 <= 255 %}
{{ states.input_slider.slider1.state | int + 25 }}
{% else %}
{{ 255 | int }}
{% endif %}
automation test hue 3:
- alias: Set temp slider
trigger:
platform: state
entity_id: input_boolean.3_long
to: 'on'
action:
service: input_slider.select_value
data_template:
value: >
{% if states('input_slider.slider1.state') | float - 25 >= 0 %}
{{ states.input_slider.slider1.state | int - 25 }}
{% else %}
{{ 0 | int }}
{% endif %}