Skip to content

Commit

Permalink
Revert "feat: Update to use suggested unit of measurement (#22)" (#23)
Browse files Browse the repository at this point in the history
This reverts commit 0eff60c.
  • Loading branch information
mindmelting authored Apr 8, 2023
1 parent 0eff60c commit 88d90a7
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions custom_components/powerpal/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

0 comments on commit 88d90a7

Please sign in to comment.