OK, I’ve been doing a bit of experimenting, and I think I’m getting a better idea of what’s available from OpenWeather. I set up these flows to shoot log entries to a remote log
We had some snow the last couple of days, not much, about 10cm total maybe. I set this up towards the end of the snow period though, so I missed the start and full run of snowing. The results of the log …
Feb 18 19:38:47 Homey snow_all_changes Snow > 0mm (1) with precip (0)
Feb 18 19:38:47 Homey Snow precip changed (1) with (0.75) mm and precip (0)
Feb 18 19:53:47 Homey Snow precip changed (0) with (0.21) mm and precip (0)
Feb 18 20:38:47 Homey Snow precip changed (0) with (0.14) mm and precip (0)
Feb 18 21:08:47 Homey Snow precip changed (0) with (0) mm and precip (0)
Feb 19 02:38:48 Homey Snow precip changed (0) with (0.1) mm and precip (0)
Feb 19 03:38:49 Homey Snow precip changed (0) with (0.13) mm and precip (0)
Feb 19 04:38:49 Homey Snow precip changed (0) with (0.33) mm and precip (0)
Feb 19 05:38:49 Homey Snow precip changed (0) with (0.15) mm and precip (0)
Feb 19 06:38:50 Homey Snow precip changed (0) with (0.24) mm and precip (0)
Feb 19 07:38:50 Homey Snow precip changed (0) with (0.33) mm and precip (0)
Feb 19 08:38:50 Homey Snow precip changed (0) with (0.22) mm and precip (0)
Feb 19 09:38:50 Homey Snow precip changed (0) with (0) mm and precip (0)
Feb 19 10:23:51 Homey Snow precip changed (0) with (0.25) mm and precip (0)
Feb 19 10:53:51 Homey Snow precip changed (0) with (0.32) mm and precip (0)
Feb 19 11:08:51 Homey Snow > 0mm (1) with precip (0)
Feb 19 11:08:51 Homey Snow precip changed (1) with (0.51) mm and precip (0)
Feb 19 11:23:51 Homey Snow precip changed (1) with (0.76) mm and precip (0)
Feb 19 11:38:51 Homey Snow precip changed (1) with (0.51) mm and precip (0)
Feb 19 11:53:51 Homey Snow precip changed (1) with (1.27) mm and precip (0)
Feb 19 12:08:51 Homey Snow precip changed (1) with (0.89) mm and precip (0)
Feb 19 12:23:51 Homey Snow precip changed (1) with (0.76) mm and precip (0)
Feb 19 12:53:51 Homey Snow precip changed (1) with (0.89) mm and precip (0)
Feb 19 13:08:51 Homey Snow precip changed (0) with (0) mm and precip (1.78)
Feb 19 13:23:51 Homey Snow > 0mm (1) with precip (0)
Feb 19 13:23:51 Homey Snow precip changed (1) with (1.27) mm and precip (0)
Feb 19 13:38:51 Homey Snow precip changed (0) with (0) mm and precip (0.51)
Feb 19 15:38:52 Homey Snow > 0mm (1) with precip (0)
Feb 19 15:38:52 Homey Snow precip changed (1) with (1.27) mm and precip (0)
Feb 19 16:08:52 Homey Snow precip changed (0) with (0) mm and precip (0.25)
The Snow precip changed entries appear to trigger on any change in snow precip. The Snow precipitation in millimeters variable is available in this flow as you can see from the image above, and is shown in the log entries as with (0.24) mm for example. The Snow variable is just the rounded up/down value of the Snow precipitation in millimeters variable.
But I don’t know if that is since last check, or over last hour or last . What that value represents is kind of critical - anyone have any idea ?
The Snow > 0mm entries look like they only trigger when the snowfall transitions from 0 to >1. That makes sense. Oddly though the Snow precipitation in millimeters variable is NOT available to the flow.
I exported the flows, and these are the json blobs for the message in the logging cards
Snow precip changed
"message": "Snow precip changed ([[homey:device:0352642f-a0bd-410f-a2cf-1bd1b601821a|measure_snow]]) with ([[trigger::e49b6a0b-4293-40b2-a186-4778db578051::measure_snow]]) mm and precip ([[homey:device:0352642f-a0bd-410f-a2cf-1bd1b601821a|measure_rain]])"
Snow > 0mm
"message": "Snow > 0mm ([[homey:device:0352642f-a0bd-410f-a2cf-1bd1b601821a|measure_snow]]) with precip ([[homey:device:0352642f-a0bd-410f-a2cf-1bd1b601821a|measure_rain]])"
From this it seems that the #Snow variable is just the rounded up/down value of the #Snow precipitation in millimeters variable, the measure_snow value. The #Precipitation variable is the amount of rain, not snow (I think).
I’m think that when the #Snow variable transitions from 1→0 the #Precipitation variable (measure_rain) is actually measuring rainfall, like it got warmer so the snow changed to rain. In the 3x instances of that in the log at the bottom the #Snow precipitation in millimeters variable was 0.
There is one instance of that 1→0 change at the top of the log where the #Snow precipitation in millimeters variable was 0.21 and the #Precipitation variable was 0, so that makes sense. It was still snowing, not raining.
We need a heavier snowfall to see if the #Snow variable increases to 2 for a 2.5mm value of #Snow precipitation in millimeters …
Now I need to figure out the logic to figure out how much snow has fallen, and when to turn on the heat tapes. Ideal would be a rolling window, say over 25mm over the last 24 hours. For example, it gets up to 50mm and then stops. As the window moves forward in time, eventually the entries will total up to < 25mm, and we turn the heat tapes off.
I don’t think we can do this with just logic, so it will probably have to be a script that can maintain state. Maybe 24 buckets and the collected total snow precipitation for each hour dropped into each bucket. Then total up the buckets and if > 25mm turn on the tapes, if < 25mm turn them off. Something like that. Hrm, the Simple (sys) Log app can export in csv or json …