Provide higher precision (temperature) value (unrounded values)

Currently the temperature values for my zigbee sensors in ZHA are rounded to 0.1°C.

My request is to make the unrounded value available, either as the state value or as a state attribute.
I understand that using a rounded value results in less values in the database, but state attributes are not recorded in the history.

While commercial temperature sensors do not have an absolute precision less than 0.1°C, the relative precision can be higher and usefull to feed in to a PID that could adjust to the sub 0.1°C changes reported by the sensors (the sensors report 0.01°C precision).

However as the values are rounded, the standard way to read and forward those measurements have only 0.1°C precision.

Are they rounded?

Or is your sensor only reporting in 0.1 degree precision?

Home assistant (mostly) does not change what is reported by APIs.

It 100% comes from the device.

The sensor reports 0.01 precision but it is rounded in ZHA - and I suspect also elsewhere.

No specific _decimals:

Hence, 1 decimal:

1 Like
2 Likes

Interesting patch, however patching HA after each update is not ideal.

I noticed that recently the precision of values can be specified in the settings of an entity in a device - I only just configured a temperature sensor with two digits - not 100% sure if it works yet, but I do see centigrades in my history graph):

To get the higher precision, I currently read the ZHA value from cache. To identify that it was reported again by the device, I apply a small change to the sensor value just after the update.

Which is applied in a blueprint that sends temperatures to a zigbee thermostat:

There is no other option for HA.
ZHA has many problems. There is no possibility to configure Zigbee devices.
The ZHA toolkit does not work with clusters unknown to it.

1 Like

ZHA does not allow user defined reporting configurations from the UI, but you can configure Zigbee devices.

I do not see how the patch handles unknown clusters.
Zigpy requires that the cluster is defined in its internal structure, and at this time zha-toolkit does not add any new ones (it can add unknown commands for the sake of sending the command).

The way to add an unknown (=unreported) cluster to a device definition is the addition of a zha_device_handler/quirk.