Roof Heater - Add past 24h of Snow to the logic


#21

Sorry to be a bummer here, but I was finally able to test out the $weather.yesterday.history.observations.snow variable from the API and it doesn’t actually report inches of snow each hour.

If there was snow that hour (even .01 inches) it will put a one for that hour, and if not then a zero. So basically turning it into a variable to get a total in inches like I did above doesn’t work. My total says I got 7 inches of snow yesterday, but looking at the weather underground website, in fact there were 7 hours with .01 inches of snow.

So basically that whole expression is kind of a waste of cycles (unless you want to know how many hours had reported snow yesterday). You’d be better off just taking the variable without the brackets and trimmed to just the digits:

replace($weather.yesterday.history.observations.snow, ‘/\\D/’, “”)

and evaluating if it is greater than zero to see if there was any snow the previous day.

It looks like you don’t care about the amount of snow for the heater control at least so changing to this will still work and will be more efficient.


#22

Did a bit of digging into the weather underground api documentation, and it looks like the proper call to get snowfall AMOUNTS (in inches) per hour would actually be:

$weather.yesterday.history.observations.snowfalli[i]

again replacing the “i” in brackets with the number corresponding to the hour as above. I am getting all “null” returns however and i’m not sure if thats just because there was no snow here yesterday or because webcore doesn’t support that specific call. I will dig some more to see what I can find…