Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Merge pull request #5 from codyc1515/codyc1515-patch-1
Browse files Browse the repository at this point in the history
Fix references to deprecated UnitOfEnergy in sensor.py
  • Loading branch information
codyc1515 authored Sep 22, 2024
2 parents 44c93fa + e8abf60 commit ae64406
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/meridian_energy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.components.recorder.models import StatisticData, StatisticMetaData
from homeassistant.const import ENERGY_KILO_WATT_HOUR
from homeassistant.const import UnitOfEnergy
from homeassistant.components.recorder.statistics import (
async_add_external_statistics,
)
Expand Down Expand Up @@ -208,7 +208,7 @@ def update(self):
name=f"{SENSOR_NAME} (Solar Export)",
source=DOMAIN,
statistic_id=f"{DOMAIN}:return_to_grid",
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
)
async_add_external_statistics(self.hass, solarMetadata, solarStatistics)

Expand All @@ -218,7 +218,7 @@ def update(self):
name=f"{SENSOR_NAME} (Day)",
source=DOMAIN,
statistic_id=f"{DOMAIN}:consumption_day",
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
)
async_add_external_statistics(self.hass, dayMetadata, dayStatistics)

Expand All @@ -228,6 +228,6 @@ def update(self):
name=f"{SENSOR_NAME} (Night)",
source=DOMAIN,
statistic_id=f"{DOMAIN}:consumption_night",
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
)
async_add_external_statistics(self.hass, nightMetadata, nightStatistics)

0 comments on commit ae64406

Please sign in to comment.