How to handle 'missed' automations?

Hey guys,

I have an automation that reacts on a state. “If state changes to ON, do this”. Works fine. But I also have conditions for that trigger.

For example: if I’m not home, it won’t actually trigger it. But… if I return home, I do want it to start working. But it won’t, because it only triggers at “if state changes”.

How do you guys work around that?

The easiest is with a timer: trigger every x seconds/minutes and do it (or don’t do it) based on conditions.
But I feel this might put too much unnecessary strain on the system to check for this every x seconds.

Is there some system I’m missing?

Isn’t this another trigger?

1 Like

Hmm, true. But that would mean that I have to change all my automations to do something when I return home. Probably not the best solution to this.

Unless, again, I’m not seeing something here…

That is the best solution. Automations aren’t magic: set up as many triggers as you need, and conditions as appropriate.

Change “all” your automations? Really?

1 Like

What is so weird about “all” my automations? I have a few, all set up the same way.

You said:

Maybe you only have a few automations, then.

But yes, it’s normal to have lots of triggers for more complicated setups. My hall light “on” automation, for example, has this trigger section with a bunch of conditions below it:

 trigger:
    - platform: state
      entity_id: sun.sun
      from: 'above_horizon'
      to: 'below_horizon'
    - platform: homeassistant
      event: start
    - platform: state
      entity_id: binary_sensor.occupied
    - platform: state
      entity_id: binary_sensor.wfh_solo
    - platform: state
      entity_id: binary_sensor.hall_light
      to: 'on'
      for:
        minutes: 2

Switching it on can depend on the sun, the house occupation (anyone home, and whether it’s just me working from home) and the light level; and it also checks it’s in the right state after an HA restart.

1 Like

Shit, there we go, that was what was missing in my head! Maybe obvious to you, but you can have multiple triggers!

I didn’t realise that! Now it makes a lot more sense, of course!

See?! That’s why I asked here, if I missed something :wink:

Thank you!

3 Likes