Adjust state class of growatt_server lifetime energy sensors (#56826)

This commit is contained in:
Erik Montnemery 2021-09-30 13:48:01 +02:00 committed by GitHub
parent 942db3fcbc
commit 55328d2c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import logging
import growattServer
from homeassistant.components.sensor import (
STATE_CLASS_TOTAL,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
SensorEntityDescription,
@ -91,7 +92,7 @@ TOTAL_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="totalEnergy",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="total_maximum_output",
@ -118,7 +119,7 @@ INVERTER_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
precision=1,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="inverter_voltage_input_1",
@ -272,7 +273,7 @@ TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eacTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
precision=1,
),
GrowattSensorEntityDescription(
@ -281,7 +282,7 @@ TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="epv1Total",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
precision=1,
),
GrowattSensorEntityDescription(
@ -323,7 +324,7 @@ TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="epv2Total",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
precision=1,
),
GrowattSensorEntityDescription(
@ -446,7 +447,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eBatDisChargeTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="storage_grid_discharge_today",
@ -468,7 +469,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eopDischrTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="storage_grid_charged_today",
@ -483,7 +484,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eChargeTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="storage_solar_production",
@ -539,7 +540,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eToUserTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="storage_load_consumption",
@ -658,7 +659,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eBatChargeTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="mix_battery_discharge_today",
@ -673,7 +674,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="eBatDisChargeTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="mix_solar_generation_today",
@ -688,7 +689,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="epvTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="mix_battery_discharge_w",
@ -732,7 +733,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="elocalLoadTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
GrowattSensorEntityDescription(
key="mix_export_to_grid_today",
@ -747,7 +748,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
api_key="etogridTotal",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=STATE_CLASS_TOTAL,
),
# Values from 'mix_system_status' API call
GrowattSensorEntityDescription(