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

Remove `last_reset` attribute and set state class to `total_increasing` for...

Remove `last_reset` attribute and set state class to `total_increasing` for saj energy sensors (#54813)

Co-authored-by: default avatarFranck Nijhof <git@frenck.dev>
parent 6aca3b32
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
)
from homeassistant.const import (
......@@ -34,7 +35,6 @@ from homeassistant.core import CALLBACK_TYPE, callback
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_call_later
from homeassistant.util import dt as dt_util
_LOGGER = logging.getLogger(__name__)
......@@ -177,10 +177,10 @@ class SAJsensor(SensorEntity):
self._serialnumber = serialnumber
self._state = self._sensor.value
if pysaj_sensor.name in ("current_power", "total_yield", "temperature"):
if pysaj_sensor.name in ("current_power", "temperature"):
self._attr_state_class = STATE_CLASS_MEASUREMENT
if pysaj_sensor.name == "total_yield":
self._attr_last_reset = dt_util.utc_from_timestamp(0)
self._attr_state_class = STATE_CLASS_TOTAL_INCREASING
@property
def name(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment