Jump to content

Save Boot Time To Variable?


johnmsch

Recommended Posts

I'm looking for a way to save the boot time of the ISY to a variable.  I have a couple of push/email notifications that when sent, I'd like to add a line with the timestamp of the last time the ISY booted.  I'm running v4.5.4.

 

Thanks for any tips/ideas.

Link to comment

I compact my dates and times to a format like this.

 

MMDD.hhmmss.

 

I do this on a regular basis in V5 and keep it in an Integer variable with init to.

Then I keep another flag variable set to 1 showing initialisation and init to 0.

 

When ISY boots up I check the flag variable to see if it is initialised status and if not I create my running date.time variable.

Now I send both Integer variable and my running date.time variable in a notification.

 

Now, the notification sends the last known time (Integer date.time), as well as the current running date.time. By subtracting about 3 minutes, 30 seconds from the difference, I know how long the power was off. It's not real accurate, being based on the reboot time of ISY but it works as rough indicator.

 

Lastly, I set the initialised status variable to 1.

 

 

If you are not running v5.xx you will need another date time source. It gets a little more complicated to create than just massaging system variables.

Link to comment

I'm looking for a way to save the boot time of the ISY to a variable.  I have a couple of push/email notifications that when sent, I'd like to add a line with the timestamp of the last time the ISY booted.  I'm running v4.5.4.

 

Thanks for any tips/ideas.

 

This is the program I use which runs when the ISY boots

Create a custom email named "System Re-Start". which the attached program calls up. The 1 minute delay is to allow for the ISY to reboot. (The email will have the time and date it was sent).

 

 

 

System Re-Boot Notify email

 

If

   - No Conditions - (To add one, press 'Schedule' or 'Condition')

 

Then

        Wait  1 minute

        Send Notification to 'ISY  Message Home' content 'System Re-Start'

       

Else

   - No Actions - (To add one, press 'Action')

 

Link to comment

I'm looking for a way to save the boot time of the ISY to a variable.  I have a couple of push/email notifications that when sent, I'd like to add a line with the timestamp of the last time the ISY booted.  I'm running v4.5.4.

 

Thanks for any tips/ideas.

You'll need to either 

 

1) Upgrade to 5.x since you can't access system time in 4.5.4 as something to set a variable to

2) Load the set of programs I wrote that puts the date into variables, then you can use those values to set your boot time variables.  https://wiki.universal-devices.com/index.php?title=ISY-99i_Generic_Calendar_Using_Programs_and_Variables

 

And you'll also need to add some programs to set the time.  I also wrote those, but don't have them posted to the wiki.  But they only self correct once per hour, so you would need to put a delay of 1 hour in your program that sets the boot time variable and then know that the boot was actually an hour earlier.  Or just subtract the hour back out with more programs.

 

In summary , 5.x is easier.

Link to comment

Ok, looks like going to 5.x is the easiest way.  Is v5 still in Beta?  I usually keep fairly current with the firmware, but it looks like 4.5.4 is the most recent release.

 

BTW apostolakisl, very impressive code in your programs.  Having spent 40+ years in development, I do appreciate all the effort you put into that!

Link to comment

Ok, looks like going to 5.x is the easiest way.  Is v5 still in Beta?  I usually keep fairly current with the firmware, but it looks like 4.5.4 is the most recent release.

 

BTW apostolakisl, very impressive code in your programs.  Having spent 40+ years in development, I do appreciate all the effort you put into that!

5.x is alpha.

 

It can be downloaded if you go to the forum front page and scroll half way down you'll see a developer section.

Link to comment

I've got a Pi that sends the 'minutes this year' to the ISY every minute. When the power goes out, I have a program that sends me the amount of time the power was out, and what time it booted up.

 

Problem is, I also have the ISY plugged into a UPS. So the power only "goes out" an hour or so after the power actually goes out. Which is still plenty useful, since it warns me I need to restart my server and check some other stuff.

 

I've been building a weather station that has a battery back up, though. My plan is to read the voltage from the power controller. If it's 5v, the power is on. If it's 4.3v or less, the battery is powering the weather station. Wouldn't be too hard to update an ISY variable letting me know.

Link to comment

Archived

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


×
×
  • Create New...