Remove last_reset
attribute and set state class to total_increasing
for saj energy sensors (#54813)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
6aca3b326f
commit
9c7ea786a7
1 changed files with 3 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue