WTH can't I create a helper inside a automation/script ONLY

I am currently running many helpers that stop a script from running more than once a day.

  1. I set a condition so that the automation only runs if the helper is OFF.
  2. The automation runs
  3. I turn the helper on in the automation
  4. I then have another automation that turns off all my helpers at 12am

Doing this means if HA restarts then I don’t lose the “wait till 12am” trigger

Creating automation/script helpers may come in handy for other ideas too

If you only want an automation to run once a day use this condition:

- condition: template
  value_template: "{{ (this.attributes.last_triggered|default(as_datetime(0),1)).day != now().day }}"

thanks! but doesn’t help when using Options and I want the other options to trigger :slight_smile:

Easy:

If it is the first trigger (id counting starts at 0):

- condition: template
  value_template: "{{ trigger.id != 0 or (this.attributes.last_triggered|default(as_datetime(0),1)).day != now().day  }}"

This condition will be true for all triggers except if the first trigger has occurred already today.

1 Like

duplicate https://community.home-assistant.io/t/wth-why-cant-i-make-one-off-async-scripts-automations/804695

1 Like