diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index c7d4fdf44896..b4495e6df0e7 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -494,7 +494,7 @@ class SmartEnergyMeteringEntityDescription(SensorEntityDescription): key: str = "instantaneous_demand" state_class: SensorStateClass | None = SensorStateClass.MEASUREMENT - scale: int = 1 + scale: int | None = None @MULTI_MATCH( @@ -608,7 +608,7 @@ class SmartEnergyMetering(PollableSensor): description = self._ENTITY_DESCRIPTION_MAP.get( self._cluster_handler.unit_of_measurement ) - if description is not None and state is not None: + if description and description.scale and state: return float(state) * description.scale return state diff --git a/tests/components/zha/test_sensor.py b/tests/components/zha/test_sensor.py index cad5845ed4dc..5b92fe47c561 100644 --- a/tests/components/zha/test_sensor.py +++ b/tests/components/zha/test_sensor.py @@ -779,7 +779,7 @@ async def test_unsupported_attributes_sensor( ( 1, 1232000, - "123.2", + "123.20", UnitOfVolume.CUBIC_METERS, ), (