Jump to content

Converting unix epoch timestamp


johnnyt

Recommended Posts

Posted

Hi @Jimbo.Automates, As you know the Unix epoch timestamp is one of the fields available for each Airthings device (at least the Wave Plus devices anyway). I'd like to be able to use it to know how long it's been since a device was last updated in seconds or minutes and trigger an event/notification if it's been too long. I feel like I would need to either convert it to YYYYMMDDDHHMMSS or be able to get/calculate the current epoch time 'now' so I can do the math using ISY programs.

About 99% of my google search results for the formula or algorithm to convert current time to unix epoch time were either online calculators for human consumption, how to do it in Excel, or talked about using built in linux or windows commands, e.g. date +%s  in linux. (I tested the latter and it does work on the Polisy.) When I did find formula or algorithm info it was shell code or python, etc., which didn't translate well to ISY programming and made me think it was silly to try to do it using ISY programming. 

Instead I wondered if you could make the NS do the simple calculation of subtracting 'date +%s' from epoch time that the API provides (both have same 10 digit resolution) and display a "time since last updated" in minutes or seconds. As far as I'm concerned it could replace the current time field in NS/ISY because I can't see what other use the unix epoch time would have but if you wanted to have both, it's fine with me.

Thanks for considering it.

 

  • 7 months later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...