Every other day

I could swear I saw a recent video in the past few months where in the GUI they added a simple option for “every other day” for an automation, was I dreaming?

Even with the new conditions in Labs, I don’t see anything in the UI that does that. One problem is that “every other day” can mean different things depending on the context.

  1. Let the actions run again only after 2 full days.
    • If they ran at 8am on Mon, they can’t run again until 8am or later on the following Wed.
  2. Let the actions run again at any time every other day, but just once.
    • If they ran at 8am on Mon, they can run one time the following Wed from 0:00-23:59.
  3. Let the actions run again at any time every other day, more than once.
    • If they ran could run on Mon, they can run the following Wed.

The options I’m aware of would be either a Template condition to throttle the automation or, set up a trigger-based template binary sensor that tracks is designed to be “on” every other day.

A template condition can be used when the requirement of “every other day” is in the context of throttling the automation based on its previous runs.

#Example of #1
condition: template
value_template: |
  {{ this.attributes.last_triggered | default(as_datetime(0), 1) 
  < now() - timedelta(days=2) }}
#Example of #2
condition: template
value_template: |
  {{ (this.attributes.last_triggered | default(as_datetime(0), 1)).date() 
  <= (today_ay() - timedelta(days=2)).date() }}

The Template binary sensor option allows you to define “Every other day” more broadly without referencing any part of the automation.

#Example to achieve #3 above
template: 
  - triggers:
      - trigger: homeassistant
        event: start
      - trigger: time_pattern
        hours: /12
    binary_sensor:
      - name: Every Other Day
        state: "{{ (today_at() - as_datetime(0)).days % 2 == 0 }}"

#You would then use this binary sensor in a State condition.

condition: state
entity_id: binary_sensor.every_other_day
state: "on"

Just keep in mind that this option, on its own, enforces a date pattern but would not prevent the automation running multiple times in the same day.