You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZHA patch for more precision display of data for all Zigbee devices.
New version Home Assistant
Core: 2024.10.2
Frontend: 20241002.3
Accuracy of values according to the Zigbee standard:
Find the file zha/application/platforms/sensor/__init__.py (base path ~/lib64/python3.xx/site-packages/zha/application/platforms/sensor) and fix it _decimals: int = 1 to _decimals: int = 2:
class Sensor(PlatformEntity):
"""Base ZHA sensor."""
PLATFORM = Platform.SENSOR
_attribute_name: int | str | None = None
_decimals: int = 2
_divisor: int = 1
@staticmethod
def formatter(value: int) -> int | None: # pylint: disable=arguments-differ
"""Return the state of the entity."""
# per zcl specs battery percent is reported at 200% ¯\_(ツ)_/¯
if not isinstance(value, numbers.Number) or value in (-1, 255):
return None
value = round(value / 2, 1)
return value
REPORT_CONFIG
Find the file zha/zigbee/cluster_handlers/measurement.py (base path ~/lib64/python3.xx/site-packages/zha/zigbee/cluster_handlers/measurement.py) and fix it REPORT_CONFIG step value:
Find the file components/zha/sensor.py (base path ~/.lib64/python3.xx/site-packages/homeassistant) and fix it:
class Sensor(ZhaEntity, SensorEntity):
"""Base ZHA sensor."""
_attribute_name: int | str | None = None
_decimals: int = 2
_divisor: int = 1
_multiplier: int | float = 1
"""Return the state of the entity."""
# per zcl specs battery percent is reported at 200% ¯\_(ツ)_/¯
if not isinstance(value, numbers.Number) or value == -1:
return None
value = round(value / 2, 1)
return value
ZHA patch for more precision display of data for all Zigbee devices.
New version Home Assistant
Core: 2024.10.2
Frontend: 20241002.3
Accuracy of values according to the Zigbee standard:
Find the file
zha/application/platforms/sensor/__init__.py
(base path~/lib64/python3.xx/site-packages/zha/application/platforms/sensor
) and fix it_decimals: int = 1
to_decimals: int = 2
:Battery percent - step 0.5%
~/lib64/python3.xx/site-packages/zha/application/platforms/sensor/init.py
REPORT_CONFIG
Find the file
zha/zigbee/cluster_handlers/measurement.py
(base path~/lib64/python3.xx/site-packages/zha/zigbee/cluster_handlers/measurement.py
) and fix it REPORT_CONFIG step value:REPORT_CONFIG_MAX_INT, REPORT_CONFIG_MIN_INT
~/lib64/python3.xx/site-packages/zha/zigbee/cluster_handlers/const.py
Old version ZHA / Home Assistant:
Find the file
components/zha/sensor.py
(base path~/.lib64/python3.xx/site-packages/homeassistant
) and fix it:site-packages/homeassistant/components/zha/core/cluster_handlers/general.py :
site-packages/homeassistant/components/zha/core/cluster_handlers/measurement.py :
site-packages/homeassistant/components/zha/core/const.py :
https://community.home-assistant.io/t/provide-higher-precision-temperature-value-unrounded-values/502245
The text was updated successfully, but these errors were encountered: