[UPDATED] - Weather Switch - Turn on a switch in response to weather

Strangeā€¦everything seems to be working great here and Iā€™m using 2.0.0 of the driver code. @Matthew and @DeveloperDavidB, maybe the station you are connecting to is having problems? If you want, try connecting to my station and see if the info is there. My personal station is KMADRACU9. Just put PWS:KMADRACU9 in the Zip Code box.

I changed the station to yourā€™s and I am still not getting Weather_Summary? Are you sure your summary is updating? @DeveloperDavidBā€™s was listed, but not updaing. I am using version 2.0.0 too and I have it set to pull Fahrenheit, Miles & MPH for the summary.

Im thinking it may have pulled that data before I switched to the new site a couple days ago. I would think using a new station would clear the old, but if there is no new data for a variable, maybe it just keeps its old value.

Here is what I'm seeing...

Just noticed that it auto updated...

I may have other problems. I cannot connect to my hub right now (Connection refused) and I am not at the house so I cannot power cycle it. It will have to wait until i get home this evening. I will re-copy in the most recent version of the driver code to make sure I didnā€™t mess that up somehow, then see if it reports Weather_Summary. Iā€™ll report back.

1 Like

Guys
Iā€™m getting the summary ok
My station: PWS:IDURHAM16 if anyone wants to try it.

(Although Iā€™m using a slightly different driver as Iā€™m making a few additions to work with an irrigation app I'm thinking about)

Andy

Power-cycled my hub. Re-copied the latest code version (2.0.0) and I am still not getting Weather_Summary? My station is pws:kcosuper7. I also tried PWS:IDURHAM16 and it did not show Weather_Summary for me??? My driver config is below.

You should not have been able to save it without putting something in the ā€˜poll interval limitā€™
If you put something in there e.g 5 does it work then?

Andy

I entered 5 into the pool interval limit, saved, forced polled. No change. I let it Auto update too. No change. Still no Weather_Summary??

@Matthew

Silly questionā€¦ have you checked the logs?
Have you hit the poll limit for today?
Is everything else updating?

Andy

Itā€™s 3 am here so Iā€™ll have to get some sleep but Iā€™ll probably release 2.1.0 tomorrow (few extras added) so if you are still having problems look for an update.
If you are still having problems after the update then please let me know

Andy

1 Like

I did look at the logs. I do not see any errors or other indications that there is a problem. I checked Wunderground API Analytics and I have plenty of polls remaining. Everything else does appear to be updating. I am stumped???

I will load your next update and see if that makes a difference. If not, I will remove it completely and then re-add it. I am not currently using Weather_Summary ā€¦ but I was thinking about it. Everything else in the driver is working well.

Thanks.

1 Like

I have a question ā€¦instead of making two separate calls to WU, one for Conditions and Forecast and one for Alerts, is there a reason you cannot just make one call for all three? I changed line #131 to:

uri: "http://api.wunderground.com/api/${apiKey}/alerts/conditions/forecast/q/${pollLocation}.json"

(added ā€™ /alertsā€™ right after the ${apiKey}

I also commented out the params2 sections and changed the Alert call to Resp1 and it seems to work. This cuts the number of API calls made in half, so you can shorten your intervals without going over the 500 calls per day limit of the free plan.

Any reason this would not work ā€¦ or something I am missing? Thanks.

My version is here (just for testing. Will need cleaned up if this is a valid approach.)

If that works we could also add to the call for WUā€™s ā€˜/astronomyā€™ which has the data elements of sunrise.hour, sunrise.minute, sunset.hour and sunset.minute. With that we could build Sunrise and Sunset times for the station. I saw someone requested that and I also saw some code from ST to build this fairly easily.

think the free version of api does not return /astronomy data.

here is a way to get sunrise and sunset data:

@Matthew
Good call!
I have implimented this and cleaned up the code a bit
Iā€™ve also added a resetable ā€˜Poll counterā€™ to keep an eye on things while testing
Added 3 attributes - Rain tomorrow & the day after and Station_State (& lowercase ā€˜stateā€™)

@Matthew @bangali
Guys, Iā€™m having trouble finding the time to maintain two versions of this driver now as I am working on other stuff.
Iā€™m happy for you to take the lowercase driver from me if you wish (as this seems to be the one you are using) as Iā€™m concentrating on some apps and the uppercase driver is developed enough for my use with Weather Switch and my expected use for my irrigation app Iā€™m looking at.

GutHub has been updated with the latest version: 2.1.1

One thing to note:
If you still want this to work with Weather Switch then please let me know if you change the version number state variable
This needs to match what is in WS as it check for driver version

Andy

1 Like

Thank you! Itā€™s a beautiful thing. (Iā€™ve just played with the driver so far.) Iā€™ve been trying to get a rain forecast into ST for a couple of years and this finally does it. I still have my irrigation device on ST, so Iā€™m in the position of using your code to throw a shared switch in Hubitat that will be used by ST for irrigation go/nogo. Until I can be more elegant.

1 Like

@CAL.hub
I've started a new developement thread for the irrigation app so we can discuss requirements and how we are going to do things

Andy

The WU site says astronomy is provided. I will see if I can add this.

1 Like

I added localSunrise and localSunset to this driver. I use this for some dashboards like SmartTiles. Now the weather tile in SmartTiles shows the Sunrise/Sunset time. It use to be 'null' for both. Still one call to WU API so no additional hits.

Thanks @Cobra for this great work.

2 Likes