WeatherCompany binding (WeatherUnderground replacement for PWS data uploaders only!)

Important: As of snapshot build 1772, the WeatherCompany binding is included in the openHAB distribution.

As part of the review process, there were several important changes of which you need to be aware:

  • A bridge thing is now required. The bridge thing represents your WetherCompany account. This is where you enter the API key.
  • There are now two different thing types, one for the weather forecast, and another for the PWS observations. Your item definitions will need to be updated to account for these two thing types.
  • Since, the PWS weather observations are handled by a separate thing, there’s no longer a channel group for those items. Your item definitions will need to be modified to account for this.
  • The latitude and longitude channels on the PWS weather observations thing have been combined into a single channel of type Location. Your item definitions will need to be modified to account for this.

Your things will need to be deleted and readded to account for the above changes.


I recently developed a binding to use the Weather Company API to retrieve Personal Weather Station (PWS) data and the 5-day weather forecast.

Important: This binding will work only for people who upload their PWS data to WeatherUnderground. If you don’t have a PWS and you don’t upload your PWS data to Weather Underground, you can stop reading. Sorry.

With that out of the way…

The Weather Underground API was turned off in March. However, PWS data uploaders are being given access to the weather forecast API from The Weather Company (TWC). TWC API provides access to PWS data, as well as a 5-day weather forecast.

Here’s the API spec.

In order to use this binding, you need a new API key from WeatherUnderground, and you can get one of these only if you are uploading your PWS data to Weather Underground. Old Weather Underground API keys will not work. I’m sorry to stress this, but I hope to prevent any misunderstandings that this binding is a replacement for everyone who’s using the Weather Underground binding.

If you currently upload your PWS data to WeatherUnderground, you can create the API key from your Weather Underground user profile. Or, you can use this direct link to get the API key.
https://www.wunderground.com/member/api-keys

The binding currently supports:

  • 5 day forecast (one daily forecast for Today, Tomorrow, Day 2, Day 3, Day 4, Day 5)
  • 5 day “daypart” (Day and Night) forecast for each of the above days
  • PWS current observations (must set station ID in the thing config)
  • TWC’s full list of language translations, which is quite extensive
  • UoM for conversion of units
  • configurable refresh time of forecast (fastest refresh is 2 minutes, default is 30 minutes)
  • location types of postal code (only for US, UK, DE, FR, IT), geocode (latitude and longitude), and IATA airport code
  • auto discovery of local weather thing if location and locale are set in openHAB

NOTE 1: The daypart channels for the Day 0 Day forecast, as well as the temperatureMax channel the Day 0 forecast, will be null after 3:00pm Local Apparent Time. This is a “feature” of the new API.

NOTE 2: The temperatures returned in the PWS Observations are integers. There’s much consternation in the WeatherUnderground community w.r.t. The Weather Company’s inability to return a higher level of precision. This is especially problematic when temps are in Celsius. At some point, when decimal numbers are available from the TWC API, I’ll update the binding to support the higher level of precision

https://github.com/mhilbush/openhab2-addons/tree/weather-company-binding/bundles/org.openhab.binding.weathercompany

The jar file is located here.

Important: Note that if you are on an older version of openHAB (such as 2.4 stable, or an early 2.5 snapshot, you may need to drop this jar into your addons directory in order to avoid an unresolved dependency.

http://central.maven.org/maven2/com/google/code/gson/gson/2.8.2/gson-2.8.2.jar

8 Likes

Thank you for the binding.

How can i generate a new api-key? I cannot find a link or a button fpr that on the weather-underground website. I loked at the page of my PWS, but i find nothing.

BR Rene

Did you get an email from Victoria at Weather Underground? She sent out an email on Feb 26 to PWS uploaders that contained the link for getting an API key. Let me know if you didn’t get it, and I’ll PM you the link.

No, i dont received an PM. Please send me the link by PM.

Thanks.

BR Rene

Hello @mhilbush
Thank you very much for your work! It would be great, if you could add Current Conditions to your binding.
There are Weatherstations out there, which do not provide data locally (e.g. PWS from Froggit, which are based on Ambient Weather WS-2902s and do not provide locally access to data and upload only to WU): Your effort would keep these PWS alive, as it seems, that the existing Weatherunderground Binding does not support the new WU API (at least not, when I tried it - you might know more.)
What are your thoughts?

Who help.
How i can add this binding to my Openhab2 binding list?

Can u help?

Drop the jar file into the addons directory. If you have your location (lat/long) and locale information set in openHAB, it should automatically add a Local Weather thing to the inbox. If not, you will need to add it manually. You’ll then need to enter the new API key in the thing config, as the old WeatherUnderground key will not work.

1 Like

Can these weather stations also upload to ambientweather.net? If so, they can pull the current conditions using my ambientweather binding.

This is correct. The new API is from The Weather Company, and is different from (and incompatible with) the API used by the WeatherUnderground binding.

no, unfortunately not.
I had investigated this path, as potential mitigation plan. These PWS can send data besides of WU to Weatherbug and weathercloud. - pretty limited…

I added binding and is online but not show weather hmmm…
API is ok

Did you create items as described in the README? If you copied the items from from the README, you may need to change the channel definition.

From README

String                      WC_Day0_DayOfWeek
                            "Day of Week [%s]"
                            <time>
                            { channel="weathercompany:weather:home:forecastDay0#dayOfWeek" }

They might need to become this if you used the thing from the inbox. Note the local versus home.

String                      WC_Day0_DayOfWeek
                            "Day of Week [%s]"
                            <time>
                            { channel="weathercompany:weather:local:forecastDay0#dayOfWeek" }

I probably should change the README to use local instead of home.

Bummer. Was hoping I wouldn’t need to do this. :frowning:

I’ll look into adding PWS Observations. Would you mind looking over the PWS Observations API to make sure it is satisfactory?

I have
Number Weather_Temperature “Temperature [%.2f °C]” {channel=“weathercompany:weather:local:forecastDay0Day#temperature”}

and not working hmmm

yes sure - i ll report back here

If it’s after 3 pm local time, the Day0 Day forecast is undefined. Can you check the other daypart forecasts (Day 0 Night, Day 1 Day, etc.)?

Also note that the Day 0 TemperatureMax forecast is undefined after 3 pm local time.

This is the way the API works.

and where is current weather… i can`t see items

You mean the current observation data uploaded from your PWS? The forecast API doesn’t support that (it’s a different API) and, as mentioned in my initial post, I haven’t implemented that (yet).

Which items working 5 PM time :slight_smile: what i can add to my HAB Panel