Wait event vs off at specific time

For simple automations, is it better to schedule an on time and off time (two separate rules) or a turn on, wait, and turn off.

I have a lamp in an extra room that turns on at sunset and off around 9:15pm. It's written now to turn on, wait, then turn off. If the rule gets interrupted for any reason (like a power outage), would the lamp stay on until the next time the rule runs and cycles through the wait event (meaning it would be on for 24 hours)?

In that case, if I had a separate turn off, it wouldn't matter if the power has cycled or something interrupted the rule, it would just send an off signal at the time.

Either way should have the basically the same outcome, creating a scheduled job that will wake the rule at the specified time and do whatever you've configured. (There is often misunderstanding about what a "Wait" does, but creating a event subscription or a scheduled job is usually what they'll do, then the app/rule goes to sleep until something, like the corresponding event or time, wakes it up again--it's not really "running" in the meantime.)

But a power off is equally likely to affect either: if the hub was off when the scheduled job was supposed to have run, it will indeed likely be missed (at least until something re-schedules it, like turning it on the next day and waiting for time again). How to deal with scheduled jobs that were missed when the hub was off is tricky--no good way for the platform to know what you would or wouldn't want to actually happen--and so the best way to avoid it is to keep the hub on a UPS to prevent accidental shutdowns and avoid updating firmware (or rebooting for whatever reason) when you know you have something that should happen. Here is one discussion I've seen on this subject recently (nevermind the thread/subject title--started out differently), though there are undoubtedly more:

1 Like

Excellent info. And yes, the wait events are definitely misunderstood here. I felt it was running in the background so that's good to know.

Thanks for the info and explanations!

1 Like