Outdoor Heated Mats and Downspouts turn on hours before snow


#1

1) Give a description of the problem
Trying to automate my outdoor heated mats and roof/downspout heat tape (cables) to turn on a hour before it snows instead of manually doing it.

2) What is the expected behaviour?
Poll openweather every 15 minutes for their hourly forecasts, if there is snow expected at 3pm, turn on my heated mats/cables at 2pm. Turn off when there is no snow in the forecast.

3) What is happening/not happening?
I have my piston turn on when there is SNOW in the current forecast but not sure how I can design it to use the hourly forecasts. I thought maybe storing the hourly forecasts into an array and and then comparing the current time to forecast time and if its an hour before SNOW is present, then turn on? Not sure how I would go about doing that with the openweather OneCall API (https://openweathermap.org/api/one-call-api)

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
NA for now.

Any help would be greatly appreciative!


#2

It’s that time of year again to take out my winter mats and havent found a solution for this yet… any help would be greatly appreciated…

The output from the OpenWeatherAPI is as follows:

Not sure how to get the times, do I store the information into an array and do a compare with the current UTC + 3600 (1 hour) and then look for the weather forecasted?

{“lat”:xx,“lon”:xx,“timezone”:“America/Toronto”,“timezone_offset”:-18000,“current”:{“dt”:1668462605,“sunrise”:1668427843,“sunset”:1668462781,“temp”:2.42,“feels_like”:-0.59,“pressure”:1029,“humidity”:58,“dew_point”:-4.43,“uvi”:0,“clouds”:94,“visibility”:10000,“wind_speed”:3,“wind_deg”:348,“wind_gust”:3.47,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}]},“hourly”:[{“dt”:1668459600,“temp”:2.5,“feels_like”:-0.55,“pressure”:1029,“humidity”:56,“dew_point”:-4.77,“uvi”:0.21,“clouds”:94,“visibility”:10000,“wind_speed”:3.06,“wind_deg”:340,“wind_gust”:3.57,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0},{“dt”:1668463200,“temp”:2.42,“feels_like”:-0.59,“pressure”:1029,“humidity”:58,“dew_point”:-4.43,“uvi”:0,“clouds”:94,“visibility”:10000,“wind_speed”:3,“wind_deg”:348,“wind_gust”:3.47,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668466800,“temp”:2.11,“feels_like”:-0.7,“pressure”:1029,“humidity”:60,“dew_point”:-4.29,“uvi”:0,“clouds”:94,“visibility”:10000,“wind_speed”:2.69,“wind_deg”:349,“wind_gust”:3.6,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668470400,“temp”:1.68,“feels_like”:-0.87,“pressure”:1029,“humidity”:62,“dew_point”:-4.26,“uvi”:0,“clouds”:95,“visibility”:10000,“wind_speed”:2.34,“wind_deg”:351,“wind_gust”:3.42,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668474000,“temp”:1.23,“feels_like”:-0.88,“pressure”:1030,“humidity”:63,“dew_point”:-4.45,“uvi”:0,“clouds”:95,“visibility”:10000,“wind_speed”:1.88,“wind_deg”:356,“wind_gust”:2.79,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668477600,“temp”:0.8,“feels_like”:-0.99,“pressure”:1031,“humidity”:65,“dew_point”:-4.45,“uvi”:0,“clouds”:96,“visibility”:10000,“wind_speed”:1.6,“wind_deg”:11,“wind_gust”:2.3,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668481200,“temp”:0.35,“feels_like”:-1.55,“pressure”:1031,“humidity”:66,“dew_point”:-5.56,“uvi”:0,“clouds”:98,“visibility”:10000,“wind_speed”:1.63,“wind_deg”:18,“wind_gust”:2.18,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668484800,“temp”:0.04,“feels_like”:-2.08,“pressure”:1031,“humidity”:67,“dew_point”:-5.54,“uvi”:0,“clouds”:97,“visibility”:10000,“wind_speed”:1.75,“wind_deg”:41,“wind_gust”:2.37,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668488400,“temp”:-0.3,“feels_like”:-2.77,“pressure”:1031,“humidity”:69,“dew_point”:-5.51,“uvi”:0,“clouds”:93,“visibility”:10000,“wind_speed”:1.97,“wind_deg”:40,“wind_gust”:2.9,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668492000,“temp”:-0.43,“feels_like”:-3.15,“pressure”:1032,“humidity”:69,“dew_point”:-5.56,“uvi”:0,“clouds”:92,“visibility”:10000,“wind_speed”:2.16,“wind_deg”:38,“wind_gust”:3.4,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668495600,“temp”:-0.68,“feels_like”:-3.53,“pressure”:1032,“humidity”:69,“dew_point”:-5.85,“uvi”:0,“clouds”:61,“visibility”:10000,“wind_speed”:2.23,“wind_deg”:47,“wind_gust”:3.53,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668499200,“temp”:-0.86,“feels_like”:-4.06,“pressure”:1032,“humidity”:67,“dew_point”:-6.37,“uvi”:0,“clouds”:66,“visibility”:10000,“wind_speed”:2.52,“wind_deg”:49,“wind_gust”:4.23,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668502800,“temp”:-0.99,“feels_like”:-4.15,“pressure”:1031,“humidity”:64,“dew_point”:-7.16,“uvi”:0,“clouds”:76,“visibility”:10000,“wind_speed”:2.46,“wind_deg”:57,“wind_gust”:4.24,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668506400,“temp”:-1.16,“feels_like”:-4.64,“pressure”:1031,“humidity”:60,“dew_point”:-8.05,“uvi”:0,“clouds”:75,“visibility”:10000,“wind_speed”:2.74,“wind_deg”:53,“wind_gust”:4.91,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668510000,“temp”:-1.21,“feels_like”:-4.39,“pressure”:1031,“humidity”:56,“dew_point”:-8.94,“uvi”:0,“clouds”:80,“visibility”:10000,“wind_speed”:2.44,“wind_deg”:60,“wind_gust”:4.72,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668513600,“temp”:-1.18,“feels_like”:-4.81,“pressure”:1032,“humidity”:54,“dew_point”:-9.51,“uvi”:0,“clouds”:83,“visibility”:10000,“wind_speed”:2.88,“wind_deg”:57,“wind_gust”:5.51,“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“pop”:0},{“dt”:1668517200,“temp”:-0.6,“feels_like”:-4.62,“pressure”:1032,“humidity”:51,“dew_point”:-9.59,“uvi”:0,“clouds”:100,“visibility”:10000,“wind_speed”:3.47,“wind_deg”:61,“wind_gust”:6.49,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0},{“dt”:1668520800,“temp”:0.08,“feels_like”:-4.45,“pressure”:1031,“humidity”:50,“dew_point”:-9.12,“uvi”:0.21,“clouds”:100,“visibility”:10000,“wind_speed”:4.4,“wind_deg”:66,“wind_gust”:7.95,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0},{“dt”:1668524400,“temp”:0.85,“feels_like”:-3.58,“pressure”:1031,“humidity”:52,“dew_point”:-8.12,“uvi”:0.47,“clouds”:100,“visibility”:10000,“wind_speed”:4.53,“wind_deg”:72,“wind_gust”:7.44,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0},{“dt”:1668528000,“temp”:1.02,“feels_like”:-3.46,“pressure”:1031,“humidity”:57,“dew_point”:-6.84,“uvi”:0.85,“clouds”:100,“visibility”:10000,“wind_speed”:4.68,“wind_deg”:82,“wind_gust”:7.36,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.01},{“dt”:1668531600,“temp”:1.09,“feels_like”:-3.73,“pressure”:1029,“humidity”:64,“dew_point”:-5.22,“uvi”:1.04,“clouds”:100,“visibility”:10000,“wind_speed”:5.32,“wind_deg”:80,“wind_gust”:8.46,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.25,“snow”:{“1h”:0.17}},{“dt”:1668535200,“temp”:1.31,“feels_like”:-3.45,“pressure”:1028,“humidity”:67,“dew_point”:-4.49,“uvi”:0.98,“clouds”:100,“visibility”:10000,“wind_speed”:5.32,“wind_deg”:77,“wind_gust”:9.06,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.08},{“dt”:1668538800,“temp”:1.21,“feels_like”:-3.66,“pressure”:1027,“humidity”:76,“dew_point”:-2.79,“uvi”:0.6,“clouds”:100,“visibility”:10000,“wind_speed”:5.49,“wind_deg”:80,“wind_gust”:9.52,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.11},{“dt”:1668542400,“temp”:1.23,“feels_like”:-3.67,“pressure”:1027,“humidity”:78,“dew_point”:-2.33,“uvi”:0.33,“clouds”:100,“visibility”:4017,“wind_speed”:5.55,“wind_deg”:77,“wind_gust”:10.05,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.32,“snow”:{“1h”:0.12}},{“dt”:1668546000,“temp”:1.5,“feels_like”:-3.45,“pressure”:1025,“humidity”:75,“dew_point”:-2.7,“uvi”:0.11,“clouds”:100,“visibility”:10000,“wind_speed”:5.8,“wind_deg”:77,“wind_gust”:10.53,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.31,“snow”:{“1h”:0.1}},{“dt”:1668549600,“temp”:1.22,“feels_like”:-3.76,“pressure”:1025,“humidity”:73,“dew_point”:-3.44,“uvi”:0,“clouds”:100,“visibility”:10000,“wind_speed”:5.7,“wind_deg”:77,“wind_gust”:10.56,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04n”}],“pop”:0.17},{“dt”:1668553200,“temp”:0.8,“feels_like”:-4.36,“pressure”:1025,“humidity”:76,“dew_point”:-3.21,“uvi”:0,“clouds”:100,“visibility”:10000,“wind_speed”:5.84,“wind_deg”:74,“wind_gust”:11.1,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:0.4,“snow”:{“1h”:0.19}},{“dt”:1668556800,“temp”:0.52,“feels_like”:-4.69,“pressure”:1025,“humidity”:79,“dew_point”:-2.93,“uvi”:0,“clouds”:100,“visibility”:10000,“wind_speed”:5.79,“wind_deg”:77,“wind_gust”:11.52,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:0.4,“snow”:{“1h”:0.23}},{“dt”:1668560400,“temp”:0.19,“feels_like”:-5.11,“pressure”:1024,“humidity”:80,“dew_point”:-3.11,“uvi”:0,“clouds”:100,“visibility”:10000,“wind_speed”:5.81,“wind_deg”:71,“wind_gust”:11.42,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:0.32,“snow”:{“1h”:0.26}},{“dt”:1668564000,“temp”:0.06,“feels_like”:-5.2,“pressure”:1023,“humidity”:79,“dew_point”:-3.44,“uvi”:0,“clouds”:100,“visibility”:10000,“wind_speed”:5.66,“wind_deg”:74,“wind_gust”:11.24,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:0.25,“snow”:{“1h”:0.19}},{“dt”:1668567600,“temp”:-0.13,“feels_like”:-5.33,“pressure”:1022,“humidity”:83,“dew_point”:-3.02,“uvi”:0,“clouds”:100,“visibility”:9815,“wind_speed”:5.44,“wind_deg”:78,“wind_gust”:10.99,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:0.56,“snow”:{“1h”:0.38}},{“dt”:1668571200,“temp”:-0.37,“feels_like”:-5.46,“pressure”:1021,“humidity”:86,“dew_point”:-2.67,“uvi”:0,“clouds”:100,“visibility”:5102,“wind_speed”:5.14,“wind_deg”:73,“wind_gust”:10.38,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:0.66,“snow”:{“1h”:0.56}},{“dt”:1668574800,“temp”:-0.82,“feels_like”:-5.97,“pressure”:1020,“humidity”:90,“dew_point”:-2.36,“uvi”:0,“clouds”:100,“visibility”:1317,“wind_speed”:5.05,“wind_deg”:67,“wind_gust”:10.28,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:0.77,“snow”:{“1h”:0.65}},{“dt”:1668578400,“temp”:-1.42,“feels_like”:-6.61,“pressure”:1019,“humidity”:96,“dew_point”:-2.15,“uvi”:0,“clouds”:100,“visibility”:124,“wind_speed”:4.86,“wind_deg”:63,“wind_gust”:10.49,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:0.93,“snow”:{“1h”:0.91}},{“dt”:1668582000,“temp”:-1.86,“feels_like”:-7.16,“pressure”:1018,“humidity”:95,“dew_point”:-2.63,“uvi”:0,“clouds”:100,“visibility”:142,“wind_speed”:4.86,“wind_deg”:60,“wind_gust”:10.65,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:1,“snow”:{“1h”:0.8}},{“dt”:1668585600,“temp”:-1.91,“feels_like”:-6.92,“pressure”:1017,“humidity”:96,“dew_point”:-2.6,“uvi”:0,“clouds”:100,“visibility”:123,“wind_speed”:4.4,“wind_deg”:58,“wind_gust”:9.94,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:1,“snow”:{“1h”:0.55}},{“dt”:1668589200,“temp”:-1.57,“feels_like”:-5.93,“pressure”:1016,“humidity”:97,“dew_point”:-2.15,“uvi”:0,“clouds”:100,“visibility”:111,“wind_speed”:3.63,“wind_deg”:53,“wind_gust”:8.43,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:1,“snow”:{“1h”:0.56}},{“dt”:1668592800,“temp”:-1.46,“feels_like”:-5.59,“pressure”:1016,“humidity”:97,“dew_point”:-2,“uvi”:0,“clouds”:100,“visibility”:127,“wind_speed”:3.38,“wind_deg”:42,“wind_gust”:7.23,“weather”:[{“id”:601,“main”:“Snow”,“description”:“snow”,“icon”:“13n”}],“pop”:1,“snow”:{“1h”:0.61}},{“dt”:1668596400,“temp”:-1.57,“feels_like”:-5.85,“pressure”:1015,“humidity”:97,“dew_point”:-2.14,“uvi”:0,“clouds”:100,“visibility”:195,“wind_speed”:3.53,“wind_deg”:37,“wind_gust”:6.89,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:1,“snow”:{“1h”:0.43}},{“dt”:1668600000,“temp”:-1.51,“feels_like”:-5.52,“pressure”:1015,“humidity”:97,“dew_point”:-2.07,“uvi”:0,“clouds”:100,“visibility”:193,“wind_speed”:3.23,“wind_deg”:37,“wind_gust”:6.18,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13n”}],“pop”:1,“snow”:{“1h”:0.3}},{“dt”:1668603600,“temp”:-1.36,“feels_like”:-4.76,“pressure”:1015,“humidity”:97,“dew_point”:-1.95,“uvi”:0,“clouds”:100,“visibility”:214,“wind_speed”:2.62,“wind_deg”:27,“wind_gust”:4.77,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.83,“snow”:{“1h”:0.37}},{“dt”:1668607200,“temp”:-0.99,“feels_like”:-3.93,“pressure”:1015,“humidity”:96,“dew_point”:-1.72,“uvi”:0.3,“clouds”:100,“visibility”:428,“wind_speed”:2.26,“wind_deg”:11,“wind_gust”:3.21,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.84,“snow”:{“1h”:0.3}},{“dt”:1668610800,“temp”:-0.54,“feels_like”:-2.89,“pressure”:1014,“humidity”:95,“dew_point”:-1.33,“uvi”:0.7,“clouds”:100,“visibility”:598,“wind_speed”:1.85,“wind_deg”:353,“wind_gust”:2.48,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.85,“snow”:{“1h”:0.22}},{“dt”:1668614400,“temp”:-0.09,“feels_like”:-2.31,“pressure”:1014,“humidity”:95,“dew_point”:-0.89,“uvi”:0.98,“clouds”:100,“visibility”:842,“wind_speed”:1.81,“wind_deg”:336,“wind_gust”:2.52,“weather”:[{“id”:600,“main”:“Snow”,“description”:“light snow”,“icon”:“13d”}],“pop”:0.78,“snow”:{“1h”:0.15}},{“dt”:1668618000,“temp”:0.33,“feels_like”:-2.25,“pressure”:1014,“humidity”:94,“dew_point”:-0.56,“uvi”:1.2,“clouds”:100,“visibility”:3724,“wind_speed”:2.15,“wind_deg”:327,“wind_gust”:3.18,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.74},{“dt”:1668621600,“temp”:0.69,“feels_like”:-2.36,“pressure”:1013,“humidity”:93,“dew_point”:-0.41,“uvi”:1.14,“clouds”:100,“visibility”:9095,“wind_speed”:2.66,“wind_deg”:321,“wind_gust”:4.04,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.7},{“dt”:1668625200,“temp”:0.69,“feels_like”:-2.66,“pressure”:1013,“humidity”:93,“dew_point”:-0.47,“uvi”:0.79,“clouds”:100,“visibility”:7975,“wind_speed”:2.99,“wind_deg”:319,“wind_gust”:4.66,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.09},{“dt”:1668628800,“temp”:0.44,“feels_like”:-3.27,“pressure”:1013,“humidity”:94,“dew_point”:-0.49,“uvi”:0.42,“clouds”:100,“visibility”:2411,“wind_speed”:3.36,“wind_deg”:313,“wind_gust”:5.46,“weather”:[{“id”:804,“main”:“Clouds”,“description”:“overcast clouds”,“icon”:“04d”}],“pop”:0.09}]}