From ab037383ed1ac2ad4e7e501d9de4d94787511eaf Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 1 Oct 2021 16:42:42 +0200 Subject: [PATCH] Adjust state class of solarlog yield and consumption sensors (#56824) --- homeassistant/components/solarlog/const.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/solarlog/const.py b/homeassistant/components/solarlog/const.py index 3ee767f1513..0e9e5e8e5e0 100644 --- a/homeassistant/components/solarlog/const.py +++ b/homeassistant/components/solarlog/const.py @@ -5,7 +5,7 @@ from dataclasses import dataclass from homeassistant.components.sensor import ( STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + STATE_CLASS_TOTAL, SensorEntityDescription, ) from homeassistant.const import ( @@ -19,7 +19,6 @@ from homeassistant.const import ( PERCENTAGE, POWER_WATT, ) -from homeassistant.util import dt DOMAIN = "solarlog" @@ -102,7 +101,7 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = ( name="yield total", icon="mdi:solar-power", native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, - state_class=STATE_CLASS_TOTAL_INCREASING, + state_class=STATE_CLASS_TOTAL, factor=0.001, ), SolarLogSensorEntityDescription( @@ -145,8 +144,7 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = ( name="consumption total", native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, device_class=DEVICE_CLASS_ENERGY, - state_class=STATE_CLASS_MEASUREMENT, - last_reset=dt.utc_from_timestamp(0), + state_class=STATE_CLASS_TOTAL, factor=0.001, ), SolarLogSensorEntityDescription(