Yahoo Weather update

Hello,

just a heads up; the Yahoo RSS weather feed(s) have changed. The API now reports that it requires oAuth. After some initial digging around the excruciatingly slow Yahoo developer pages, I found that you can simply change the URL of the rest to get the functionality back:

OLD: http://weather.yahooapis.com/forecastrss?w=729139&u=c

NEW: http://xml.weather.yahoo.com/forecastrss?w=729139&u=c

Maybe this can prevent some frustration :slight_smile:

Cheers,

PelliX

1 Like

How would users use this new URL? Thanks!

Hi there,

it is (or was, when I started using OpenHAB) included in the demo sitemap, items, rules and transforms. I’ve never needed another weather data provider, so I’ve been using this Yahoo example (but extended to include stuff like the wind direction, visibility distance, etc) for years.

For example:

Item:

Number Weather_Pressure “Pressure [%.1f mb]” (STATUS) {http="<[http://xml.weather.yahoo.com/forecastrss?w=729139&u=c:600000:XSLT(yahoo_weather_pressure.xsl)]"}

Transform:

<?xml version="1.0"?>

< xsl:stylesheet xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” xmlns:yweather=“http://xml.weather.yahoo.com/ns/rss/1.0” version=“1.0”>
< xsl:output indent=“yes” method=“xml” encoding=“UTF-8” omit-xml-declaration=“yes” />
< xsl:template match="/">
< xsl:value-of select="//yweather:atmosphere/@pressure" />
</ xsl:template>
</ xsl:stylesheet>

Sitemap:

Text item=Weather_Pressure icon="chart"

Cheers,

PelliX

So the tl;dr answer to @watou’s question is if you are using XSLT transform you use this. If you are using the Weather Binding you need to wait for a fix.

1 Like

I don’t see an open issue for the weather binding—what specifically is not working with the Yahoo provider for the weather binding?

If I understood the docs online correctly, late last night, Yahoo requires oAuth usage as of March 15th, 2016. This would require a change in the binding with more params, etc.

Cheers,

PelliX

I see that note, but also I see that if you try the old URL it seems to work for me? (see here)

But what is/are the current observed problem(s) with the weather binding when configured to use the Yahoo provider?

Well, seemingly the weather binding (I’ve never really used it) is using the ‘proper’ Yahoo API for weather data. The method that the demo and I use is simply based on the HTTP binding and parses an RSS feed (see the new URL in my initial post).

So, the weather binding may need oAuth support in the future, and the HTTP binding method can still be used, just with an updated URL.

I hope this helps to clarify.

Cheers,

PelliX

1 Like

URL change worked for me thanks!

It would appear that Yahoo has changed the service yet again because the suggested “NEW” URL, to xml.weather.yahoo.com/forecastrss, no longer works (tested today 2016-04-21).

Ack, Confirm. It was flaky at best over the last week roughly, but it now it really appears dead and gone. I’ll have a little hunt around and see whether I can find another URL. Obviously, I’ll post it here if I do!

Cheers,

PelliX

At least until Yahoo changes things yet again, the solution presented here may work for you. It uses Yahoo Query Language. The URL must be urlencoded and all % characters must be escaped.

For 73037 Goeppingen, Germany, I currently use:

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places%20where%20text%3D"73037%20goeppingen%2C%20germany")%20and%20u%3D'c'&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

Replace zip, city, country as you see fit.

This is anonymously (without API key) and metric/Celsius.

The hourly? daily? call limit probably is a sufficient maximum of 2 000 requests per IP.

edit 1:
Apologies for the euphoric post — this feed seems not to be reliably available or I do not understand their call limits (requesting both from dynamic and static IP).
@Knallfrosch: I use XSLT transformations to extract various values.

edit 2:
When re-requesting the Yahoo RSS/XML file (with a hardcoded woeid just to avoid ambiguities), the file intermittently is nearly empty (~750 bytes) or with the expected payload (~ 4600 bytes). For both scenarios, the http response code is 200 (OK). So as a dirty workaround, on a web server, I run a cron.05minly wget, save the file named weather.rss.bak and then check file size; if it is larger than 2 048 bytes, copy it onto a real weather.rss that is then consumed by OpenHAB and others:

wget "your_yahoo_url" -O /path/to/weather.rss.bak -o /path/to/weather.log
if [[ $(find /path/to/weather.rss.bak -type f -size +2048c 2>/dev/null) ]]; then
    cp /path/to/weather.rss.bak /path/to/weather.rss
fi

There is the danger to confuse outdated values with current ones. That could lead to a “data obsolete” similar to the “battery low” notification mechanism.

1 Like

@ hildner: are you using the weather binding?

Hi,

I just saw that I forgot to update this thread. I ended up slightly modifying the URL, but still using Apache to simply proxy the URL for OpenHAB.

To answer your question, Knallfrosch, see Rikoshak’s post:

So the tl;dr answer to @watou’s question is if you are using XSLT transform you use this. If you are using the Weather Binding you need to wait for a fix.

Cheers,

PelliX

1 Like