Persistence does't save units of measurement (Number:Dimensionless)

Hi everyone,

I just solved my latest issue with the units of measurement in the new main ui but now I stumbled across a new problem which also involves persistence.

It seems like items of the type Number:Dimensionless could have some problems with proper visualisation in the main ui after restoring its value from persistence since “Dimensionless” could be one of three different types of units.

So what happens is that when I do a restart of OH the ui shows values that are not correct (% missing in item state) because the Units are not persisted. After a restart my sensor’s battery has a state of 10000%. (So it seems that I never have to change its battery again. Nice! :wink:)

After the sensor updated the items everything is back to normal.

This only happens in the main ui when you open a card and can see the equipment. In the card label the correct value is displayed (e.g. humidity icon: 45%).

Is there a way to handle such cases of “Dimensionless” items or is it best to return to the good old Number item and do the visualisation part in the item label?

What persistence service do you use, this may have a bearing on it?

I tried mapDB and rrd4j. The restore with both of them results in the described scenario.

Sorry for late response, missed reply.
I have no further input, but will note that Number:Dimensionless is the oddball Quantity type, where “27.5” is considered valid even with no units (it should be interpreted as 27.5:1 ratio, i.e. 2750%)
This sounds like a bug in the persistence service handling of Quantity types and default units.