Help with trigger.event == “time” in automation

Hi Team, would you take a look at the following, it triggers correctly at 7am but close instead. I am guessing that the trigger event == “time” is incorrect. What is the correct way to do that?

- alias: 'Curtains Bedroom'
  description: 'Automatic open and close bedroom blockout curtains'
  triggers:
  - trigger: sun
    event: sunset
  - trigger: time
    at: 07:00:00
  actions:
    - service: "cover.{{ 'open_cover' if trigger.event == 'time' else 'close_cover' }}"
      entity_id:
        - cover.curtain_blockout_bedroom  

trigger.platform

1 Like

Trigger.event is only defined for event triggers. try adding trigger_ids and test for that. Better yet, use the trigger id as action:

- alias: 'Curtains Bedroom'
  description: 'Automatic open and close bedroom blockout curtains'
  triggers:
  - trigger: sun
    id: close
    event: sunset
  - trigger: time
    id: open
    at: 07:00:00
  actions:
    - service: "cover.{{trigger.id}}_cover"
      entity_id:
        - cover.curtain_blockout_bedroom
1 Like

Ahhhh yes, thank you!