Skip to content

Commit

Permalink
Changed energy usage sensor to kWh
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-r committed Dec 27, 2023
1 parent 65ee9cf commit 000ddc6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/ohme/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def native_value(self):
class EnergyUsageSensor(CoordinatorEntity[OhmeStatisticsUpdateCoordinator], SensorEntity):
"""Sensor for total energy usage."""
_attr_name = "Ohme Accumulative Energy Usage"
_attr_native_unit_of_measurement = UnitOfEnergy.WATT_HOUR
_attr_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
_attr_device_class = SensorDeviceClass.ENERGY

def __init__(
Expand Down Expand Up @@ -107,6 +106,6 @@ def icon(self):
def native_value(self):
"""Get value from data returned from API by coordinator"""
if self.coordinator.data and self.coordinator.data['energyChargedTotalWh']:
return self.coordinator.data['energyChargedTotalWh']
return self.coordinator.data['energyChargedTotalWh'] / 1000

return None

0 comments on commit 000ddc6

Please sign in to comment.