Home Assistant Unofficial Reference 2024.12.1
storage.py
Go to the documentation of this file.
1 """Growatt Sensor definitions for the Storage type."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
6 from homeassistant.const import (
7  PERCENTAGE,
8  UnitOfElectricCurrent,
9  UnitOfElectricPotential,
10  UnitOfEnergy,
11  UnitOfFrequency,
12  UnitOfPower,
13 )
14 
15 from .sensor_entity_description import GrowattSensorEntityDescription
16 
17 STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
19  key="storage_storage_production_today",
20  translation_key="storage_storage_production_today",
21  api_key="eBatDisChargeToday",
22  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
23  device_class=SensorDeviceClass.ENERGY,
24  state_class=SensorStateClass.TOTAL_INCREASING,
25  ),
27  key="storage_storage_production_lifetime",
28  translation_key="storage_storage_production_lifetime",
29  api_key="eBatDisChargeTotal",
30  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
31  device_class=SensorDeviceClass.ENERGY,
32  state_class=SensorStateClass.TOTAL,
33  ),
35  key="storage_grid_discharge_today",
36  translation_key="storage_grid_discharge_today",
37  api_key="eacDisChargeToday",
38  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
39  device_class=SensorDeviceClass.ENERGY,
40  state_class=SensorStateClass.TOTAL_INCREASING,
41  ),
43  key="storage_grid_discharge_lifetime",
44  translation_key="storage_grid_discharge_lifetime",
45  api_key="eacDisChargeTotal",
46  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
47  device_class=SensorDeviceClass.ENERGY,
48  state_class=SensorStateClass.TOTAL,
49  ),
51  key="storage_load_consumption_today",
52  translation_key="storage_load_consumption_today",
53  api_key="eopDischrToday",
54  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
55  device_class=SensorDeviceClass.ENERGY,
56  state_class=SensorStateClass.TOTAL_INCREASING,
57  ),
59  key="storage_load_consumption_lifetime",
60  translation_key="storage_load_consumption_lifetime",
61  api_key="eopDischrTotal",
62  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
63  device_class=SensorDeviceClass.ENERGY,
64  state_class=SensorStateClass.TOTAL,
65  ),
67  key="storage_grid_charged_today",
68  translation_key="storage_grid_charged_today",
69  api_key="eacChargeToday",
70  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
71  device_class=SensorDeviceClass.ENERGY,
72  state_class=SensorStateClass.TOTAL_INCREASING,
73  ),
75  key="storage_grid_charged_lifetime",
76  translation_key="storage_grid_charged_lifetime",
77  api_key="eacChargeTotal",
78  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
79  device_class=SensorDeviceClass.ENERGY,
80  state_class=SensorStateClass.TOTAL,
81  ),
83  key="storage_charge_storage_lifetime",
84  translation_key="storage_charge_storage_lifetime",
85  api_key="eChargeTotal",
86  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
87  device_class=SensorDeviceClass.ENERGY,
88  state_class=SensorStateClass.TOTAL,
89  ),
91  key="storage_solar_output_today",
92  translation_key="storage_solar_output_today",
93  api_key="epvToday",
94  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
95  device_class=SensorDeviceClass.ENERGY,
96  state_class=SensorStateClass.TOTAL_INCREASING,
97  ),
99  key="storage_solar_output_lifetime",
100  translation_key="storage_solar_output_lifetime",
101  api_key="epvTotal",
102  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
103  device_class=SensorDeviceClass.ENERGY,
104  state_class=SensorStateClass.TOTAL,
105  ),
107  key="storage_solar_production",
108  translation_key="storage_solar_production",
109  api_key="ppv",
110  native_unit_of_measurement=UnitOfPower.WATT,
111  device_class=SensorDeviceClass.POWER,
112  state_class=SensorStateClass.MEASUREMENT,
113  ),
115  key="storage_solar_production_2",
116  translation_key="storage_solar_production_2",
117  api_key="ppv2",
118  native_unit_of_measurement=UnitOfPower.WATT,
119  device_class=SensorDeviceClass.POWER,
120  state_class=SensorStateClass.MEASUREMENT,
121  ),
123  key="storage_battery_percentage",
124  translation_key="storage_battery_percentage",
125  api_key="capacity",
126  native_unit_of_measurement=PERCENTAGE,
127  device_class=SensorDeviceClass.BATTERY,
128  state_class=SensorStateClass.MEASUREMENT,
129  ),
131  key="storage_power_flow",
132  translation_key="storage_power_flow",
133  api_key="pCharge",
134  native_unit_of_measurement=UnitOfPower.WATT,
135  device_class=SensorDeviceClass.POWER,
136  state_class=SensorStateClass.MEASUREMENT,
137  ),
139  key="storage_load_consumption_solar_storage",
140  translation_key="storage_load_consumption_solar_storage",
141  api_key="rateVA",
142  native_unit_of_measurement="VA",
143  state_class=SensorStateClass.MEASUREMENT,
144  ),
146  key="storage_charge_today",
147  translation_key="storage_charge_today",
148  api_key="eChargeToday",
149  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
150  device_class=SensorDeviceClass.ENERGY,
151  state_class=SensorStateClass.TOTAL_INCREASING,
152  ),
154  key="storage_import_from_grid",
155  translation_key="storage_import_from_grid",
156  api_key="pAcInPut",
157  native_unit_of_measurement=UnitOfPower.WATT,
158  device_class=SensorDeviceClass.POWER,
159  state_class=SensorStateClass.MEASUREMENT,
160  ),
162  key="storage_import_from_grid_today",
163  translation_key="storage_import_from_grid_today",
164  api_key="eToUserToday",
165  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
166  device_class=SensorDeviceClass.ENERGY,
167  state_class=SensorStateClass.TOTAL_INCREASING,
168  ),
170  key="storage_import_from_grid_total",
171  translation_key="storage_import_from_grid_total",
172  api_key="eToUserTotal",
173  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
174  device_class=SensorDeviceClass.ENERGY,
175  state_class=SensorStateClass.TOTAL,
176  ),
178  key="storage_load_consumption",
179  translation_key="storage_load_consumption",
180  api_key="outPutPower",
181  native_unit_of_measurement=UnitOfPower.WATT,
182  device_class=SensorDeviceClass.POWER,
183  state_class=SensorStateClass.MEASUREMENT,
184  ),
186  key="storage_grid_voltage",
187  translation_key="storage_grid_voltage",
188  api_key="vGrid",
189  native_unit_of_measurement=UnitOfElectricPotential.VOLT,
190  device_class=SensorDeviceClass.VOLTAGE,
191  state_class=SensorStateClass.MEASUREMENT,
192  precision=2,
193  ),
195  key="storage_pv_charging_voltage",
196  translation_key="storage_pv_charging_voltage",
197  api_key="vpv",
198  native_unit_of_measurement=UnitOfElectricPotential.VOLT,
199  device_class=SensorDeviceClass.VOLTAGE,
200  state_class=SensorStateClass.MEASUREMENT,
201  precision=2,
202  ),
204  key="storage_pv_charging_voltage_2",
205  translation_key="storage_pv_charging_voltage_2",
206  api_key="vpv2",
207  native_unit_of_measurement=UnitOfElectricPotential.VOLT,
208  device_class=SensorDeviceClass.VOLTAGE,
209  state_class=SensorStateClass.MEASUREMENT,
210  precision=2,
211  ),
213  key="storage_ac_input_frequency_out",
214  translation_key="storage_ac_input_frequency_out",
215  api_key="freqOutPut",
216  native_unit_of_measurement=UnitOfFrequency.HERTZ,
217  device_class=SensorDeviceClass.FREQUENCY,
218  state_class=SensorStateClass.MEASUREMENT,
219  precision=2,
220  ),
222  key="storage_output_voltage",
223  translation_key="storage_output_voltage",
224  api_key="outPutVolt",
225  native_unit_of_measurement=UnitOfElectricPotential.VOLT,
226  device_class=SensorDeviceClass.VOLTAGE,
227  state_class=SensorStateClass.MEASUREMENT,
228  precision=2,
229  ),
231  key="storage_ac_output_frequency",
232  translation_key="storage_ac_output_frequency",
233  api_key="freqGrid",
234  native_unit_of_measurement=UnitOfFrequency.HERTZ,
235  device_class=SensorDeviceClass.FREQUENCY,
236  state_class=SensorStateClass.MEASUREMENT,
237  precision=2,
238  ),
240  key="storage_current_PV",
241  translation_key="storage_current_pv",
242  api_key="iAcCharge",
243  native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
244  device_class=SensorDeviceClass.CURRENT,
245  state_class=SensorStateClass.MEASUREMENT,
246  precision=2,
247  ),
249  key="storage_current_1",
250  translation_key="storage_current_1",
251  api_key="iChargePV1",
252  native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
253  device_class=SensorDeviceClass.CURRENT,
254  state_class=SensorStateClass.MEASUREMENT,
255  precision=2,
256  ),
258  key="storage_current_2",
259  translation_key="storage_current_2",
260  api_key="iChargePV2",
261  native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
262  device_class=SensorDeviceClass.CURRENT,
263  state_class=SensorStateClass.MEASUREMENT,
264  precision=2,
265  ),
267  key="storage_grid_amperage_input",
268  translation_key="storage_grid_amperage_input",
269  api_key="chgCurr",
270  native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
271  device_class=SensorDeviceClass.CURRENT,
272  state_class=SensorStateClass.MEASUREMENT,
273  precision=2,
274  ),
276  key="storage_grid_out_current",
277  translation_key="storage_grid_out_current",
278  api_key="outPutCurrent",
279  native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
280  device_class=SensorDeviceClass.CURRENT,
281  state_class=SensorStateClass.MEASUREMENT,
282  precision=2,
283  ),
285  key="storage_battery_voltage",
286  translation_key="storage_battery_voltage",
287  api_key="vBat",
288  native_unit_of_measurement=UnitOfElectricPotential.VOLT,
289  device_class=SensorDeviceClass.VOLTAGE,
290  state_class=SensorStateClass.MEASUREMENT,
291  precision=2,
292  ),
294  key="storage_load_percentage",
295  translation_key="storage_load_percentage",
296  api_key="loadPercent",
297  native_unit_of_measurement=PERCENTAGE,
298  device_class=SensorDeviceClass.BATTERY,
299  state_class=SensorStateClass.MEASUREMENT,
300  precision=2,
301  ),
302 )