Problem with decimal places in setpoints

Hi.

I am - frequently but not always - having the problem that when I show some setpoints in the MainUI (Chrome browser) that the +/- widget is not showing any decimal places.

The worst thing about this is that usually I have some setpoints set to 21.5 and when I show them on Android then they are automatically updated to 22 - not just in the display but that value is sent over the channel! That’s quite a problem.

My item description looks like "Diele Sollwert [%.1f °C]" but that does not seem to help.

Do you know a way around this?

P.S. This seems to have been reported here for Android already, but it seems that is it not actually an Android issue. And nobody followed up.

I just realized that whether or not decimal places are shown may be dependent on the window size, actually. If that is so then this looks like a bug to me?

Do you have a State Description Pattern set? MainUI doesn’t use the label field from a .items file (i.e. the [%.1f °C]. It uses the State Description metadata. If you set the pattern field of that to %.1f °C, does that change anything?

Note, it’s metadata so yes it can be define in a .items file but no, I can’t tell you how to do it. I decided early on that I want to fight home automation problems, not syntax problems so I don’t do .items files any more. But I do know that it’s not hard to translate the YAML you see in the code tab to what you need in the .items files.

Is this widget something you’ve created or is it the default? This matters because if it’s a custom one, if you are using =items.MyItem.state that’s the “raw” state of the Item. To get the formatted state you need to use =items.MyItem.displayState. The default widgets will use the correct one by default though.

Note that the formatted state of the Item is not shown on the Settings → Items page. But it is used everywhere else (Settings Model, the Item’s configuration page itself, etc.).

Finally, if this is the default widget, you might be able to adjust it’s settings through a custom widget. Assuming this is in the Overview pages, navigate to the Item and click “add metadata” and then “Default list item widget”. Choose the “stepper” or “slider” widget and then you can set the min, max, and step size as desired.

That combined with a state description pattern should do the job I would think.

Hello.

I have modified the item definition with a stateDescription pattern “[%.1f °C]” now. But that does not seem to help.

I am using the default widget, no modifications.

Oddly, there actually seems to be a race condition in OpenHAB:

When I first select Locations, then the setpoint is correctly shown as 21.5:
image

and, interestingly, when I then select Properties → Temperature, it’s also shown correctly:

However, if I reload the MainUI and then directly click on Properties → Temperature without first clicking on Locations then it discard the decimal place:

So somehow the Locations tab must be doing something differently than the Properties tab, and it must cause this to somehow change the display of the Properties tab as well. Really odd.

After some more digging it seems that what I define in the stateDescription is completely ignored for some reason. Setting the min/max/step of the stepper item might help, but apparently cannot at all be done through .item definition files :frowning: (see here)

But why is the stateDescription not automatically been taken into account by the stepper (or other widgets for that matter)? Is this intended functionality?

No brackets when defining the state description. just %.1f °C.

They both use the same widget so that seems unlikely. Something else must be going on.

Show your config.

If there’s a syntax error somewhere it’s not going to be able to use it.

I just updated the stateDescription but that only seems to marginally change things.

My item config now reads:

Number      BueroSollwert            "Büro Soll" <temperature> (gBuero)                ["Temperature","Setpoint"]       { channel="knx:device:bridge:heating:BueroSollwert", stateDescription=""[pattern="%.1f",min="18",max="22",step="0,5" ] }

In the UI it looks as:


Now when I set the setpoint to 21.5 and open Properties, it is first shown correctly:

However,, when I then reload the browser tab and click on Properties → Temperature again, then it again shows 22, also setting the Item to that value :frowning:

step="0.5" would be the correct version, I think.

1 Like

Heureca! Thanks a lot that did the trick!

Sorry that I did not see that earlier! Still, the behavior I saw earlier is kind of strange, though.