Hi
Is it possible to configure the automation to run only one time only?
For example if I set alarm clock to morning, can it became disabled after fired once?
ih8gates
(Scott Reston)
April 4, 2017, 12:02am
2
I do something similar with a input_boolean. You can see an example here:
I’m a fiddler, not a programmer and as such, I’ve benefited greatly from all of the bits of code that users have posted in the forums. Thanks! Here’s my contribution.
What it does: When I first come downstairs, a motion sensor in my livingroom senses me and turns on some lights. Kind of a “welcome to the day” automation.
This includes: creating and changing the value of an input_boolean, reacting to time and to sunrise, using conditions for an action, using value_templates for conditions, exit…
Knowing what I know now, I’d probably just have the last action in the automation set turn off the automation like @chrio did here:
I just wanted to share a basic recipe for when you want a trigger to work at most once every X minutes (or whatever time is needed), for instance to limit notification spam.
The idea is simple: in the action part, just disable the automation from itself, do your things, add a delay as needed and finally enable the automation again.
automation:
- alias: Test
trigger:
# Your trigger
- platform: state
entity_id: input_boolean.testbool
to: 'on'
action:
#…
You could have an action turn the automations back on at, say, midnight to reset for the next day.
1 Like