Use state class total increasing for TPLink smart plugs (#54723)
This commit is contained in:
parent
de0460de61
commit
684d035969
2 changed files with 4 additions and 13 deletions
|
@ -6,8 +6,8 @@ from typing import Any, Final
|
|||
from pyHS100 import SmartPlug
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
ATTR_LAST_RESET,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
STATE_CLASS_TOTAL_INCREASING,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
)
|
||||
|
@ -62,14 +62,14 @@ ENERGY_SENSORS: Final[list[SensorEntityDescription]] = [
|
|||
key=ATTR_TOTAL_ENERGY_KWH,
|
||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
name="Total Consumption",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=ATTR_TODAY_ENERGY_KWH,
|
||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
name="Today's Consumption",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
@ -127,9 +127,6 @@ class SmartPlugSensor(CoordinatorEntity, SensorEntity):
|
|||
self.smartplug = smartplug
|
||||
self.entity_description = description
|
||||
self._attr_name = f"{coordinator.data[CONF_ALIAS]} {description.name}"
|
||||
self._attr_last_reset = coordinator.data[CONF_EMETER_PARAMS][
|
||||
ATTR_LAST_RESET
|
||||
].get(description.key)
|
||||
|
||||
@property
|
||||
def data(self) -> dict[str, Any]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue