Skip to content
Snippets Groups Projects
Unverified Commit 0b7b4152 authored by Erik Montnemery's avatar Erik Montnemery Committed by GitHub
Browse files

Remove last_reset attribute from devolo energy sensors (#54803)

parent d9bfb8fc
No related branches found
No related tags found
No related merge requests found
......@@ -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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment