How Do I Get Time of Power Outage?

Posted on
Tue Jun 28, 2016 11:41 am
thomasw offline
Posts: 135
Joined: Feb 13, 2011

How Do I Get Time of Power Outage?

Hi All,
I'm trying to find out what time the Electric goes out when we have a storm?
(to find out duration time)
With Indigo, I get an email alert when the power is restored, but I have no idea
how long it was out, or exactly "when" it went out. This is very important when
I am away from home. I know Indigo can't send me anything when the power
goes out, because the mac/Indigo are off without power. But, is there any way
that Indigo could tell me how long it was off, when it does get restarted/restored?
I was thinking some kind of script that would have Indigo check it's own event
connection logs, and see when it was last connected and running, and the new restart time?
Then when the power is restored, and Indigo sends the email alert, it
could list the last connection time and when it was restored. This would be
very helpful for a number of reasons. (Security, Food Spoilage, Pets/house temps, etc.)
Thanks

Posted on
Tue Jun 28, 2016 1:58 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: How Do I Get Time of Power Outage?

You might consider putting your computer on a UPS unit to protect it... and use the APC UPS Plugin to read status information. Would need to read through that information, but I am pretty sure you get an event or monitor a state change to see when the computer went to UPS battery - indicating a loss of power. Then could look at either the back on power time OR reboot time (in the event the system was off long enough for the computer to shut down).

Posted on
Tue Jun 28, 2016 3:15 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: How Do I Get Time of Power Outage?

I could be a pretty easy script to write. If the script is logging the time every minute (or whenever) into a variable with logic that pulls that time out of the variable before updating it to see if minutes were "lost" then you could have that same script email you and all of that would happen as soon as the computer restarts.

Without sitting down and actually WRITING this, it would be something like:

Get the Indigo variable for "logTime"
If difference between "logTime" and now is more than 5 minutes then send me an email letting me know how many minutes it has been.
If difference between "logTime" and now is 1 minute, everything is cool, log the time again.

It is pretty low tech, but it's a very easy script to write and gets the job done.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests