Weather Underground API

So after spending the afternoon writing a piston that records snow fall totals throughout the night, I stumbled onto a reddit post mentioning that the Weather Underground API is going to be discontinued Dec 31, 2018. I’d assume this would break all of the weather functionality built into WebCoRE? Any idea if there is an alternative?

nuts. link?

The Weather Channel those … unspeakable unprintable things

I should have guessed.

2 Likes

Gah! That sucks! I have all sorts of neat WU API based notifications through ST and WC. :frowning:

I was using the Sonos Weather forecast announcement smart app before WU API was retired:

today I decided to fix it adapting to the new Wetaher Company API.

But whatever I do , the app throws an exception with “unauthorized” reason.

On the app there’s this code which makes the httpget:

private loadText() {

	def deviceListParams = [
	uri: "http://api.wunderground.com",
    path: "/api/30c246ea43c71204/forecast/lang:TR/q/TR/İstanbul.json",
    headers: ["Content-Type": "text/json", dataType : "jsonp"]
    ]
		def forecast = [:]
    	httpGet(deviceListParams) { resp ->
        log.debug "response:"
        log.debug resp
    
		if(resp.status == 200)
		{  
		   forecast = resp.data
		}
		else
		{
			log.debug "http status: ${resp.status}"
		}
	}
	log.debug "forecast: ${forecast}"

Here , the post was made requesting json format
Of course because of the changed APı now the key does not exist and I get “unauthorized”.

But even after changing to the new API format with following parameters:

uri: "https://api.weather.com",
path: "/v3/wx/forecast/daily/5day?icaoCode=KDEN&units=e&language=en-US&format=json&apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXX",

I still get following exception:

roovyx.net.http.HttpResponseException: Unauthorized @line 428 (loadText)

I am sure that the new API KEY is working because when I use this URL on my browser I can get a valid response.

So what is wrong with the code ?

And I am not a WU fan, if there is a better way of getting weather forecast, I’d be glad to use it.
Waiting for any recommendations…

thanks.

You are reading/replying to years old topics which are out of date.

Have a look here, the new WU API access is part of ST.

thanks. that is good information.
But does that mean I will not be using direct WU api address and WU API key, instead I will just call the available functions on ST Cloud ?

in that case, how shall I get response in different languages ?

And , shall I be able to post data to WU for my PWS ?

thanks.

You are talking about two different things here.

The TWC API works with the Groovy environment. You can use the Smart Weather Station Tile from SmartThings and add it to your devices manually to get the weather data recorded into your Things.
Then you can query that data from the ST API and use it in your SmartApps. That will work with any language what has SDK released for.
To get the data straight from the new WU API, you will need a API key. And that is completely different discussion. You might get better answers how to use it, if you search stackoverflow or reddit or some community forum regarding WU.
To post a data to WU is a third different topic. You will find better answers if you would search outside of this forum. But first what PWS data do you want to post to WU? Is it a standalone PWS or one, like the Qubino PWS connected directly to SmartThings. If the first, standalone, then search for WeeWX, it is a small easy to use and configure weather station data collector software written in python. If the second, like ST connected PWD, then you need to query the ST API with a SmartApp and post the data to WU.

thanks for the answer.

3 topics as you say:

  1. get forecast data using TWC API integrated to ST cloud:
    I don’t want to use it in a tile. I just want to get forecast of a location. What is the groovy command for that ? where can I find detailed reference information ?
    is it possible to get forecast in any language ? (for example Turkish)
    with direct WU API query language selection was possible with a simple URL addition like “lang:TR”

  2. Direct TWC API usage:
    I already created an API key on WU site. And with this key I am able to get data on my browser as I wrote in my initial post. However, the httpget from ST app returns “unauthorized”
    That is not something related to WU community. It is about usage of httpget on ST app.
    if anyone knows why I get “unauthorized” with the example code I wrote above, that would help a lot.

  3. posting data to WU:
    I want to post data form my outdoor temp/humidity sensor as in this project:
    Temp/Humidity sensor updates Weather Underground personal weather station
    however, with the change on WU API , the URL on this project code is useless. So I want to find the correct posting URL format.
    But I could not find it in WU community.
    Maybe someone here has already done this and could share this information.

thx.

  1. You can get the the weather data to your defined Hub location, in English only as far as I know. Even from a PWS, but then it hasn’t got forecast. The tile is to display, but the data stored in the ST cloud and you can use it with an ST API request for a SmartApp use or so.

  2. TWC API documentation is here:
    https://docs.google.com/document/d/1eKCnKXI9xnoMGRRzOL1xPCBihNV2rOet08qpE_gArAY/edit

  3. PWS upload protocol:
    https://support.weather.com/s/article/PWS-Upload-Protocol?language=en_US
    (It uses a HTTP GET)

But as I saw on the WU community forum, they use now everywhere https what might be a problem with the Groovy code. Or your API key is not authorized yet.

1 Like

thanks.

I’ve solved the issue about point 3 with the reference you’ve supplied.

so the “post data” part is “ok”
now I need to get forecast text.

I don’t know if getting directly from TWC API is better or not.
But using ST cloud is more efficient. (if it works)

Where can I find the command for getting forecast text for a specified location ?

thanks.

Look at here:

https://docs.smartthings.com/en/latest/search.html?q=Weather&check_keywords=yes&area=default

1 Like

thanks. that explains it all.
but I see that it does not have language support. Only English.

So I decided to use direct TWC API.

got some responses. I am trying to find out correct query.
the documentation on drive is too bad.

no fine reference.

ok. done. everything working.

thanks :slight_smile: