Persisting forecast data to use in rules

Hi everybody

I would like to use forcast data in rules. I understand that jodatime has the ability to use e.g. weather_forecast.plusHours(2). But how can I persist the (future) forecast data e.g. from Yahoo Weather correctly?

Greetings

Olaf

I don’t think this does what you think it does. Joda Time only represents a date/time value. So assuming weather_forecast is a Joda DateTime that is set to say, 08:00 today, weather_forecast.plusHours(2) will be 10:00 today.

There is no weather data in a Joda DateTime.

To get the weather forecast from Yahoo! Weather through the Weather Binding and creating an Item which will store the forecasted valued you are interested in. For example, the forecast high temp for tomorrow would be:

Number   Temp_Max         "Temperature max [%.2f °C]"   {weather="locationId=home, forecast=1, type=temperature, property=max"}

where forecast=0 is today, forecast=1 is tomorrow, etc.

There is on way to get the forecast for the next couple hours through the Weather Binding. If you can get it from their website you might be able to write an XSLT to pull that data out of the XML it returns.

But, ignoring all that and to address your actual question: how to persist values. Its simple. Create an Item to store the value and make sure that Item is configured to be saved in your .persist file.