diff --git a/homeassistant/components/zha/core/channels/smartenergy.py b/homeassistant/components/zha/core/channels/smartenergy.py index 7b12411b84f..9138ea09782 100644 --- a/homeassistant/components/zha/core/channels/smartenergy.py +++ b/homeassistant/components/zha/core/channels/smartenergy.py @@ -3,7 +3,7 @@ import logging import zigpy.zcl.clusters.smartenergy as smartenergy -from homeassistant.const import LENGTH_FEET, TIME_HOURS, TIME_SECONDS +from homeassistant.const import LENGTH_FEET, POWER_WATT, TIME_HOURS, TIME_SECONDS from homeassistant.core import callback from .. import registries, typing as zha_typing @@ -60,7 +60,7 @@ class Metering(ZigbeeChannel): REPORT_CONFIG = [{"attr": "instantaneous_demand", "config": REPORT_CONFIG_DEFAULT}] unit_of_measure_map = { - 0x00: "kW", + 0x00: POWER_WATT, 0x01: f"m³/{TIME_HOURS}", 0x02: f"{LENGTH_FEET}³/{TIME_HOURS}", 0x03: f"ccf/{TIME_HOURS}", @@ -135,6 +135,12 @@ class Metering(ZigbeeChannel): def formatter_function(self, value): """Return formatted value for display.""" + if self.unit_of_measurement == POWER_WATT: + # Zigbee spec power unit is kW, but we show the value in W + value_watt = value * 1000 + if value_watt < 100: + return round(value_watt, 1) + return round(value_watt) return self._format_spec.format(value).lstrip()