Same Channel, Different Items: One in Fahrenheit, One in Celsius. Why?

First, thank you to everyone that’s contributed to this project. I’m migrating from Smartthings to OpenHAB, and this is incredible software. Thank you, thank you. I’ve also been super impressed with how helpful everyone is in the community. I’ve read countless articles and threads.

  • Platform information:
    • Hardware: Dell Optiplex 790, 16GB RAM

    • OS: Ubuntu 20.04 LTS

    • Java Runtime Environment:
      openjdk version “1.8.0_252”
      OpenJDK Runtime Environment (Zulu 8.46.0.19-CA-linux64) (build 1.8.0_252-b14)
      OpenJDK 64-Bit Server VM (Zulu 8.46.0.19-CA-linux64) (build 25.252-b14, mixed mode)

    • openHAB version: Version: 2.5.4 (Build)

  • Issue of the topic:

The Item that I created in the PaperUI reports in Fahrenheit. The Item created via the .items configuration file reports in Celsius. The outcome I would like is to create an item via the .items configuration file, and I’d like it to report in Fahrenheit.

  • Please post configurations (if applicable):
    • Items configuration related to the issue
      PaperUI created Item obtained via REST API:
      {
      “link”: “http://openhab01:8080/rest/items/CrawlSpaceSensor_Temperature”,
      "state": “64.58 \u00b0F”,
      “stateDescription”: {
      “pattern”: “%.1f %unit%”,
      “readOnly”: true,
      “options”: []
      },
      “editable”: true,
      “type”: “Number:Temperature”,
      “name”: “CrawlSpaceSensor_Temperature”,
      “label”: “Sensor (temperature)”,
      “category”: “Temperature”,
      “tags”: [],
      “groupNames”: []
      },

.items created Item obtained via REST API
{
“link”: “http://openhab01:8080/rest/items/CS_StorageRoom_Temperature”,
"state": “18.1 \u00b0F”,
“stateDescription”: {
“pattern”: “%.1f %unit%”,
“readOnly”: true,
“options”: []
},
“editable”: false,
“type”: “Number:Temperature”,
“name”: “CS_StorageRoom_Temperature”,
“label”: “Temperature”,
“category”: “Temperature”,
“tags”: [
“Temperature”
],
“groupNames”: [
“CS_Storage”,
“gTemperature”
]
},

I’ve read a ton of posts, and I can’t figure out why the one item comes back in Fahrenheit, and the other in Celsius.

I have set the locale in the PaperUI (Configuration->System).

Here is some additional output:
user@openhab01:/etc/openhab2/sitemaps$ cat /etc/default/locale
LANG=C.UTF-8
user@openhab01:/etc/openhab2/sitemaps$ sudo su -s /bin/bash openhab
openhab@openhab01:/etc/openhab2/sitemaps$
openhab@openhab01:/etc/openhab2/sitemaps$ locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE=“C.UTF-8”
LC_NUMERIC=“C.UTF-8”
LC_TIME=“C.UTF-8”
LC_COLLATE=“C.UTF-8”
LC_MONETARY=“C.UTF-8”
LC_MESSAGES=“C.UTF-8”
LC_PAPER=“C.UTF-8”
LC_NAME=“C.UTF-8”
LC_ADDRESS=“C.UTF-8”
LC_TELEPHONE=“C.UTF-8”
LC_MEASUREMENT=“C.UTF-8”
LC_IDENTIFICATION=“C.UTF-8”
LC_ALL=

A little help?

Thank you!!

Could you post the line of the items file that creates the item and the line from sitemap as well.

Here is the line in the .items file:
Number:Temperature CS_StorageRoom_Temperature “Temperature [%.1f %unit%]” (CS_Storage, gTemperature) [“Temperature”] {channel=“zwave:device:00fd7fae:node13:sensor_temperature”}

Here is the line in the .sitemap file:
sitemap default label=“Home” {
Frame {
Text label=“Temperature” icon=“temperature” {
Default item=CS_StorageRoom_Temperature label=“Crawl Space Storage”
}
}
}

The other item was created in PaperUI and so, is not a member of the sitemap.

Greg

You should compare those items only on a sitemap, PaperUI is meant as an AdminTool.
My guess on what you saw is, your thing gets the data in Fahrenheit and PaperUI shows that. Any UI using the sitemap-file would check your local setting. In your case that would call for the Celcius display. If you need the value in Fahrenheit just delete the %unit% and put F in

Jürgen,

Thanks so much for helping me out. My intent was to remove the entire “display stack”, and so, that’s why I thought it was -really- odd that the Celsius and Fahrenheit readings were different in the REST API. I went back and highlighted my original post, and bolded the place where the temperature is in Fahrenheit vs Celsius, and that’s where I’m “seeing” the difference.

Previously to the %unit% config, I had the ‘degree’ F in there, and it was the same result. I put the unit part in there to see if I was ‘fighting’ a conversation/display problem, or something else. In my mind, it’s something else because the REST API is showing the temperature in Celsius 18.1, but putting in a ‘degree’ F.

I’m new to OpenHAB and so, I’m not sure I’m using the technically correct words for what I’m trying to say.

Might well be a PaperUI bug.

Nowhere in your Items is a preferred unit expressed; but there is of course a system default, usually linked to locale I think, so C or F I don’t know.

Meantime, zwave devices actually supply their own units. It’s perfectly acceptable for a device to supply xx F for an update to an Item, where say the system default is C. So far as I know, it doesn’t convert, it gets posted as xx F

Okay, now display in PaperUI. Does it use Item default? No, it hasn’t got one. Might it use system default as fallback? Maybe. It should use the unit embedded in the QuantityType state of course, but heck this only an admin tool.

Like @opus says, use a proper user-facing UI, and define the display units that you really want in the [format]

To explore what is going on more thoroughly, look and see what Items get updated to in your events.log

1 Like