Newbie here, firstly, I love what you can do with home automation. It’s a great project and I hope it gets better.
What I want is something like:
Sonoff button double click, light on at 10%
double click, light at 100%
double click, Light off
My problem is that I can create an automation, but don’t know how to do it. I found code, but whenever I change my automation to YAML and paste the code and save it, when I go back to the automation, it just loads up the visual editor, not the YAML and when I change it back to YAML, the additional code has disappeared.
I tried pasting this underneath the code generated by the visual editor:
action:
- service: light.turn_on
entity_id: light.your_light
data:
brightness: >
{% if is_state(‘light.your_light’, ‘on’) and state_attr(‘light.your_light’, ‘brightness’) | int <=42 %}
80
{% elif is_state(‘light.your_light’, ‘on’) and 43 <= state_attr(‘light.your_light’, ‘brightness’) | int <=80 %}
192
{% else %}
255
{% endif %}
Any suggestions?