[SOLVED] Dummy Widget Format Value

Hey Guys,

i hope you can help me.

I have a dummy widget where i connected a temperature Item. The dummy widget shows me like: 10.302848392 °C but i want 10.3 °C. I know i can check serverside format but then it shows nothing. I want use the Format field to Round the Value but i dont know and i dont find anything to use this field.

I tested “%.1f” but nothing is happen.

Does anyone knows how to use the Format Field in Dummy Config?

Best Regards

Hi,

i tested it and it works with

%.1f °C

1 Like

I have been struggling with this and even when I put the format in exactly as you show, it does not work. My widgets don’t show the data at all, just the label.

I’ve tried putting the format in the widget “format” setting, and also in the .items file, and neither seems to work. What else could I be missing?

Hard to find an answer here.
If the data (value) does not appear at all, it sounds that the item has no value.
In your first post you had the value “10.302848392”.
Now you have nothing?

I think the best way to come to a solution here, is to try it step by step.

  • define a new simple item
  • assign an integer to the item
  • show the value in OpenHab
  • format the value
  • change the value

You can add a slider in openhab to change the value directly in the GUI

I dont think it has something to do with the definition of the item but here’s my Item definition:

Number GroundFloor_MasterBathroom_Temperature "Badezimmer [%.1f °C]" <temperature> (GroundFloor_MasterBathroom, HomeTemperature, HomeTemperatureMAX)

Can you post your item definition, please?

If it’s a Number:Temperature item (with UoM) this might be a bug :frowning:

The state probably includes the unit so it can’t be formatted since it’s not a number but a string.

I’ll have a look next week.

Try his.

The Problem is your number is not only a number.
Its a number + °C

{{'%.1f' | sprintf:itemValue('KChe_Temperatur').split(' ')[0]}}
1 Like

That’s the current recommended workaround for custom widgets, but the issue here is for the Dummy widget, it has to be fixed in the code.

To be sure, it’s been marked as ‘SOLVED’ because the code it has been fixed in the code ? Or is there a workaround ?

Thank you.
Aymeric

It has been solved in the code.
In SNAPSHOT #1319, I believe

Hi,

sorry for late reply, where can i find the Item definition?

From you *.items file if you have one
Or from the PaperUI

i have some pics, i cant find the item file on my raspbian.dummy habpanel

Remove the temperature dimension in the item screen. And use “%.1f °C” in the widget format

Wuuhuuu nice …it works thx man

Hi,

I’m trying to show a floating number with one decimal and thousands separator but can’t get this working.
This is what I currently have:

 {{'%.1f' | sprintf:itemValue('PV_Current_Power')}}

trying to change it to

{{'%,.1f' | sprintf:itemValue('PV_Current_Power')}}`

doesn’t help.
Any suggestions?

Thanks
Matthias