My Question: Is there a way to limit the precision of a Number Item even if the binding delivers a higher precision and how to do this?
The Background:
I have a Tempest Weather Station from WeatherFlow running. It is connected via the WeatherFlow SmartWeather Binding from William Welliver using the jar-File in the add-on folder (org.openhab.binding.weatherflowsmartweather-2.5.11-SNAPSHOT.jar
).
The Item definition looks like
Number:Temperature thorTemperature "Temperatur [%.2f °C]" (gThor) { channel="weatherflowsmartweather:tempest:HB-00xxxxxx:ST-000yyyyy:temperature" }
I persist the Temperature at every change to an InfluxDB Database and show the results in Grafana. Everything works fine. So far so good.
Strategies {
everyHour : "0 0 * * * ?"
}
Items {
gThor*: strategy = everyChange, everyHour
}
Now my problem: Due to the fact, the precision of the Temperature Value is 2 decimals (%.2f) the temperature changes nearly every minute wich results in a database entry every minute. For me a precision of 1 or even 0 decimals (integer) would be totally fine.
Example: a change from 7 to 8 degrees or 7.5 to 7.6 would be sufficient for me. At the moment the data gathered in influx it looks like this:
[...]
2022-11-13T21:36:24.4Z 6.61
2022-11-13T21:37:24.385Z 6.62
2022-11-13T21:38:24.38Z 6.64
2022-11-13T21:39:24.351Z 6.65
2022-11-13T21:40:24.335Z 6.66
[...]
My idea was to change the dimension of the number item to 1 or 0 decimals, but I haven’t found out how. I spent several hours searching the docs and reading through the forum.
The formatter string [%.0f °C]
seems only to effect the display of the data not the precision itself.
Neither
Number thorTemperature "Temperatur [%.0f °C]" (gThor) { channel="weatherflowsmartweather:tempest:HB-00xxxxxx:ST-000yyyyy:temperature" }
nor
Number:Temperature thorTemperature "Temperatur [%.0f %unit%]" (gThor) { channel="weatherflowsmartweather:tempest:HB-00xxxxxx:ST-000yyyyy:temperature" }
works. The log still shows
23:05:23.914 [INFO ] [smarthome.event.ItemStateChangedEvent] - thorTemperature changed from 6.68 to 6.69
So my question: Is there a way to limit the precision of a Number Item even if the binding delivers a higher precision and how to do this
or
is there another way to solve my problem.
Help would be really appreciated!
- Platform information:
- Hardware: Synology NAS
- OS: DSM 7.1
- openHAB version: 2.5.7 running on a Synology NAS
- Tempest weather station from WeatherFlow
- Binding:
org.openhab.binding.weatherflowsmartweather
-binding - openHAB version: 2.5.7 running on a Synology NAS