diff --git a/custom_components/repsolluzygas/sensor.py b/custom_components/repsolluzygas/sensor.py index b4411e6..d2b2a9e 100644 --- a/custom_components/repsolluzygas/sensor.py +++ b/custom_components/repsolluzygas/sensor.py @@ -1,14 +1,9 @@ """Platform for sensor integration.""" from .repsol_api import RepsolLuzYGasSensor from homeassistant.helpers.entity import Entity -from homeassistant.components.sensor import ( - PLATFORM_SCHEMA, - STATE_CLASS_MEASUREMENT, - SensorEntity, -) -from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME, DEVICE_CLASS_ENERGY, ENERGY_KILO_WATT_HOUR +from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME import voluptuous as vol -from homeassistant.util import dt as dt_util import homeassistant.helpers.config_validation as cv from datetime import timedelta import requests @@ -49,10 +44,8 @@ def __init__(self, client, name, variable, unit, is_master): self._name = name self.variable = variable self.is_master = is_master - if self.unit = ENERGY_KILO_WATT_HOUR: - self._attr_state_class == STATE_CLASS_MEASUREMENT - self._attr_device_class = DEVICE_CLASS_ENERGY - self._attr_last_reset = dt_util.utc_from_timestamp(0) + self.unit = unit + @property def name(self):