In OH2, formatting could occur at the Sitemap level - so it didn’t actually affect the value of the item’s state.
But in OH3 this now seems to be at the Item state level. I’ve used the State Description metadata to set formatting for a power value as “%d W”, so that (for example) a value of 4 is displayed as “4 W”. The item is tagged in the Semantic Model as Type of “Number:Power” and Class an Property as “Measurement” and “Energy” respectively.
But this seems to affect the item state in rules. So, for example, "Washer_Energy.state " now seems to have a string value of “4 W” rather than a numeric value of 4.
This means that any arithmetic comparison operators are now working on alphanumeric precedence of the full string, rather than the numeric value - which makes a nonsense of my Rule logic.
Picking the numeric value out of the string will mean I have to have Rules code that’s dependent on the exact State Description formatting, which seems dumb as I’d have to keep to different things in step.
Have I fundamentally misunderstood something here?
For the moment, I’ve just removed the State Description formatting. But ideally I’d like to show this as “4 W” rather than just “4”.