Yes, agree that the light was maybe not the best example use case given the short duration. Added another use case (robotic lawn mower) where I’d like to delay an action for hours. Or you could call it to run a one-off action at a schedule. I know it’s possible to use helpers or other ways, but a delayed action is in that case simple, user-friendly to understand and robust.
Another example: bedtime lights
When bedtime mode is activated, turn on the bedroom lights and schedule them to turn off after 30 minutes.
However:
If someone manually operates the lights, cancel the pending turn-off.
If another automation explicitly turns on the lights with cancellation enabled, cancel the pending turn-off.
Otherwise, turn off the lights after 30 minutes.
alias: Bedtime lights
triggers:
- trigger: state
entity_id: input_boolean.bedtime_mode
to: "on"
actions:
- action: light.turn_on
target:
entity_id: light.bedroom
- action: light.turn_off
target:
entity_id: light.bedroom
delay: "00:30:00"
schedule:
key: bedroom_delayed_off
cancel_on_manual_control: true
alias: Bedroom lights manually requested
triggers:
- trigger: state
entity_id: input_boolean.reading_mode
to: "on"
actions:
- action: light.turn_on
target:
entity_id: light.bedroom
cancel_delayed_actions: true
Again all of this can be achieved with multiple automations, helpers etc. But I believe a delayed or scheduled action is simpler and require less management, i.e. remember which helper is for what etc.
The bedtime example makes the case well for me. A simple delay with a clear cancel rule would be easier to follow than splitting the same idea across several automations and helpers.
It could be done a lot simpler by adapting the example I posted earlier. No need for long delays in actions or even multiple actions. And you can use context instead of input booleans.
You’re asking HA to adapt to your misunderstanding of how it works rather than bothering to learn how it works.
Or you just trigger on weather being “storm” (or whatever) and then trigger again when it goes from “storm” to “clear”, “sunny”, “light rain” or whatever your specific criteria is.
No need for manual work or delays
This would probably be most important outside of automations for one-off commands;
turning off a light 15 minutes from now, start the robovac in an hour, etc, where there’s no sense in writing an automation.
You’re making a common mistake here.
What you do is (if no motion) delay for X time; then turn light off.
What you’re actually trying to do is (if no motion for X time) turn light off. This already exists as a trigger.
Here’s my use case: I have e.g. washing machine, tumble dryer and dishwasher notifications. These appliances may run while we’re away. I don’t want the notifications sent if we’re not home, so a delay that easily added to say: delay this until (condition) one of us get home would be great. If we are, send it.