I have to working automations that I tried to combine into one and use trigger IDs but whatever combination comes first the default action - which is none - is executed.
What I want to achieve:
trigger 1: sun-->sunset
trigger 2: Android TV to 'on'
option 1: if it is sunset AND Android TV is switched to 'on' switch on the lights behind the couch
option 2: if Android TV is 'on' and sun sets switch on the lights behind the couch
My attempt to make the automation work:
alias: 'Wohnzimmer: Fernsehlicht'
description: ''
trigger:
- platform: sun
event: sunset
offset: 0
id: sunset
- platform: state
entity_id:
- select.thirteenhub_activities
to: Android TV
id: harmony
attribute: options
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: sunset
- condition: state
entity_id: select.thirteenhub_activities
state: Android TV
attribute: options
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.couch
- conditions:
- condition: trigger
id: harmony
- condition: sun
after: sunset
- condition: state
entity_id: select.thirteenhub_activities
attribute: options
state: Android TV
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.couch
default: []
mode: single
If one trigger occures it is tested against both conditions and as one condition matches the state of the trigger that condition will be ‘ignored’ and only the other condition is being tested and if true the light turns on? And of course vice versa for the other trigger.
If my interpretation of your code is right you’re assumption is right and your code will become my code.
The automation is triggered by either sunset or the select changing to ‘Android TV’.
After being triggered, the automation’s condition checks if it’s now after sunset and the select is set to ‘Android TV’. If both conditions are true, the light is turned on.