From ce5a82b128e47fd900136db0d1844cf578e6fae4 Mon Sep 17 00:00:00 2001 From: marq24 Date: Mon, 2 Oct 2023 12:24:11 +0200 Subject: [PATCH] added 'wallbox_min_charging_current' & 'wallbox_set_icmax' --- custom_components/senec/const.py | 80 +++++++++++++++++++ .../senec/pysenec_ha/__init__.py | 52 +++++++++++- 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/custom_components/senec/const.py b/custom_components/senec/const.py index 6f81ad6..5a39440 100644 --- a/custom_components/senec/const.py +++ b/custom_components/senec/const.py @@ -1847,6 +1847,26 @@ class ExtBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.MEASUREMENT, ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_min_charging_current", + name="Wallbox MIN charging current", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_set_icmax", + name="Wallbox set ICMAX", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), ExtSensorEntityDescription( senec_lala_section=SENEC_SECTION_WALLBOX, @@ -1906,6 +1926,26 @@ class ExtBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.MEASUREMENT, ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_2_min_charging_current", + name="Wallbox II MIN charging current", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_2_set_icmax", + name="Wallbox II set ICMAX", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), ExtSensorEntityDescription( senec_lala_section=SENEC_SECTION_WALLBOX, @@ -1965,6 +2005,26 @@ class ExtBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.MEASUREMENT, ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_3_min_charging_current", + name="Wallbox III MIN charging current", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_3_set_icmax", + name="Wallbox III set ICMAX", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), ExtSensorEntityDescription( senec_lala_section=SENEC_SECTION_WALLBOX, @@ -2024,6 +2084,26 @@ class ExtBinarySensorEntityDescription(BinarySensorEntityDescription): device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.MEASUREMENT, ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_4_min_charging_current", + name="Wallbox IV MIN charging current", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), + ExtSensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + key="wallbox_4_set_icmax", + name="Wallbox IV set ICMAX", + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + icon="mdi:current-dc", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.MEASUREMENT, + ), ] INVERTER_SENSOR_TYPES = [ diff --git a/custom_components/senec/pysenec_ha/__init__.py b/custom_components/senec/pysenec_ha/__init__.py index e58f025..3cae110 100644 --- a/custom_components/senec/pysenec_ha/__init__.py +++ b/custom_components/senec/pysenec_ha/__init__.py @@ -1066,6 +1066,18 @@ def wallbox_l3_charging_current(self) -> float: SENEC_SECTION_WALLBOX]: return self._raw[SENEC_SECTION_WALLBOX]["L3_CHARGING_CURRENT"][0] + @property + def wallbox_min_charging_current(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "MIN_CHARGING_CURRENT" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["MIN_CHARGING_CURRENT"][0] + + @property + def wallbox_set_icmax(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "SET_ICMAX" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["SET_ICMAX"][0] + @property def wallbox_2_power(self) -> float: """ @@ -1142,6 +1154,18 @@ def wallbox_2_l3_charging_current(self) -> float: SENEC_SECTION_WALLBOX]: return self._raw[SENEC_SECTION_WALLBOX]["L3_CHARGING_CURRENT"][1] + @property + def wallbox_2_min_charging_current(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "MIN_CHARGING_CURRENT" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["MIN_CHARGING_CURRENT"][1] + + @property + def wallbox_2_set_icmax(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "SET_ICMAX" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["SET_ICMAX"][1] + @property def wallbox_3_power(self) -> float: """ @@ -1218,6 +1242,18 @@ def wallbox_3_l3_charging_current(self) -> float: SENEC_SECTION_WALLBOX]: return self._raw[SENEC_SECTION_WALLBOX]["L3_CHARGING_CURRENT"][2] + @property + def wallbox_3_min_charging_current(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "MIN_CHARGING_CURRENT" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["MIN_CHARGING_CURRENT"][2] + + @property + def wallbox_3_set_icmax(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "SET_ICMAX" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["SET_ICMAX"][2] + @property def wallbox_4_power(self) -> float: """ @@ -1294,6 +1330,18 @@ def wallbox_4_l3_charging_current(self) -> float: SENEC_SECTION_WALLBOX]: return self._raw[SENEC_SECTION_WALLBOX]["L3_CHARGING_CURRENT"][3] + @property + def wallbox_4_min_charging_current(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "MIN_CHARGING_CURRENT" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["MIN_CHARGING_CURRENT"][3] + + @property + def wallbox_4_set_icmax(self) -> float: + if hasattr(self, '_raw') and SENEC_SECTION_WALLBOX in self._raw and "SET_ICMAX" in self._raw[ + SENEC_SECTION_WALLBOX]: + return self._raw[SENEC_SECTION_WALLBOX]["SET_ICMAX"][3] + @property def fan_inv_lv(self) -> bool: if hasattr(self, '_raw') and SENEC_SECTION_FAN_SPEED in self._raw and "INV_LV" in self._raw[ @@ -1411,7 +1459,9 @@ async def read_senec_v31(self): "L2_USED": "", "L3_CHARGING_CURRENT": "", "L3_USED": "", - "EV_CONNECTED": ""} + "EV_CONNECTED": "", + "MIN_CHARGING_CURRENT": "", + "SET_ICMAX": ""} }) async with self.websession.post(self.url, json=form, ssl=False) as res: