[SOLVED] Dummy Widget Format Value


(Gonzo Gonzales) #1

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


(Felix) #2

Hi,

i tested it and it works with

%.1f °C


(Mitch) #3

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?


(Felix) #4

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)

(Vincent Regaud) #5

Can you post your item definition, please?


(Yannick Schaus) #6

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.


(Thomas) #7

Try his.

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

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

(Yannick Schaus) #8

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.


(Harry) #9

(Alain) #10

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


(Vincent Regaud) #11

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


(Gonzo Gonzales) #13

Hi,

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


(Vincent Regaud) #14

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


(Gonzo Gonzales) #15

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


(Vincent Regaud) #16

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


(Gonzo Gonzales) #17

Wuuhuuu nice …it works thx man