bpaauwe / udi-darksky-poly

Other
1 stars 0 forks source link

Sunrise / Sunset from DarkSky #7

Open memphis2k opened 4 years ago

memphis2k commented 4 years ago

I was reading some talk about Sunrise / Sunset but is it integrated into DarkSky Poly? Sounds like DarkSky has API calls already for Sunrise/Sunset. I know about Time Data server but just hoping to keep everything in on poly server, similar to ISY's weather/climate module.

Thanks,

bpaauwe commented 4 years ago

I get this question quite a bit. Unlike the climate module, nodes can only contain numeric values (and fixed mapping of a number to string) so there's no way to have a node with a value like "5:15:00 03/29/2020". The primary way I'd store a sunrise/sunset time in a node would be to use epoch time (number of seconds since Jan 1, 1970) so you end up with ever increasing large numbers and no way to really use that in a program. I could convert those times to individual components (so store sunrise time hour, sunrise time minute, etc.) which is what the time data server does (I believe). But the issue with that is that there are a limited number of node values that can be assigned, and most of those are already being used by the actual weather data and I don't think there are 4 left to do hour/minute for sunrise/sunset.

If the ISY firmware is updated to support a epoch time node value so that it can be compared in programs the same way it works with the climate module, I'll revisit adding these to the weather node servers.

memphis2k commented 4 years ago

Thanks for the reply. I am using epoch more and more in ISY. Specially for runtime calculating and also seconds since beginning of the day. Appreciate your hard work in getting all of these weather nodes into ISY.