Skip to content

Commit

Permalink
Define state_class for Growatt storage entities (home-assistant#121514)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cris-ET authored Jul 8, 2024
1 parent 242b283 commit bd4ef4b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions homeassistant/components/growatt_server/sensor_types/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
api_key="eBatDisChargeToday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
GrowattSensorEntityDescription(
key="storage_storage_production_lifetime",
Expand All @@ -36,13 +37,15 @@
api_key="eacDisChargeToday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
GrowattSensorEntityDescription(
key="storage_load_consumption_today",
translation_key="storage_load_consumption_today",
api_key="eopDischrToday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
GrowattSensorEntityDescription(
key="storage_load_consumption_lifetime",
Expand All @@ -58,6 +61,7 @@
api_key="eacChargeToday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
GrowattSensorEntityDescription(
key="storage_charge_storage_lifetime",
Expand All @@ -73,6 +77,7 @@
api_key="ppv",
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
GrowattSensorEntityDescription(
key="storage_solar_production_2",
Expand All @@ -88,40 +93,46 @@
api_key="capacity",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.BATTERY,
state_class=SensorStateClass.MEASUREMENT,
),
GrowattSensorEntityDescription(
key="storage_power_flow",
translation_key="storage_power_flow",
api_key="pCharge",
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
GrowattSensorEntityDescription(
key="storage_load_consumption_solar_storage",
translation_key="storage_load_consumption_solar_storage",
api_key="rateVA",
native_unit_of_measurement="VA",
state_class=SensorStateClass.MEASUREMENT,
),
GrowattSensorEntityDescription(
key="storage_charge_today",
translation_key="storage_charge_today",
api_key="eChargeToday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
GrowattSensorEntityDescription(
key="storage_import_from_grid",
translation_key="storage_import_from_grid",
api_key="pAcInPut",
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
GrowattSensorEntityDescription(
key="storage_import_from_grid_today",
translation_key="storage_import_from_grid_today",
api_key="eToUserToday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
GrowattSensorEntityDescription(
key="storage_import_from_grid_total",
Expand All @@ -137,13 +148,15 @@
api_key="outPutPower",
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
GrowattSensorEntityDescription(
key="storage_grid_voltage",
translation_key="storage_grid_voltage",
api_key="vGrid",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -152,6 +165,7 @@
api_key="vpv",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -160,6 +174,7 @@
api_key="freqOutPut",
native_unit_of_measurement=UnitOfFrequency.HERTZ,
device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -168,6 +183,7 @@
api_key="outPutVolt",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -176,6 +192,7 @@
api_key="freqGrid",
native_unit_of_measurement=UnitOfFrequency.HERTZ,
device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -184,6 +201,7 @@
api_key="iAcCharge",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -192,6 +210,7 @@
api_key="iChargePV1",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -200,6 +219,7 @@
api_key="chgCurr",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -208,6 +228,7 @@
api_key="outPutCurrent",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -216,6 +237,7 @@
api_key="vBat",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
GrowattSensorEntityDescription(
Expand All @@ -224,6 +246,7 @@
api_key="loadPercent",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.BATTERY,
state_class=SensorStateClass.MEASUREMENT,
precision=2,
),
)

0 comments on commit bd4ef4b

Please sign in to comment.