[Updated] Weather Underground Driver - New API

Sue thing.

EDIT: @Cobra your mail system is offline according to your site:

Mine started polling every 10 minutes again today, for no reason that I can see. I've just now updated to the new driver. I'm going to keep and eye on it and see what happens. So forget my issue for right now unless it recurs.

@Cobra your mail system is still offline sir.

PS, I did log a ticket as requested, but I didnt get any notifications due to the above mentioned issue.

@Cobra So I finally found solutions to incorrect WU data being shown for my location.

def params2 = [uri: "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=${state.latt1},${state.long1}&units=${state.unit}&language=en-US&format=json&apiKey=${apiKey}"]

I modified your code and changed "language=en-GB" to "language=en-US" and now I'm getting the correct results (also matches my earlier posted JSON query). It's quite Bizzare that it makes a difference, but it's fully reproducible. While the "currentConditions" will be pretty much correct, the "forecastConditions" come back with different text that is frequently wrong for my location (in Australia) if you use "en-GB" as the language setting.

You might want to add this as an option to set this to the driver.

But the biggest cause of the incorrect "forecastConditions" was this line:

sendEvent(name: "forecastConditions", value: obs1.narrative[1], isStateChange: state.force )

0 = today's forecast and 1 = tomorrow's forecast

The difference is quite stark:

|0|"Mostly cloudy. Highs 19 to 21C and lows 8 to 10C."
|1|"Afternoon showers and thunderstorms. Highs 20 to 22C and lows 8 to 10C."

However, imo it should be using the second narrative section:

sendEvent(name: "forecastConditions", value: obs1.daypart[0].narrative[0], isStateChange: state.force )

then you get extra detail like:

Cloudy skies. High near 20C. Winds ESE at 15 to 25 km/h.

It's a shame that WU hasn't bothered to update their 5 Day Daily Forecast API Doco to cover all of the data you can access as you have to basically experiment to find out what is what.

While messing about with your Driver, I found you can also use the Hubitat location instead of pulling it from the station data, using:

location.getLatitude()
location.getLongitude()

I rather crudely modified your driver to put these into lattSaved, longSaved, state.latt1 and state.long1 for while I was trying to rule out location coordinates as an issue.

I also added cloudCover via these two lines:

attribute "cloudCover", "number"

sendEvent(name: "cloudCover", value: obs1.daypart[0].cloudCover[0], isStateChange: state.force )

@Cobra I made some more changes to the above driver after adding icons and noticing some were out of kilter. I also broke up forecast conditions to forecastToday and forecastTomorrow and modified the icon code to match.

It's worth noting that the icon codes relate specifically to the daypart.narrative section, not the short-form narrative - not a big deal until you realise that the daypart.narrative contains night forecasts and the other narrative doesn't . I see by your code that you were aware of this but it wasn't quite matching up.

I also renamed currentConditions to forecastShort as it isnt really current conditions, it's just a truncated forecast.

This is how I believe daypart.narrative should be read:

0 = Todays forecast
1 = Tonights forecast
2 = Tomorrows forecast
3 = Tomorrow nights forecast

and these changes result in (the Tiles are WU + Netatmo):

Btw, you can also store the icons locally on the hub (it's very tedious to upload 50 icons, one at a time tho) and then point the WU driver at "http://<Hub_IP>/local/". @Cobra Maybe as part of the next release you could store these locally to remove the need for folks to spin up a webserver or implement workarounds? (the icons are only 250KB in total)

Ok, I'm not sure if Andy is busy or not interested in fixing the issues I've identified - so I've brached out and created my own version of this driver:

For those interested, the enhanced version has gained a few nice features recently:

1 Like

Hi, I'm pretty new here,

I've been slowly building my my smart home for a while now and would like some wether data for showing in dashboard and using in some automations. I was wondering if it's possible tu use WU at all when you dont have a weather station yourself. if so, how do you get a API key !?

Rik

Unfortunately, without sending data from your own weather station to WU, they won't give you a free api key

Andy

Hi Andy - For those us that do have a PWS and an API key for WU, do you still have a version of your driver available for WU API's? Your OWM driver is great but I would prefer to have my data displayed versus city level data.

Mike

All my apps & drivers are on my website

Andy

Ok. Thanks. I have sent a registration request on your website.

Approved :slight_smile:

1 Like

I get a "page not found" error.

Not too helpful

If you are talking about the github link then that is because nothing is there anymore
All my code is now on http://cobra-apps.co.uk

Do you get this when visiting the site?
trying to create an account?
trying to login?

@Cobra, I am using the Custom WU Driver and I have everything set up and polling properly. I want to use some of the parameters in RM. I have set up a predicate condition in RM5 to pull a custom attribute on the chance of rain to turn on/off a switch that controls my lawn sprinkler. Unfortunately, I can't get any comparison other than = in the dropdown. I need something like a <50% chance of rain. Do you know why these other comparison parameters are not showing up?

I’m sorry but I have never used RM so can’t really advise on it’s features

Andy

Is the attribute data type string?

I didn’t look at this driver for a year so possibly.
Easy to change to number in the driver if it is.

Yes, that was easier to fix than I thought.