bug: unit of measurament

This is the warning showed in the registry log:
 (<class 'custom_components.hon.sensor.HonSensorEntity'>) is using native unit of measurement 'kWh' which is not a valid unit for the device class ('power') it is using; expected one of ['W', 'kW', 'TW', 'GW', 'MW'];
This commit is contained in:
Héctor Martínez 2024-12-23 19:16:51 +01:00 committed by GitHub
parent 70eb6c0111
commit 67bce169ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,6 +18,7 @@ from homeassistant.const import (
UnitOfEnergy,
UnitOfVolume,
UnitOfMass,
UnitOfPower,
UnitOfTime,
UnitOfTemperature,
)
@ -83,7 +84,7 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
name="Current Electricity Used",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfPower.WATT,
icon="mdi:lightning-bolt",
translation_key="energy_current",
),