Oh4.0.1 uom

I have several max radiator thermostates which show the valve state.
The channel, which is importet via homematic binding is defined as number:dimensionless
The item, linked to the channel is also defined as number:dimensionless and showing the correct value.

But in the logs the value is shown as 0.99 without uom

2023-08-11 11:31:43.290 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Wohnzimmer21_Valve' updated to 0.99

the items analyzer is also showing 0.99 but with uom %

The item itself and the locations tab are showing the correct value with uom.
No metadata is defined for this item.

In a rule i do math with the items state, but i cant use add 6%, i have to do like this

the rule is perfectly working like this, but why i cant use “add 6%”., and why the log is showing 0,99 instead of 99%?

Thanks

Unfortunately you did not show your item definition in detail.
Maybe setting the items format in metadata “state” to “0.1f %%” would help. Have you tried?

Here is the items definition in detail.

{
  "link": "http://10.0.0.97:8080/rest/items/Wohnzimmer21_Valve",
  "state": "0.05",
  "stateDescription": {
    "minimum": 0,
    "maximum": 99,
    "pattern": "%d %%",
    "readOnly": true,
    "options": []
  },
  "unitSymbol": "one",
  "metadata": {
    "semantics": {
      "value": "Point",
      "config": {
        "isPointOf": "Wohnzimmer21"
      }
    }
  },
  "editable": true,
  "type": "Number:Dimensionless",
  "name": "Wohnzimmer21_Valve",
  "label": "Valve State",
  "category": "",
  "tags": [
    "Point"
  ],
  "groupNames": [
    "Valve_Position",
    "Wohnzimmer21"
  ]
}

aplying the metadata format “state” to “0.1f %%” does not change anything

Please review the breaking changes section of the OH 4 release announcement. https://github.com/openhab/openhab-distro/releases/tag/4.0.0#breaking-changes-that-require-manual-interaction-after-the-upgrade

tl;dr: You must define unit metadata on the Item. Without that metadata the system default unit is used which for dimensionless is ONE.

Guess Rich is right here (as usual :wink:), the "unit "metadata should be the key to success.
The detailed items definition shows it.

Yes, Rich was right :hugs:
I have read the braking changes several times , but refused to change the metadata unit because of the warning shown

WARNING: Changing the internal unit can corrupt your persisted data!

Thanks Rich for pointing out!!

That should be interpreted to mean that you must set the unit to what ever is being saved to your DB already in 3.4. If you just leave it unset you end up with the default which may or may not match the units of the values stored in the DB already. Similarly if you change the unit to something different the same will occur.

Only the raw number carried by the Item’s state is saved to the DB, nothing about units.

Theoretically, for managed Items (i.e. those not defined in .items files), if there was a State Description Pattern that included units, a unit metadata entry should have been created automatically by the upgrade tool during the upgrade to OH 4. However, I’ve seen a number of indications reported on the forum that it doesn’t always work for %. I don’t have enough evidence to file an issue though. Just a suspicion.