Weather Binding - how to get rain amount for last day(hours)

Hi there.
I’m using Yahoo Weather binding, but in principle it doesn’t matter - for my irrigation I need to know if there was any rain for last day or couple of hours - I would like to know real value instead of forecast. But looking at https://github.com/openhab/openhab/wiki/Weather-Binding I’m no sure which binding and topic provides such value. Maybe it should not be even Yahoo, but perhaps Wunderground. Any help?

Wunderground is the only provider that the Weather binding is able to provide the Precipitation Today (note: this is the amount of precipitation that has fallen since midnight, it resets to zero at midnight).

However, that parameter is currently not working so I use the HTTP binding to get at it. I’m on 1.8.x, things might be different on 2.

#openhab.cfg

http:weather.url=http://api.wunderground.com/api//conditions/q/:weather.xml
http:weather.updateInterval=1800000

For example the URL (minus my API key) for Monument, CO would be:
http:weather.url=http://api.wunderground.com/api//conditions/q/CO/monument.xml:weather.xml

Make sure you set the updateInterval such that you don’t get your api key banned for too many requests.

Item

Number      Weather_Precip_Today "Precip Today [%.2f in.]" <rain> (gChart) { http="<[weather:300000:XSLT(wunderground_conditions_precip_today_in.xsl)]"}

wunderground_conditions_precip_today_in.xsl

Note: goes in the transform folder

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output indent="yes" method="xml" encoding="UTF-8" omit-xml-declaration="yes" />
        <xsl:template match="/">
                <xsl:value-of select="//current_observation/precip_today_in"/>
        </xsl:template>
</xsl:stylesheet>

You can bring up the XML in a browser and look around to see if there is a more appropriate value for your needs.

One thing to note, with my nearby stations there is quite a large delay between when the rain starts and this value is updated.

1 Like