Beginners sitemap questions

One area of OH2 that I’ve not yet touched is sitemaps, started with it today. Getting switches and dimmers onto the sitemap was no problem at all, but now I’ve started playing with sensors and I think I need some help.

The first thing I don’t know how to do is format the values. I’ve got a sensor whose value currently is 21.4 °C, but in the apps it’s displayed as 21.400000 °C. Any way to get rid of those extra decimals?

The second problem is my outdoors temperature. I’ve created an Item for this that’s not connected to any channel but that is instead updated using postUpdate() from a rule (using a combination of multiple real sensors). This Item currently has a value of 6.6, but for some reason no value is showed at all on the UI. Any ideas why that might be?

All of my Items are created using Paper UI. I’m starting to think that gives me a bit too little control over them, don’t know if that’s part of the problem here. I guess more Item settings in UI is on the roadmap somewhere?

I work with config files and there you can specify how many decimals you want to display:

Number    MyTemperature  "The Temperature is [%.1f] °C"   { someBinding:somevalue }

.1f means that it is displayed as a float with one decimal. I am not sure if there is such an option in the PaperUI.

Doh. I thought this was something you could control upon output. Well, there seems to be no such option in the GUIs yet, I hope it’s gonna get there as well. Guess I’ll have to delete my items and make them using .items files instead :expressionless:

Don’t do anything rash just yet. Look into Sitemaps, where in general you describe how you’d like things presented. Look at the label= parameter, where you can specifically assign the text and state format that you’d like to see - it’s very similar to the way that can be done in Items.

1 Like

Ah, ok! Well, this is very far from clear in any documentation I can found, but obviously the “label” includes both the name showed AND how the value is formatted, so to get the output I wanted:

…I actually had to use a label like this: “Temperatur utomhus [%.1f °C]” (please note the °C inside the square parenthesis.)

I did not think of that. Good idea! :slight_smile: