Number:Temperature

Trying to use data from a Number:Temperature item and nothing get’s displayed in HabPanel…
yet when I remove the :Temperature from the item type I do get a value but it’s displayed in the wrong unit (Celsius not Fahrenheit)

Is there a way to use the item type of Number:Temperature in HabPanel or do I just use number and use a transform to convert to Fahrenheit?

Squid

Do you have your units set in paper ui? Set to imperial?

Check configuration then system

Yup, it’s set correctly…

UoM support in HABpanel (or more precisely the REST API it uses) is rather limited. See also here and here.

so…the number that i am currently getting is in Celsius…so i guess i will need to perform an inline conversion to Fahrenheit?

What’s the source of your data? Not all bindings support UoM. What do you see your Item getting updated to in your events.log?

Data is coming from the dark sky binding

Okay, so the data comes from a web service and you get what you’re given.
That’s fine, the darksky binding supports UoM and you should use the suggested Number:Temperature type.

If you want to format the state of your Item for display, you can do that by adding a state format section [ ] to your Item label.
“My temperature [%.1f °F]”
would format and auto convert a Number:Temperature state to degrees F, even if it is stored in C or K.
In a sitemap based UI, that is.

In a HABpanel widget, you can choose between displaying raw Item state or using server supplied format - that’s the [ ] stuff.

Number:Temperature will not render any data in HabPanel. I can only use Number where I get the data as Celsius. I have tried the [%.1 F] with no joy.

Here’s my code…

HabPanel

  <h2 style="margin-bottom:1em;">{{'%.1f' | sprintf:itemValue('Weather_Temperature')}} °F</h2>

Item

Number Weather_Temperature "[%.1f]"{ channel="darksky:weather-and-forecast:ead7c7a1:current#temperature" }

I don’t know anything about HABpanel … but …

does that mean if openHAB sends you a formatted string like “45.2 °F” it will fail to display?

it displays a value…just in centigrade…

image

But you said nothing gets displayed for Number:Temperature

If you want conversion, you have to use Number:Temperature
Numbers don’t know anything about temperatures or how to convert them.

Have you ticked the tick-box thingy?

I said nothing gets displayed if I used Number:Temperature…but if i use just Number I get the Celsius value, which I am using above…make sense? :wink:

Yes.
Are you going to try using Number:Temperature, an Item defined [format for F], and a string HABpanel formatter, all at the same time?

Number:Temperature Weather_Temperature "text [%.1f °F]"{ channel="...
<h2 style="margin-bottom:1em;">{{'%s' | sprintf: ...

I’ve removed all formatting and I still get the Celsius value

Well, yes. No formatting, no conversion.

Like I said, AFAIK there is no proper UoM support in HABpanel. As an alternative you could create a small rule as shown here to do the conversion.

openHAB deals with the UoM. HABpanel doesn’t need to do anything just for display.
Ask for server formatted data and display it - it’s a non-numeric string, because of course it has units symbol included.

How and where should conversion between units be specified in that scenario? According to this merged issue, there is no support for conversion. An excerpt from that thread:

HABPanel can’t do unit conversions, they’re done by the ESH framework - that’s why the sitemaps will do them, because they can leverage the framework while HABPanel only has access to the state reported by the API. If you want e.g. your temperatures in °F instead of °C by default you have to change the locale in openHAB (with Paper UI) to US English (see https://www.openhab.org/docs/concepts/units-of-measurement.html#quantitytype); alternatively you specify the unit you want in an item’s state description (https://www.openhab.org/docs/concepts/units-of-measurement.html#numberitem-linked-to-quantitytype-channel).

This last option doesn’t seem to work according to @KidSquid.

In the Item’s label [state format] section.
(no use in a sitemap line, obviously)
It is necessary both to ask for the server formatted version in HABpanel and to understand that it is a string.

So far as I can see, they’ve not tried all the needed elements at the same time.