Change energy state class to STATE_CLASS_TOTAL (#56974)

This commit is contained in:
Jean-Yves Avenard 2021-10-06 22:24:17 +11:00 committed by GitHub
parent e69a1c3546
commit 9d84d41f81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@ from iotawattpy.sensor import Sensor
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
STATE_CLASS_TOTAL,
SensorEntity,
SensorEntityDescription,
)
@ -83,6 +83,7 @@ ENTITY_DESCRIPTION_KEY_MAP: dict[str, IotaWattSensorEntityDescription] = {
"WattHours": IotaWattSensorEntityDescription(
"WattHours",
native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_TOTAL,
device_class=DEVICE_CLASS_ENERGY,
),
"VA": IotaWattSensorEntityDescription(
@ -242,7 +243,6 @@ class IotaWattAccumulatingSensor(IotaWattSensor, RestoreEntity):
super().__init__(coordinator, key, entity_description)
self._attr_state_class = STATE_CLASS_TOTAL_INCREASING
if self._attr_unique_id is not None:
self._attr_unique_id += ".accumulated"