First try it out in the latest snapshot. If it still shows the unit twice file an issue on the openhab-webui repo.
You don’t show it but one can assume you’ve not defined a “Default stand alone widget” metadata on this Item. If you have, that’s what is being shown and that’s what we need to see to ensure there isn’t a config problem there.
I hadn’t seen it before. But the good thing is, I have been able to reproduce it. I need to further analyse to see what is going on.
I have seen the behaviour for an item linked to an channel on the MQTT binding. I can’t reproduce it for an item not linked to a channel, or linked to a channel of another binding.
It looks like the fundamental issue is with the MQTT binding. You configure a channel to be a Number channel, but no dimension is set on this. A unit is set, and the return value is a string representation. This is then mapped to a Number with Dimension item.
This is an example where the MQTT binding tries to do things with units but is unaware about dimensions. If it is a pure Number channel, it should not pass on any unit at all (that is up to the linked channel with Dimension to add a default).
I suggest to create an issue for this. This may take some time to resolve. In the mean time, use the workaround by setting a pattern.
The MQTT binding for a Number channel does not provide a state description. The values do have a unit. An Number:Dimension item is linked. I would expect the default pattern to be %.0f or %.0f %unit%. But the pattern used seems to be %s unit with the unit hardcoded in the state description behind it.
See an example REST response of a local test on my side:
@Mherwege Is there anything I can do? You mentioned to create an issue? I can do this if needed but I guess I can only provide a few information based on my first post.
You have double uints because you are using %s followed by more stuff (e.g. %%).
You either need to use a number formatter (e.g. %.1f, %d, etc) or remove the units from the lable in the Item definition. The former is better as it will cause the Item’s state to be converted to the specified unit if that label unit happens to be different from the unit metadata.
I’m not sure this is something that has changed though. Using %s should have always shown the unit causing %s %% to show the unit twice.
In fact, this would probably be the simplest solution, but I have just looked at the documentation for the sitemap and the item definition again and there is no indication of this anywhere!
Please don’t get me wrong, I’m totally fine if a Number:xxx item has no string representation, but only %d or %.xf works.
But shouldn’t there be something about this in the documentation or should an error appear in the log?
Before 4.2.x the behavior was actually different and there was no duplicate display