Is there documentation on what type of wait events survive a hub reboot?

I've looked over the documentation here and it's entirely possible I'm just missing it somewhere. The documentation is pretty large.

There are a few things I would like to know

  1. Repeat while
  2. Delay actions
  3. Wait for Events
  4. Wait for Expression

I am assuming 3 and 4 function the same under the hood. So out of repeat, delay, and wait what will survive a hub reboot?

The reason I ask is I use a virtual switch to set when we are on vacation. I would like certain things to happen every X days until we get back from vacation. But I also don't want it to happen immediately, the first run should be after X days.

So right now, my rule says

wait for event :-> Elapsed time 168:00:00
While (Vacation switch is on) repeat every 168:00:00
Do a thing

If my house loses power and the hub reboots while we're out of town, will this rule keep running?

If the hub reboots at the exact time an action is to happen (Wait, Delay, etc.) then it'll be missed, but so will any trigger event to a rule. If a reboot completes before it's scheduled to happen then the rule will keep running but don't take my word for it. Create some test rules (with shorter elapsed time and repeat) and prove it to yourself. Test rules are a great way to gain confidence in the system (and debug problems you may be encountering).

I’ve had inconsistent results with waits/delays surviving reboots. Recently, two rules with waits failed when a reboot occurred during the wait period. The reboot was not time-wise near the rule trigger. I’ve had all rules with similar waits fail to survive a reboot at least once in the past 12 months. The next iteration the rule process successfully. Otherwise, all rules survive. I’ve tested thoroughly, but because of the inconsistency, determining a pattern is difficult. I don’t have devices controlled by the similar rules I consider critical. If I continue to experience problems, I will separate the rule into an on and off rule.
image

Also, there’s plenty of info on this forum about HE crashing w/o a graceful shutdown, as can happen from a power outage.

I'd recommend that everyone consider some sort of battery backup. I've been using this with good results:

Testing it, I've been able to run my hub for 8 hours on the battery but I'm sure that'll be hub load dependent. My power outages typically last 2-3 hours so this is a good and simple solution for me.

1 Like

I too have experienced some inconsistencies in the past when long wait times have spanned reboots/power failures despite what @pseudonym stated. I wonder if this was due to problems or behaviors specific to previous firmware versions as a number of bugs have been addressed in RM as part of these updates.

At any rate, going back to the time when I was experiencing problems with this, I have not experienced any problems once I separated on and off rules when spanning longer time periods as suggested by @FiveNines and so have continued this practice (whether it is actually necessary or not). Of course, YMMV.

I define long waits as multiple days. I don't consider a wait that completes within a 24-hour period to be a long wait. I'm sure others define if differently. If you do have a long wait and happen to go into a rule while the rule is waiting and hit Done or Update Rule the rule will initialize and reset the wait. If you restore the database from a backup that can lose the wait. It's troubling to me that so many people have experienced issues with Waits and hub reboots. Luckily I have not. Perhaps someone who's experiencing this issue could turn on logging and provide those to the development team as this isn't supposed to happen.

Hi @pseudonym ,
How long have you been successfully using the Talentcell device you suggested as a UPS? The reason I ask is that I looked into purchasing this power bank and ran into the following response from Talentcell Technology in the Q&A section of the seller’s Amazon listing:

Question:

Will this act like a ups in a power outage? how fast does it switch from ac to dc?

Answer:

It’s not ups but can use as ups if you don’t use for 3-5 years (one year is ok). Switch time is 0,no interup.
By Talentcell Technology SELLER on August 7, 2019

I am concerned with possible cell swelling/fire hazard etc if manufacturer does not recommend longterm use of this device as a UPS. Any thoughts based on your experiences using this (and for how long)? TIA for any insights.

@moh I've been using this since July 2019 and am surprised it was that long ago that I bought this. If I saw the August 2019 answer I might have gone a different route! That being said, we just had some very windy days over the past few weeks. My power hiccuped but the the hub never went down. I just pulled the a/c power, twice to make sure, and the hub remained powered.

I also have the Talentcell battery backup for the last couple of years and it has worked perfectly. In fact, I hooked up a POE splitter (12v output) to the battery pack so it charges directly from the POE as I don't have an outlet where I have the Hubitat located.

Of course I also have a very large Ecoflow Delta Pro with house hookup for much longer outages (also in Florida)

This isn't an on or off rule though, it's an in-between. I actually do have a separate off rule for when the virtual switch turns off.

What I really need to do is replace the battery in the UPS for my network rack (it's completely dead) and then get a PoE injector to power the hub so that the hub would run off the UPS during a power outage. I live in Florida and during the summers when it's the rainy season it's not uncommon for the power to flicker or go out for a few seconds at a time during a storm. If it's out for more than a few seconds it's probably going to be out for hours or more.

As a general answer to this, reboots only affect apps, including rules, in two very specific circumstances:

  1. If the rule subscribes to or waits for the systemStart event.
  2. If a scheduled event time happens while the hub is down.

Otherwise, reboot does not touch apps at all. Waits are still there, Delays are still scheduled events, etc. The hub does not reach back in time to any scheduled event time that might have been passed.

7 Likes

I wonder if it would be feasable to set a variable on a rule with a long wait (lets say this wait for event is 3 hours away but the rule has already been triggerd) and have a rule that if it detects the system start even (on hub reboot) it looks for that variable and re start that rule so it picks up from that point on instead of waiting for the next day. Or is my logic wrong on that?

There are an unlimited number of cases to solve for. My advice: give it a rest, perfection is out of reach.

3 Likes

michael fassbender perfection GIF