From 88d90a7ac41bd03b67e75ca81a6a64a8dff912ee Mon Sep 17 00:00:00 2001 From: Lawrence Date: Sun, 9 Apr 2023 08:23:54 +1000 Subject: [PATCH] Revert "feat: Update to use suggested unit of measurement (#22)" (#23) This reverts commit 0eff60c3a61f3ab9ea964ed7bf81e2e5ef45d02b. --- custom_components/powerpal/sensor.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/custom_components/powerpal/sensor.py b/custom_components/powerpal/sensor.py index d0a4243..d251437 100644 --- a/custom_components/powerpal/sensor.py +++ b/custom_components/powerpal/sensor.py @@ -76,20 +76,15 @@ 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.WATT_HOUR + return UnitOfEnergy.KILO_WATT_HOUR @property def native_value(self): """Return the native value of the sensor.""" - return self.coordinator.data.get("total_watt_hours") + return self.coordinator.data.get("total_watt_hours") / 1000 class PowerpalLiveConsumptionSensor(PowerpalSensor, SensorEntity): @@ -113,17 +108,12 @@ 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.WATT + return UnitOfPower.KILO_WATT @property def native_value(self): """Return the native value of the sensor.""" - return self.coordinator.data.get("last_reading_watt_hours") * 60 + return (self.coordinator.data.get("last_reading_watt_hours") * 60) / 1000