Filebased item config: Unit in stepper and valuebased icon

Related: 'displayState' equivalent for 'oh-stepper-card' · Issue #2875 · openhab/openhab-webui · GitHub

No, not sitemap.

OP is talking about the MainUI automatically generated widget when you go to Properties. He also provided a screenshot that confirms this.

I also thought it was sitemap because he mentioned filebased item, but no.

Well either way what I wanted to say by that is that any implementation should apply to the standard widget which is used in both, Main UI and sitemaps.

Sorry, I overlooked the

in your Post.

As @jimtng, I think that this is inside “the built-in at-a-glance modules” of the location-cards and therefore only the default icon is available and of course the value without the unit. And under normal circumstances you’ll see the degree-sign on the card itself.

But in the MainUI you can create your own widgets as @JustinG posted, i.E. like

My understanding is as follows.

Prior to OH 3 all we had was the label. The label includes a beginning string and a state formatting string [ blah ].

With the introduction of MainUI, a new and more versatile approach was added with the state description. The state description includes all sorts of hints that can be used by MainUI like readonly, command options, min and max values, etc. as it chooses and configures a default widget. But the state description pattern is the equivalent of the state formatting string from the legacy label: everything between the [ ].

I do not know the precedence if both the state description and the Item label includes a pattern on the Item definition, but I do know that sitemaps will use the SD pattern if it’s present and not overridden by the label field of the sitemap element. I also know that if no SD is defined, MainUI will use the Item’s label state formatting string.

It gets more complicated though because some bindings will push a state description metadata to the Item at link time. This is generally invisible (which I really hate). So even if you didn’t define a SD, the binding author may have pushed one on you and sometimes that’s not what you want.