I’ve read whole thread about this, but it is very complicated to understand for me.
I’ve created some configuration:
(automations.yaml)
- alias: Zmiana jasnosci lampki
id: '12345677'
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001dc44c4
click_type: long_click_press
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001dc4519
click_type: long_click_press
action:
- service: script.turn_on
entity_id: script.zmien_jasnosc
- alias: Zmiana jasnosci lampki off
id: '12345678'
trigger:
- platform: state
entity_id: binary_sensor.switch_158d0001dc44c4
to: 'off'
- platform: state
entity_id: binary_sensor.switch_158d0001dc4519
to: 'off'
action:
- service: script.turn_off
entity_id: script.zmien_jasnosc
Scripts.yaml
zmien_jasnosc:
sequence:
- condition: state
entity_id: light.yeelight_bedside_7811dc90cd74
state: 'on'
- service: light.turn_on
entity_id: light.yeelight_bedside_7811dc90cd74
data_template:
transition: '1'
brightness: >-
{% set n = states.light.yeelight_bedside_7811dc90cd74.attributes.brightness + 25 %}
{% if n > 255 %}
10
{% else %}
{{ n | int }}
{% endif %}
- service: script.turn_off
entity_id: script.zmien_jasnosc
- service: script.turn_on
entity_id: script.zmien_jasnosc
Unfortunately it didn’t worked.