I switched the source for weather data from Weather Underground to OpenWeatherMap when the free API went away. I noticed the precision on the temperature data has 3 decimal places if I use the example item definition from the OpenWeatherMap binding.
One of my rules doesn’t seem to like this, it worked okay before switching the source of the weather data. Now the rule isn’t triggered when the temperature goes over the setpoint.
I tried changing the label in the item definition to [%.0f °F] which I used with Weather Underground, but it gives me two decimal places in the data.
I cannot seem to get the item to report only one decimal place or a integer value like before the change.
Checking the item state in Karaf gives me three decimal figures with [%.1f °F] or two decimal places with [%.0f °F]
openhab> smarthome:items list CurrentTemperature
CurrentTemperature (Type=NumberItem, State=71.406 °F, Label=Temperature, Category=temperature, Groups=[gWeather, Temperatures])
openweather.items
Number:Temperature CurrentTemperature "Temperature [%.1f °F]" <temperature> (gWeather, Temperatures) { channel="openweathermap:weather-and-forecast:homeweather:local:current#temperature" }
The rule in question turns on the fan if it is over 70F outside.
rule "Fan on if Temperature over 70F if it is currently off"
when
Time cron "0 0/10 * * * ?"
then
if (CurrentTemperature.state >= 70)
{
if (NBedFan.state == OFF)
{
sendCommand(NBedFan, ON)
}
}
end