Open FSeidinger opened 9 months ago
You just have to set unit to "%" for your item and it will work. This is a classical error for users moving from OH 3.4 to OH 4.x. IMHO, the issue can be closed.
The unit is set to dimensionless and the state description to "%d %%". I changed it to "%d %" but still it shows the incorrect values on the badge.
The problem is not your state description but your item unit. Set item unit to "%".
I do not know what you mean. There is no unit property on the item. Only a type and the type is "Number:Dimensionless" which is correct for percentage values. All other visualisations do not have a problem with showing the correct value. Only the badge does.
In case your item was created with Main UI, it is the 5th field named "Unit", just replace default value "one" by "%":
In case your item is defined in file, just set the unit like for example:
Number:Dimensionless HumiditeExt "Humidité extérieure [%d %%]" <humidity> [ "Measurement", "Humidity" ] {channel="netatmo:outdoor:compte:station:exterieur:humidity#value", unit="%"}
Unit is a metadata. When editing the item:
You could have asked and found help on the community forum.
In case your item was created with Main UI, it is the 5th field named "Unit", just replace default value "one" by "%":
In case your item is defined in file, just set the unit like for example:
Number:Dimensionless HumiditeExt "Humidité extérieure [%d %%]" <humidity> [ "Measurement", "Humidity" ] {channel="netatmo:outdoor:compte:station:exterieur:humidity#value", unit="%"}
I guess that covers the the creation of new items with OH version 4.x. If you already have items and upgrade to OH 4.x then the items do not have a unit and on the edit page there is not unit property you can set. So I guess it is more or less a migration topic.
Unit is a metadata. When editing the item:
And that it is how it is presented to an upgraded item. It is no property, it is in reality a meta data type. And this is how the migration issue is solved. Not to enter or edit a property but adding a new meta date type.
Thanks for the solution. And If you point me in the right direction I would happily add a migration or documentation part for changing the unit for items that do not have any.
Thanks for the solution. And If you point me in the right direction I would happily add a migration or documentation part for changing the unit for items that do not have any.
This was discussed at some length in the breaking changes section of the release notes for OH 4.0. https://github.com/openhab/openhab-distro/releases/tag/4.0.0#breaking-changes-that-require-manual-interaction-after-the-upgrade including instructions for migration both managed and text file defined Items.
Humidity values in percentage on location card are rendered incorrectly for badge and details
Given is an item defined to hold a humidity value. Then the item is rendered correctly in different places:
But is not rendered correctly for the badge in the location card:
Here the value shows up as 1 %. Looks like it is wrongly scaled and tries to show 0.59 rounded up as 1 %.
But again rendered correctly in the details of the location card:
Expected behavior
The badge value should be rendered as 59 %.
Steps to reproduce
Define an item like as a dimensionless number:
with a State description formatting it as a percentage value:
Your environment
Browser console
Browser network traffic