jason0x43/hacs-hubitat

Temperature reporting is mixing up units (celcius vs fahrenheit)

giveyouup opened this issue · 7 comments

I have a bunch of temperature sensors (zigbee) paired to a hubitat that I've been using inside HA for sometime now. After recent update, I noticed crazy high temps being reported and it seems something is mixing up the units. For example:

Inside Hubitat, my sensor is reporting the following:
Name: Temperature
Value: 75.17
Unit: F

In HA:
In Configure Menu, Temperature Units (optional) is set to F
in the entity settings, the unit of measurements is set to F
Temperature value shown is 167.31F

Interestingly, if I change the unit of measurements in the entity settings to C, the value reported is 75.17 C so the number is correct but units is getting mixed up.

Seeing the same behavior here, with a bunch of zwave sensors shared from hubitat

Seems somewhat intermittent. Here are 4 temp sensors, they all show the buggy behavior before reverting back to normal reporting. The time when they all "spike up" is when I reload the Hubitat integration inside HA. I'll keep an eye on it without changing anything to see if it spikes up again randomly on its own.

I think it will but not sure if any patterns

It may depend on the temperature sensors you're using.

I've been testing using Hubitat's virtual temperature sensors. Those sensors, at least, can be configured to report temperatures in F or C, independent of whatever the hub is setup to use. The units used by a sensor aren't included with the device information loaded from the hub when the integration starts up startup; the integration gets the sensor's value, but not the units. The units are included with temperature events received from the temperature sensor.

So, if the integration's default units and the units used by the sensor don't agree, when the integration first starts up, it will display the sensor's value with the wrong units, and will switch to the correct units the first time an event is received from the sensor. To avoid the period of incorrect units, you should just need to make sure that the units configured for the integration agree with the native units being reported by the sensor.

It may depend on the temperature sensors you're using.

I've been testing using Hubitat's virtual temperature sensors. Those sensors, at least, can be configured to report temperatures in F or C, independent of whatever the hub is setup to use. The units used by a sensor aren't included with the device information loaded from the hub when the integration starts up startup; the integration gets the sensor's value, but not the units. The units are included with temperature events received from the temperature sensor.

So, if the integration's default units and the units used by the sensor don't agree, when the integration first starts up, it will display the sensor's value with the wrong units, and will switch to the correct units the first time an event is received from the sensor. To avoid the period of incorrect units, you should just need to make sure that the units configured for the integration agree with the native units being reported by the sensor.

Awesome, your explanation makes perfect sense and I think it is exactly what's happening.

Thank you for an amazing integration. I think I'll mark this closed for now

I'm experiencing the same issue. I'm using a custom driver for aqara temperature sensors where it controls the unit that is emitted. In my own testing, I've forced it to emit temperature only in Fahrenheit, but the behavior persists on restart. Device logs continue to show the correct temperature in F.

This is the driver:
https://github.com/veeceeoh/xiaomi-hubitat/blob/master/devicedrivers/xiaomi-temperature-humidity-sensor-hubitat.src/xiaomi-temperature-humidity-sensor-hubitat.groovy

@carlos-v44 Are you on v0.9.18+? 0.9.18 has a workaround for an issue where units would be misreported for drivers that weren’t following the Hubitat spec.

@jason0x43 I updated to v0.9.19 (from v0.9.15 this week) and it seems to be working as expected :). Thanks