Jump to content

How to determine a power failure has occurred?


kzboray

Recommended Posts

How do you all determine that your ISY and Polisy have just rebooted due to a power failure? And secondarily to that how can I force a restart of a particular NS from the ISY?

On a power outage, by the time the router is back up and all the LifX devices have rebooted, the Polisy has restarted and NS's like the LifX NS need to be manually (Hopefully automagically) restarted to find all the missing devices.

Link to comment
Startup/UptimeCounter - [ID 008D][Parent 0126][Run At Startup]

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Wait  9 minutes 
        Resource 'ISY.Reboot.Notification'
        Wait  1 minute 
        $iUptime.Counter.old  = $iUptime.Counter.curr
        $iUptime.Counter.old Init To $iUptime.Counter.old
        $iUptime.Counter.curr  = 10
        $iUptime.Counter.curr Init To $iUptime.Counter.curr
        Run Program 'Start HeartBeats and Misc' (Then Path)
        Wait  5 seconds
        Run Program 'Startup/UptimeCounter' (Else Path)
 
Else
        Wait  10 minutes 
        $iUptime.Counter.curr += 10
        $iUptime.Counter.curr Init To $iUptime.Counter.curr
        Run Program 'Startup/UptimeCounter' (Else Path)
 
Wait 9 minutes to make sure the modem and router had time to recover 
(if this 'run on startup' was restore from PowerFail this delay is needed for the modem and router to come up before send a notification)
then wait 1 min so notification goes out before counters reset (yes they reset too quick without a wait)

 

I use this program.  It's my only 'run at startup' program, although it runs others.  Having only one 'run at startup' allows a tiny bit of load reductions at startup (see last paragraph for reason).

The initial 9 minutes was to make sure the modem and router came back online first (although those devices probably never lost power).   I initially was counting uptime in hours, but revised it to 10 minute blocks when I realized there should be a 10 minute delay in section (A).    Traditional linux systems count uptime in 1 minute increments but 10 minutes increments were good enough for my purposes.  Once the Then block completes once at startup, the else block loops forever.   (in 5.x there is a repeat statement that could also be used but this program existed before that was available and this works just as well.)

My systems fairly large, there are usually "UDQ queue full" errors on startup, I've found when manually restarting the ISY it works best wait for the reboot notification before starting the admin console.

I don't think there is a method for the ISY to restart nodeservers yet.

Edit to add:

The date/time that $iUptime.Counter.old was last changed is also a handy reference point if you want to know when the ISY was last restarted without having to convert minutes to hours/days/etc then do calendar math...   (yellow high-lite on the variables page shows the approximate date/time of the last restart)

image.thumb.png.e13f4d0075b3d4828196c45f21a9ec6e.png

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...