Hardware: Fujitsu Siemens Thin-Client with AMD GX-415GA SOC
OS: Linux 5.15.0-118-generic
Java Runtime Environment: 17.0.10
openHAB version: 4.1.2
Hello,
I have a group called “gLuftfeuchte”, which holds all my humidity values for each room. I have a sitemap showing the actual values, which works perfectly. I wanted to add a graph to the sitemap to see the timely change of the items. In the graph I can only see one value correctly interpreted as percent(0 - 100%). The others are shown as decimal value (0 - 1):
Kind of both. When you have a Number:X Item that means you are using a Number with Units.
The Unit of the Item is defined by the Item’s unit metadata.
The default metadata used when the Item lacks the unit metadata is the system default for that type.
The system default for Number:Dimensionless is a simple ration denoted by the unit one. 27 % == 0.27 one.
When a value with a unit is posted as an update to an Item, that value is converted to the Unit of the Item. So if you post 27 % to the Item, it will be converted to 0.27 automatically.
When a value without a unit is posted as an update to an Item, that value is assumed to be already in the Unit of the Item.
You can change the way the value appears in Sitemaps and MainUI by setting the Item label or State Description Pattern so it includes the unit, as you have done, but that only changes how it appears in the UIs. The Item itself keeps the original unit as it’s actual state and that’s what get saved to persistence, and consequently that’s what gets charted.
tl;dr: If you have a Number:X Item, you should always define unit metadata to explicitely choose and document what unit the Item should carry.