"Once per Day" Condition

I have an automation that turns my climate off of away mode when either my wife or I leave our offices in the afternoon. I’d like this automation to trigger only once per day. Obviously it’s not critical if this automation triggers twice… But still. What’s the best way to add a “once per day” condition to an automation?


Use a time trigger and a specific time:

automation 2:
    platform: time
    # When 'after' is used, you cannot also match on hour, minute, seconds.
    # Military time format.
    after: '15:32:00'
1 Like

You could do a time based condition or create an input_boolean and use it as a condition that toggles on the first time it runs, then reset it at midnight or in the morning. I use that method on a few things for similar purpose.


I should have been a little more clear in my original post. As our schedules vary so much, the trigger is based on our location. It’s just that I want it to trip when the first one of us leaves work, whenever that may be. The triggering is working fine, but triggers for both of it.

It looks like that input_boolean method is the best way to do it. The only way to reset it would be with an automation, correct?

(Note: I don’t think any of this matters much for this particular case, but I just want to learn how to do things as efficiently as possible, because I see my configuration expanding day by day as I add automation “features” and devices. :smiley:)

Well if that is the case I would just do multiple triggers on each of your devices going to not_home, then turn on an input boolean flag that overrides the next one. You could then reset the input boolean at night based on time, or something else. I use this method quite a bit as a method to set a flag.


  - platform: state
    entity_id: device_tracker.person1
    from: 'home'
    to: 'not_home'
  - platform: state
    entity_id: device_tracker.person2
    from: 'home'
    to: 'not_home'
  - platform: state
    entity_id: device_tracker.person3
    from: 'home'
    to: 'not_home'

    - condition: state
      entity_id: input_boolean.first_run
      state: 'off'

    - service: light.turn_off
      entity_id: group.lgihts
    - service: homeassistant.turn_on
      entity_id: input_boolean.first_run

Oo! Your example has actually inspired me, but in a different way.

I could trigger it on either of us leaving work, but then have an “if” statement in my action that checks the state of the input boolean. If it’s off, turn on the thermostat and toggle the state of the boolean. If it’s on, just turn off the boolean.

Err, actually on second thought, that won’t work, because one of us might not go to work that day, leaving the boolean set to “on” for the next day. Nevermind! Back to resetting the boolean at midnight. :slight_smile:

Thank you both!

I hide a lot of those input booleans as well, keep it clean and let it do its thing in the background.