From a3d6c776946f1197f8de0d903c433ec017c33a97 Mon Sep 17 00:00:00 2001 From: Patryk Maryniok <6088053+maureis@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:54:25 +0100 Subject: [PATCH] Use unit of measurement from new const --- custom_components/tauron_amiplus/statistics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/tauron_amiplus/statistics.py b/custom_components/tauron_amiplus/statistics.py index 2c714c0..252308f 100644 --- a/custom_components/tauron_amiplus/statistics.py +++ b/custom_components/tauron_amiplus/statistics.py @@ -5,7 +5,7 @@ from homeassistant.components.recorder.models import StatisticMetaData from homeassistant.components.recorder.statistics import (async_add_external_statistics, get_last_statistics, statistics_during_period) -from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, ENERGY_KILO_WATT_HOUR +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, UnitOfEnergy from homeassistant.core import HomeAssistant from homeassistant.util.dt import as_utc, get_time_zone, utc_from_timestamp @@ -215,7 +215,7 @@ async def update_stats(self, statistic_id, statistic_name, initial_sum, last_sta "name": statistic_name, "source": STATISTICS_DOMAIN, "statistic_id": statistic_id, - "unit_of_measurement": ENERGY_KILO_WATT_HOUR + "unit_of_measurement": UnitOfEnergy.KILO_WATT_HOUR } statistic_data = [] for raw_hour in raw_data: