Weather binding in Openhab2

Try Text (not Number, since sitemaps do not have Number as an element type) in your sitemap for the Temperature_OWM item:

Text item=Temperature_OWM label="Temperature-OWM  [%.2f °C]" icon="temperature"	valuecolor=[>25="red",>15="orange",>5="green",<=5="blue"]

Ps: I added some nice coloring to your temperature display :slight_smile: You can change the colors and values to your liking
Ps2: label is optional in your sitemap entry since if you don’t specify it, it will be retrieved from your items entry. You could have a simple: Text item=Temperature_OWM entry in your sitemap.

1 Like

@Dim
Thanks so much for pointing out this error, you convince yourself you are following an example you find and modify it for your own use, but it was only when scrolling back through the thread that I saw an example sitemap from Chris Baxter using Text that I realised I’d been fooling myself.

I’d installed the Designer too and the error messages weren’t making any sense, but its a DOH! moment. The only thing I find strange is the you define the item as a NUMBER but have to display as String. In the end I used DEFAULT in the sitemap which according to the docs works out the right display method.

@Udo_Hartmann
Hi Udo, I followed the first two lines and the output was the same as my weather.cfg, I guess when it reports/parses this it ignore any of the comments ‘# comment’ so it is effectively the same file

Kudos both.

1 Like

Yes, comments are ignored. :slight_smile: Keep in mind, that a parameter cannot be unset via services/*.cfg, as empty or commented parameters are ignored, you have to delete the parameter through Karaf or REST API…

Hello again folks, getting a mysterious ‘crash’ where the weather data is no longer downloaded and updated. I can’t see anything in the logs…

In .items file
// Number Rain “Rain [%.2f mm/h]” {weather=“locationId=locationId1, type=precipitation, property=rain”}

in the log:
The snapshot from OPENWEATHER in the logs is:
2017-05-17 15:19:30.295 [DEBUG] [nal.provider.AbstractWeatherProvider] - OPENWEATHERMAP[locationId1]: Weather[Temperature[current=12.42,min=10.0,max=15.0,feel=14.308592922709098,dewpoint=],Atmosphere[humidity=93,visibility=,pressure=1015.0,pressureTrend=up,ozone=,uvIndex=],Clouds[percent=90],Condition[text=mist,lastUpdate=Wed May 17 15:19:30 BST 2017,observationTime=Wed May 17 15:03:00 BST 2017,id=701,icon=50d,commonId=fog],Precipitation[rain=0.0,snow=0.0,probability=,total=],Wind[speed=2.1,direction=NW,degree=310,gust=,chill=],Station[name=Somewhere,id=,latitude=51.8762,longitude=-1.7231,altitude=],]

and
2017-05-17 15:19:30.291 [TRACE] [nternal.parser.AbstractWeatherParser] - Setting property ‘precipitation.rain (list.rain)’ with value ‘5.27’

So everything looks set up right but if I uncomment the line in the .items file for rain the last line of the log is
Deleting weatherJob-locationId1
and it never tries to get another update

oh and I should say the data in the variable is ‘null’ not the 5.27 it gets from above

With the rain line removed all the other weather data is received/displayed fine.

Ideas?

First of all, I use /* & */ for commenting out lines in my *.items files (not //). I am not sure if both styles will work…

Secondly, my rain precipitation item is:

/* This is a comment */
Number	WU_Rain		"Rain [%.2f mm/h]"	<water>	(Weather)	{weather="locationId=HomeR, type=precipitation, property=rain"}

So: the same as yours… I don’t see any error…

That’s strange… I see in the DEBUG entry above that Precipitation[rain=0.0...
I don’t understand where this Setting property 'precipitation.rain (list.rain)' with value '5.27' is coming from… (shouldn’t it be 0.0?)

Sorry the weather keeps changing so much here :slight_smile:

Seriously though, you are right something funny there. Obviously there are multiple setting of property ‘precipitation.rain’ for the current and forecast data that comes from the OpenWeather update but non of the property setting is matching the data sent by OpenWeather

The last 8 traces are:
Setting property ‘precipitation.rain (list.rain)’ with value '1.93’
Setting property ‘precipitation.rain (list.rain)’ with value '2.61’
Setting property ‘precipitation.rain (list.rain)’ with value '2.31’
Setting property ‘precipitation.rain (list.rain)’ with value '5.27’
Setting property ‘precipitation.rain (list.rain)’ with value '1.93’
Setting property ‘precipitation.rain (list.rain)’ with value '2.61’
Setting property ‘precipitation.rain (list.rain)’ with value '2.31’
Setting property ‘precipitation.rain (list.rain)’ with value ‘5.27’

The data from the associated update is:
Current = 0.0
Forecast0 = 6.43
Forecast1 = 0.0
Forecast2 = 0.87
Forecast3 = 0.77
Forecast4 = 1.76

Is it possible to get the precipitation data from my personal weather station connected to WeatherUnderground?

Now when I try receive perception data, I get 0.0 in OH2 when on WU page for same coordinates I see 0,25mm (today)…
My PWS link https://www.wunderground.com/personal-weather-station/dashboard?ID=IUDMURTI3

and my weather.cfg:
weather:apikey.Wunderground=xxx
weather:location.home.name=Ижевск
weather:location.home.latitude=56.924464
weather:location.home.longitude=53.224666
weather:location.home.provider=Wunderground
weather:location.home.language=ru
weather:location.home.updateInterval=10

and debug items:
Number WRainfall “Вероятность осадков [%d %%]” {weather=“locationId=home, forecast=0, type=precipitation, property=probability”}
Number WPrecipitation “Осадки [%.0f мм]” {weather=“locationId=home, forecast=0, type=precipitation, property=total”}
Number WPrecipitation1 “Осадки [%.0f мм]” {weather=“locationId=home, type=precipitation, property=total”}
Number WPrecip_Total “Precip total [%d mm]” {weather=“locationId=home, type=precipitation, property=total”}
Number WRain “Rain [%.2f mm/h]” {weather=“locationId=home, type=precipitation, property=rain”}

and console:
openhab> smarthome:status WTemperature
9.30
openhab> smarthome:status WPrecipitation
UNDEF
openhab> smarthome:status WRainfall
40.00
openhab> smarthome:status WPrecipitation1
0.00
openhab> smarthome:status WPrecipitation
UNDEF
openhab> smarthome:status WPrecip_Total
0.00
openhab> smarthome:status WRain
0.00

Temperature is ok (real and OH2)

hi Alexander,

I guess it might differ depending on the weather station, but with my own weatherstation (this one) I get the the precipitation from wunderground with

Number  Precip_Total         "Precip total [%d mm]"   {weather="locationId=home, type=precipitation, property=total"}

It has been some time since I looked at the weather binding but I realize that I’m no longer displaying values. I turned on tracing on org.openhab.weather and I don’t find any warn or error messages. I cleared the services entries using Karaf and restarted openhab2. I see the binding installed and the items added but no data.

I’m on “2.3.0 Snapshot – build #1176”, and the weather binding installed is “binding-weather1 - 1.12.0.SNAPSHOT”

Any ideas?

Perhaps you mistyped the package name only here, but
I believe the correct package name for debugging is org.openhab.binding.weather.

My bad. it was only in my reply.

I’d suggest starting a new thread with details on your configuration.

Also, if you didn’t use at least DEBUG level in your logging, try that.