I am currently running many helpers that stop a script from running more than once a day.
- I set a condition so that the automation only runs if the helper is OFF.
- The automation runs
- I turn the helper on in the automation
- 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
tom_l
2
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
tom_l
4
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
petro
(Petro)
6
1 Like