Adjust state class of solarlog yield and consumption sensors (#56824)

pull/56905/head
Erik Montnemery 2021-10-01 16:42:42 +02:00 committed by GitHub
parent 735c9f8f0b
commit ab037383ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -5,7 +5,7 @@ from dataclasses import dataclass
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING, STATE_CLASS_TOTAL,
SensorEntityDescription, SensorEntityDescription,
) )
from homeassistant.const import ( from homeassistant.const import (
@ -19,7 +19,6 @@ from homeassistant.const import (
PERCENTAGE, PERCENTAGE,
POWER_WATT, POWER_WATT,
) )
from homeassistant.util import dt
DOMAIN = "solarlog" DOMAIN = "solarlog"
@ -102,7 +101,7 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = (
name="yield total", name="yield total",
icon="mdi:solar-power", icon="mdi:solar-power",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL,
factor=0.001, factor=0.001,
), ),
SolarLogSensorEntityDescription( SolarLogSensorEntityDescription(
@ -145,8 +144,7 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = (
name="consumption total", name="consumption total",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL,
last_reset=dt.utc_from_timestamp(0),
factor=0.001, factor=0.001,
), ),
SolarLogSensorEntityDescription( SolarLogSensorEntityDescription(