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

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

@Matthew
Great find!
Iā€™ve added it to my uppercase driver (and of course credited you :slight_smile: )

Thanks for this!

Andy

thank you for adding state. since hubitat only supports displaying one attribute on a tile need the location in City, State format.

the only other thing i can see pending is calculating illuminance based on time, sunrise, sunset and condition.

may be one of us can add these and freeze the code at that point ... anything else can wait for native weather support from hubitat?

if you guys dont have time ... happy to do a PR for these?

thanks again.

I added Moon Phase & Moon Illumination Percent - Just for fun

V2.3.0

Andy

Iā€™ve been playing with making the lowercase attributes switchable so I can merge them back into one.
Seems I canā€™t keep away from this :blush:

Andy

1 Like

@Matthew @bangali

Iā€™ve been having a play with this driver :slight_smile:

Version: 2.4.0 - Uploaded to GitHub

  1. Capabilities & Lowercase attributes are now switchable
    (requires a poll to view them first time but they do send the data)
  2. Weather Summary now has two forms - Basic & Full
  3. Weather icon is switchable between Current & Forecast
  4. Renamed it to: ā€™ Custom WU Driverā€™

Please let me know what you think.

Andy

Updated the app

This now has switching for:
sunset/sunrise
wind direction
forecast conditions

Andy

Just loaded the updated driver. Looks great. Thank you.

For another application (not irrigation), I'm using your driver with a webCoRE piston. It doesn't seem to get current data. I've added a Poll and ForcePoll before I grab the temperature, but that doesn't guarantee the latest. For instance, this morning, it gave me last night's temp.

What is the best method to make sure any app gets current info? Would a Refresh command do what I want?

BTW, what's the difference between Poll and ForcePoll?

@CAL.hub
First off you will need to enable the capabilities and lowercase data if using anything but Weather Switch.

Poll and forcepoll are the same except that a normal poll wonā€™t run all the time.. only if the ā€˜poll interval limitā€™ has been exceeded.
Forcepoll will poll everytime itā€™s called (ignoring the limit restriction)

Donā€™t forget the free wu account has a max poll of 500 per day
(If you check the log it will normally show an error message if limit has been exceeded)

ā€˜Refreshā€™ is not a command that will work (the command doesnā€™t exist in this driver)
For future reference, all ā€˜commandsā€™ will appear on the driverā€™s page
E.g. this driver has 3 commands: poll, forcepoll and resetpollcount

How often are you trying to poll/forcepoll and how often does the station update WU?

If the station is updating often enough then a poll/forcepoll should get the latest data.

@Matthew is the driver updating for you?
It seems to be working perfectly for me, updating every 10 mins as configured (Iā€™m not using capabilities though)

Andy