When power gets restored after an outage some devices revert or go to an undesirable state. Is there a way I can create a rule that at hub start-up immediately runs some actions? Currently im using a rule with periodic triggers like every 30min to check and set states of outlets and switches.
Believe that RM and webCoRE both have a System Start trigger that can fire a rule/piston.
Yeah, in Rule Machine, you can create a trigger with capability "Location Event" and event "systemStart."
Here is a example.
Power just came back on and none of the actions were completed. Looking at logs it didn't even try. Do I need a delay in the beginning of the actions to give it time to initialize?
OK, update. I have never gotten this "systemStart" trigger to work. I have tried several different delays to let things boot up before performing actions and nothing, no notification or switch actions.
And when the power comes back on and I remote admin into the hub there is no "systemStart" in the Location Events logs. I see systemStart in the Hub Events log and oddly enough it was logged 3 hours before the power actually came back on which is impossible because the hub was off. Any advice?
Does it send a message if you reboot or restart the hub from Settings?
I don't use it anymore, but I'd get pushover and text messages every time the hub reboot.
I didn't test it with an unexpected power loss.
systemStart will show up under "Hub Events," not "Location Events," so that much is normal.
Whenever a rule isn't working as expected, a good first step is to enable all logging (this is on the main page of the rule), then see what you find in Logs -- hopefully at least a trigger and your first action or two, or you might see clues as to what went wrong if things stop.
OK, I enabled the rule logs and did a system reboot from settings page. All is working and the logs show it. Also logs show it has a >2min after initialize before systemStart fires, so maybe I can skip the delays.
Now question is why is it not working after a power outage. I have logs enabled to check into that when ever that next outage is.
i would assume it doesnt know the state of your switches yet.. maybe remove them.. it doesnt hurt to turn them off if already off.
here is my rule that works fine..
it is strange it does show up in hub events under the logs but the rule fires with locaton event..
ie here it is firing
Is your "systemStart" working after a power outage (hub power cycle) or reboot?
Yes all of them.. although mine doesn't shutdown on power outages that is why i have a ups.
Put an alert or log statement at top of rule before any ifs.. i am sure as i said your if is causing the issue.
OK, some progress. The "systemStart" trigger rule fired this morning when the power came back on. Great!
Now lets discuss the Hub time. The power went out around ~ 05:00 (am) and came back on ~09:20 (am) after the Sun was sufficient to charge. But all the initial logs & notifications right after restart were all showing ~05:00 (am). So does the hub restart and use the last known time until it can poll NTP? Is there a log for a NTP poll and any idea how long before it polls? My sent notification of the power being restored event at 05:00am which is clearly wrong.
restart logs ~09:20am
The NTP poll happens fairly soon in the process, but as you've seen there is sometimes a small delay. There is an old driver that will let you force an update of the time ( Update Hub Time via driver ), but by the time you'd call it chances are that the hub would have already updated the time.