Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
Remove deprecated constants
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
codyc1515 committed Jan 30, 2024
1 parent c7d652a commit 16826d2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/contact_energy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, UnitOfEnergy
from homeassistant.components.sensor import SensorEntity

from homeassistant.components.recorder.models import StatisticData, StatisticMetaData
from homeassistant.const import ENERGY_KILO_WATT_HOUR
from homeassistant.components.recorder.statistics import (
async_add_external_statistics,
)
Expand Down Expand Up @@ -186,7 +185,7 @@ def update(self):
name="ContactEnergy",
source=DOMAIN,
statistic_id=f"{DOMAIN}:energy_consumption",
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
)
async_add_external_statistics(self.hass, kWhMetadata, kWhStatistics)

Expand All @@ -196,6 +195,6 @@ def update(self):
name="FreeContactEnergy",
source=DOMAIN,
statistic_id=f"{DOMAIN}:free_energy_consumption",
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
)
async_add_external_statistics(self.hass, freeKWHMetadata, freeKWhStatistics)

0 comments on commit 16826d2

Please sign in to comment.