Automation triggering

I’m wondering how automations are working.

Let’s assume I make a automation triggered on sunset with a condition that I have to be at home. Is the automation triggered at sunset and will it wait until I’m at home. If this is true, is it possible to see if there are automations triggered and still “running”.

In that case you need 2 triggers. One for the sunset and another for coming home.
And you need 2 conditions too.

  - alias: "At home / Sunset"
    trigger:
      - platform: state
        entity_id: device_tracker.dennis
        to: 'home'
      - platform: sun
        event: sunset	
    condition:
      - condition: state
        entity_id: device_tracker.dennis
        state: 'home'
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
    action:
      {{ do stuff }}
1 Like

Unless you have a wait_template or something similar, the automation will trigger, check the conditions and then execute the actions if conditions are met and stop if the conditions are not met.