mirror of https://github.com/home-assistant/core
Growatt server integration add TLX support (#54844)
This commit is contained in:
parent
5a7b894ba8
commit
4a2eeed1e8
|
@ -199,7 +199,7 @@ homeassistant/components/gpsd/* @fabaff
|
|||
homeassistant/components/gree/* @cmroche
|
||||
homeassistant/components/greeneye_monitor/* @jkeljo
|
||||
homeassistant/components/group/* @home-assistant/core
|
||||
homeassistant/components/growatt_server/* @indykoning @muppet3000
|
||||
homeassistant/components/growatt_server/* @indykoning @muppet3000 @JasperPlant
|
||||
homeassistant/components/guardian/* @bachya
|
||||
homeassistant/components/habitica/* @ASMfreaK @leikoilja
|
||||
homeassistant/components/harmony/* @ehendrix23 @bramkragten @bdraco @mkeesey
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/growatt_server/",
|
||||
"requirements": ["growattServer==1.0.1"],
|
||||
"codeowners": ["@indykoning", "@muppet3000"],
|
||||
"codeowners": ["@indykoning", "@muppet3000", "@JasperPlant"],
|
||||
"iot_class": "cloud_polling"
|
||||
}
|
||||
|
|
|
@ -258,6 +258,163 @@ INVERTER_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
|||
),
|
||||
)
|
||||
|
||||
TLX_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_energy_today",
|
||||
name="Energy today",
|
||||
api_key="eacToday",
|
||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_energy_total",
|
||||
name="Lifetime energy output",
|
||||
api_key="eacTotal",
|
||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_energy_total_input_1",
|
||||
name="Lifetime total energy input 1",
|
||||
api_key="epv1Total",
|
||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_voltage_input_1",
|
||||
name="Input 1 voltage",
|
||||
api_key="vpv1",
|
||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||
device_class=DEVICE_CLASS_VOLTAGE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_amperage_input_1",
|
||||
name="Input 1 Amperage",
|
||||
api_key="ipv1",
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
device_class=DEVICE_CLASS_CURRENT,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_wattage_input_1",
|
||||
name="Input 1 Wattage",
|
||||
api_key="ppv1",
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
device_class=DEVICE_CLASS_POWER,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_energy_total_input_2",
|
||||
name="Lifetime total energy input 2",
|
||||
api_key="epv2Total",
|
||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
device_class=DEVICE_CLASS_ENERGY,
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_voltage_input_2",
|
||||
name="Input 2 voltage",
|
||||
api_key="vpv2",
|
||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||
device_class=DEVICE_CLASS_VOLTAGE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_amperage_input_2",
|
||||
name="Input 2 Amperage",
|
||||
api_key="ipv2",
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
device_class=DEVICE_CLASS_CURRENT,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_wattage_input_2",
|
||||
name="Input 2 Wattage",
|
||||
api_key="ppv2",
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
device_class=DEVICE_CLASS_POWER,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_internal_wattage",
|
||||
name="Internal wattage",
|
||||
api_key="ppv",
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
device_class=DEVICE_CLASS_POWER,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_reactive_voltage",
|
||||
name="Reactive voltage",
|
||||
api_key="vacrs",
|
||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||
device_class=DEVICE_CLASS_VOLTAGE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_frequency",
|
||||
name="AC frequency",
|
||||
api_key="fac",
|
||||
native_unit_of_measurement=FREQUENCY_HERTZ,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_current_wattage",
|
||||
name="Output power",
|
||||
api_key="pac",
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
device_class=DEVICE_CLASS_POWER,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_temperature_1",
|
||||
name="Temperature 1",
|
||||
api_key="temp1",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_temperature_2",
|
||||
name="Temperature 2",
|
||||
api_key="temp2",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_temperature_3",
|
||||
name="Temperature 3",
|
||||
api_key="temp3",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_temperature_4",
|
||||
name="Temperature 4",
|
||||
api_key="temp4",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
precision=1,
|
||||
),
|
||||
GrowattSensorEntityDescription(
|
||||
key="tlx_temperature_5",
|
||||
name="Temperature 5",
|
||||
api_key="temp5",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
precision=1,
|
||||
),
|
||||
)
|
||||
|
||||
STORAGE_SENSOR_TYPES: tuple[GrowattSensorEntityDescription, ...] = (
|
||||
GrowattSensorEntityDescription(
|
||||
key="storage_storage_production_today",
|
||||
|
@ -746,6 +903,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
sensor_descriptions = ()
|
||||
if device["deviceType"] == "inverter":
|
||||
sensor_descriptions = INVERTER_SENSOR_TYPES
|
||||
elif device["deviceType"] == "tlx":
|
||||
probe.plant_id = plant_id
|
||||
sensor_descriptions = TLX_SENSOR_TYPES
|
||||
elif device["deviceType"] == "storage":
|
||||
probe.plant_id = plant_id
|
||||
sensor_descriptions = STORAGE_SENSOR_TYPES
|
||||
|
@ -820,7 +980,7 @@ class GrowattData:
|
|||
def update(self):
|
||||
"""Update probe data."""
|
||||
self.api.login(self.username, self.password)
|
||||
_LOGGER.debug("Updating data for %s", self.device_id)
|
||||
_LOGGER.debug("Updating data for %s (%s)", self.device_id, self.growatt_type)
|
||||
try:
|
||||
if self.growatt_type == "total":
|
||||
total_info = self.api.plant_info(self.device_id)
|
||||
|
@ -833,6 +993,9 @@ class GrowattData:
|
|||
elif self.growatt_type == "inverter":
|
||||
inverter_info = self.api.inverter_detail(self.device_id)
|
||||
self.data = inverter_info
|
||||
elif self.growatt_type == "tlx":
|
||||
tlx_info = self.api.tlx_detail(self.device_id)
|
||||
self.data = tlx_info["data"]
|
||||
elif self.growatt_type == "storage":
|
||||
storage_info_detail = self.api.storage_params(self.device_id)[
|
||||
"storageDetailBean"
|
||||
|
|
Loading…
Reference in New Issue