Actually I think the problem is that you are using metric programming and not including imperial measurements. I am basing that on the incorrect value for pressure too which in done in kPa instead of inHg
He he, you say [quote="sgrayban, post:564, topic:1816"]
I think the problem is that you are using metric programming and not including imperial measurements.
[/quote]
Actually I think the problem is to many places still using imperial ?
Remind me again, of how many countries still use imperial ?
I would like to know what is the raw value sent from the sensor. If you can log the descMap.value and zigbee.convertHexToInt(descMap.value), we should be able to narrow down the issue.
Hmm, This is not quite I expected. 1F2 should come out to 498. This should be pass to AdjustTemp method. If it is logged first thing in the method, it should print 4.98. The log should be 2 decimal digit like your post below. Zigbee sensor send temperature in Celsius multiples by 100 encoded in integer.
The value is filtered which may be higher if filter is enabled. The number is close enough. I will assume that the AdjustTemp: 5.270876 is log after the adjustment.
Now, from your last night result, I have a theory. Here it is 655.23 C looked like FFF3 in the descMap.value. The FFF3 is a 16 bit signed integer. It should be converted to -13. In turn, it should be converted to -0.13 in Celsius. The theory is that zigbee.convertHexToInt(FFF3) should return -13. Instead, I suspect it returns 65523. If this is correct, I have to find a way to convert the hex to signed integer using better way.
If the theory above is correct, your sensor should be ok. The driver can be fixed. We can find a way to convert a hex to integer the right way. But, I want to make sure that we confirm the value on the val AdjustTemp method first thing before any code executed in the method.
It is a groovy. There should be another way to convert hex string to singed integer. I will update you when I found a solution. I hate to write the code doing the conversion by myself. BTW, which version of hubitat do you use? Since the code depend on zigbee.convertHexToInt, this is a bug that could have been fixed also by the hubitat team.
My opinion about unit is that the code should convert what every the zigbee sent with Zigbee intended. For example, DTH should capture Temperature in C and Pressure in kPa. The GUI should convert them for display to current locale of the hub is set. This is easier said than done. I believe Temperature has done so well. We just need to send value as Zigbee reported in C. The display should display in F or C automatically depending on the locale. In the case of pressure, the same should also be done. Sensor should report in Zigbee standard. The GUI should convert them to kPa or Hg based on the hub locale setting.
use the following:
Long hexStrToUnsignedInt(String hexStr)
or
Long hexStrToSignedInt(String hexStr)
then the other way:
String intToHexStr(Integer value, Integer minBytes = 1)