diff --git a/custom_components/powerpal/sensor.py b/custom_components/powerpal/sensor.py index d251437..d0a4243 100644 --- a/custom_components/powerpal/sensor.py +++ b/custom_components/powerpal/sensor.py @@ -76,15 +76,20 @@ def state_class(self) -> str: """Return the state class.""" return STATE_CLASS_TOTAL_INCREASING + @property + def suggested_unit_of_measurement(self) -> str: + """Return the suggestted unit of measurement.""" + return UnitOfEnergy.KILO_WATT_HOUR + @property def native_unit_of_measurement(self) -> str: """Return the native unit of measurement.""" - return UnitOfEnergy.KILO_WATT_HOUR + return UnitOfEnergy.WATT_HOUR @property def native_value(self): """Return the native value of the sensor.""" - return self.coordinator.data.get("total_watt_hours") / 1000 + return self.coordinator.data.get("total_watt_hours") class PowerpalLiveConsumptionSensor(PowerpalSensor, SensorEntity): @@ -108,12 +113,17 @@ def state_class(self) -> str: """Return the state class.""" return STATE_CLASS_MEASUREMENT + @property + def suggested_unit_of_measurement(self) -> str: + """Return the suggestted unit of measurement.""" + return UnitOfPower.KILO_WATT + @property def native_unit_of_measurement(self) -> str: """Return the native unit of measurement.""" - return UnitOfPower.KILO_WATT + return UnitOfPower.WATT @property def native_value(self): """Return the native value of the sensor.""" - return (self.coordinator.data.get("last_reading_watt_hours") * 60) / 1000 + return self.coordinator.data.get("last_reading_watt_hours") * 60