mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Adjust state class of growatt_server lifetime energy sensors (#56826)
This commit is contained in:
parent
942db3fcbc
commit
55328d2c6f
@ -9,6 +9,7 @@ import logging
|
|||||||
import growattServer
|
import growattServer
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
|
STATE_CLASS_TOTAL,
|
||||||
STATE_CLASS_TOTAL_INCREASING,
|
STATE_CLASS_TOTAL_INCREASING,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
@ -91,7 +92,7 @@ TOTAL_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="totalEnergy",
|
api_key="totalEnergy",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="total_maximum_output",
|
key="total_maximum_output",
|
||||||
@ -118,7 +119,7 @@ INVERTER_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
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,
|
||||||
precision=1,
|
precision=1,
|
||||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="inverter_voltage_input_1",
|
key="inverter_voltage_input_1",
|
||||||
@ -272,7 +273,7 @@ TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eacTotal",
|
api_key="eacTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
precision=1,
|
precision=1,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
@ -281,7 +282,7 @@ TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="epv1Total",
|
api_key="epv1Total",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
precision=1,
|
precision=1,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
@ -323,7 +324,7 @@ TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="epv2Total",
|
api_key="epv2Total",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
precision=1,
|
precision=1,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
@ -446,7 +447,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eBatDisChargeTotal",
|
api_key="eBatDisChargeTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="storage_grid_discharge_today",
|
key="storage_grid_discharge_today",
|
||||||
@ -468,7 +469,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eopDischrTotal",
|
api_key="eopDischrTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="storage_grid_charged_today",
|
key="storage_grid_charged_today",
|
||||||
@ -483,7 +484,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eChargeTotal",
|
api_key="eChargeTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="storage_solar_production",
|
key="storage_solar_production",
|
||||||
@ -539,7 +540,7 @@ STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eToUserTotal",
|
api_key="eToUserTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="storage_load_consumption",
|
key="storage_load_consumption",
|
||||||
@ -658,7 +659,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eBatChargeTotal",
|
api_key="eBatChargeTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="mix_battery_discharge_today",
|
key="mix_battery_discharge_today",
|
||||||
@ -673,7 +674,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="eBatDisChargeTotal",
|
api_key="eBatDisChargeTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="mix_solar_generation_today",
|
key="mix_solar_generation_today",
|
||||||
@ -688,7 +689,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="epvTotal",
|
api_key="epvTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="mix_battery_discharge_w",
|
key="mix_battery_discharge_w",
|
||||||
@ -732,7 +733,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="elocalLoadTotal",
|
api_key="elocalLoadTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
key="mix_export_to_grid_today",
|
key="mix_export_to_grid_today",
|
||||||
@ -747,7 +748,7 @@ MIX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||||||
api_key="etogridTotal",
|
api_key="etogridTotal",
|
||||||
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_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL,
|
||||||
),
|
),
|
||||||
# Values from 'mix_system_status' API call
|
# Values from 'mix_system_status' API call
|
||||||
GrowattSensorEntityDescription(
|
GrowattSensorEntityDescription(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user