Home Assistant Unofficial Reference 2024.12.1
inverter.py
Go to the documentation of this file.
1 """SunWEG Sensor definitions for the Inverter type."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
6 from homeassistant.const import (
7  UnitOfEnergy,
8  UnitOfFrequency,
9  UnitOfPower,
10  UnitOfTemperature,
11 )
12 
13 from .sensor_entity_description import SunWEGSensorEntityDescription
14 
15 INVERTER_SENSOR_TYPES: tuple[SunWEGSensorEntityDescription, ...] = (
17  key="inverter_energy_today",
18  name="Energy today",
19  api_variable_key="_today_energy",
20  api_variable_unit="_today_energy_metric",
21  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
22  device_class=SensorDeviceClass.ENERGY,
23  state_class=SensorStateClass.TOTAL_INCREASING,
24  suggested_display_precision=1,
25  ),
27  key="inverter_energy_total",
28  name="Lifetime energy output",
29  api_variable_key="_total_energy",
30  api_variable_unit="_total_energy_metric",
31  native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
32  device_class=SensorDeviceClass.ENERGY,
33  suggested_display_precision=1,
34  state_class=SensorStateClass.TOTAL,
35  never_resets=True,
36  ),
38  key="inverter_frequency",
39  name="AC frequency",
40  api_variable_key="_frequency",
41  native_unit_of_measurement=UnitOfFrequency.HERTZ,
42  device_class=SensorDeviceClass.FREQUENCY,
43  suggested_display_precision=1,
44  ),
46  key="inverter_current_wattage",
47  name="Output power",
48  api_variable_key="_power",
49  api_variable_unit="_power_metric",
50  native_unit_of_measurement=UnitOfPower.WATT,
51  device_class=SensorDeviceClass.POWER,
52  state_class=SensorStateClass.MEASUREMENT,
53  suggested_display_precision=1,
54  ),
56  key="inverter_temperature",
57  name="Temperature",
58  api_variable_key="_temperature",
59  native_unit_of_measurement=UnitOfTemperature.CELSIUS,
60  device_class=SensorDeviceClass.TEMPERATURE,
61  icon="mdi:temperature-celsius",
62  suggested_display_precision=1,
63  ),
65  key="inverter_power_factor",
66  name="Power Factor",
67  api_variable_key="_power_factor",
68  suggested_display_precision=1,
69  ),
70 )