mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove last_reset attribute from devolo energy sensors (#54803)
This commit is contained in:
parent
d9bfb8fc58
commit
0b7b4152f1
@ -12,7 +12,7 @@ from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_POWER,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
DEVICE_CLASS_VOLTAGE,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
STATE_CLASS_TOTAL_INCREASING,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -162,10 +162,7 @@ class DevoloConsumptionEntity(DevoloMultiLevelDeviceEntity):
|
||||
)
|
||||
|
||||
if consumption == "total":
|
||||
self._attr_state_class = STATE_CLASS_MEASUREMENT
|
||||
self._attr_last_reset = device_instance.consumption_property[
|
||||
element_uid
|
||||
].total_since
|
||||
self._attr_state_class = STATE_CLASS_TOTAL_INCREASING
|
||||
|
||||
self._value = getattr(
|
||||
device_instance.consumption_property[element_uid], consumption
|
||||
@ -180,15 +177,11 @@ class DevoloConsumptionEntity(DevoloMultiLevelDeviceEntity):
|
||||
|
||||
def _sync(self, message: tuple) -> None:
|
||||
"""Update the consumption sensor state."""
|
||||
if message[0] == self._attr_unique_id and message[2] != "total_since":
|
||||
if message[0] == self._attr_unique_id:
|
||||
self._value = getattr(
|
||||
self._device_instance.consumption_property[self._attr_unique_id],
|
||||
self._sensor_type,
|
||||
)
|
||||
elif message[0] == self._attr_unique_id and message[2] == "total_since":
|
||||
self._attr_last_reset = self._device_instance.consumption_property[
|
||||
self._attr_unique_id
|
||||
].total_since
|
||||
else:
|
||||
self._generic_message(message)
|
||||
self.schedule_update_ha_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user