Fahrenheit and Inches from 1.8 weather binding

How do I change the following from example.html to get fahrenheit and inches?

<td id="weather-temp">${weather:temperature.current(%.1f)}</td>
<td>${weather:atmosphere.pressure(%.1f)} mb</td>

First you need to make sure that the Items are storing their values as Fahrenheit and inches using the “unit” attribute in the binding.

Number          Weather_Temperature     "Outside Temperature [%.0f] °F" <temperature>   (gWeather_Chart)        { weather="locationId=home, type=temperature, property=current, unit=fahrenheit" }
Number          Weather_Pressure        "Barometric Pressure [%.2f in]" <temperature>   (gWeather)              { weather="locationId=home, type=athmosphere, property=pressure, unit=inches" }

Depending on how you use it in your webview, also make sure to include or not include the units inside the “[]” part of the label. You will notice I do not include the “°F” for temp but I do include “in” for pressure.

Then I add them to my webview as follows:

                    <td rowspan="2"><img id="weather-icon" src="weather-data/images/${param:iconset}/${weather:condition.commonId}.png"/></td>
                    <td id="weather-temp">${item:Weather_Temperature.state}</td>
                    <td id="weather-temp-sign">°F</td>


My full weather setup posted in this thread.

You using the latest 1.8? I get the following output when I try to specify an item directly:

	${item:Weather_Temperature.state}	°F
Humidity:	32 %
Pressure:	${item:Weather_Pressure} in

I was able to specify items in the old 1.8, but not with the latest 1.8 binding.

I’m still running 1.7.1

Ya, they changed everything around to make it more compatible with 2.0. Now rather then:

<td id="weather-temp">${item:Weather_Temperature.state}</td>

They have:

<td id="weather-temp">${weather:temperature.current(%.1f)}</td>

It works just fine, just can’t see how to get Fahrenheit.

Its in the wiki!

Unit conversion
    this PR required: https://github.com/openhab/openhab/pull/3385

1 Like