Hi,
I am trying to implement a singe automation with variable lights based on the trigger condition. Basically if an rf remote button is pressed, a specific light will turn on or off depending on that button. I know I can have a separate automation for each trigger, but I believe there is a better way.
My issue is currently on the action part. Is it possible to use the following method and what am I doing wrong on this.
- id: adam0005
alias: Turn Reading Lights off @ Adam by button
initial_state: true
trigger:
- platform: state
entity_id:
- sensor.adam_reading
- sensor.adam_side_lamp
- sensor.adam_bookshlef
from: 'ON'
to: 'OFF'
action:
service: light.turn_off
data_template:
entity_id: >
{% if trigger.entity_id == "sensor.adam_reading" %} light.adam_desk_led
{% elif trigger.entity_id == "sensor.adam_side_lamp" %} light.lds_zha_colortemperature_a9d93201_level_light_color_on_off
{% elif trigger.entity_id =="sensor.adam_bookshlef" %} light.adam_backshelf_led
{% endif %}