diff --git a/custom_components/senec/const.py b/custom_components/senec/const.py index c0aaac1..a6acbf9 100644 --- a/custom_components/senec/const.py +++ b/custom_components/senec/const.py @@ -545,46 +545,6 @@ class ExtNumberEntityDescription(NumberEntityDescription): icon="mdi:battery", icon_off="mdi:battery-off", ), - ExtSwitchEntityDescription( - senec_lala_section=SENEC_SECTION_WALLBOX, - entity_registry_enabled_default=False, - array_key="wallbox_prohibit_usage", - array_pos=0, - inverted=True, - key="wallbox_1_prohibit_usage", - name="wallbox_1_prohibit_usage", - icon="mdi:toggle-switch", - ), - ExtSwitchEntityDescription( - senec_lala_section=SENEC_SECTION_WALLBOX, - entity_registry_enabled_default=False, - array_key="wallbox_prohibit_usage", - array_pos=1, - inverted=True, - key="wallbox_2_prohibit_usage", - name="wallbox_2_prohibit_usage", - icon="mdi:toggle-switch", - ), - ExtSwitchEntityDescription( - senec_lala_section=SENEC_SECTION_WALLBOX, - entity_registry_enabled_default=False, - array_key="wallbox_prohibit_usage", - array_pos=2, - inverted=True, - key="wallbox_3_prohibit_usage", - name="wallbox_3_prohibit_usage", - icon="mdi:toggle-switch", - ), - ExtSwitchEntityDescription( - senec_lala_section=SENEC_SECTION_WALLBOX, - entity_registry_enabled_default=False, - array_key="wallbox_prohibit_usage", - array_pos=3, - inverted=True, - key="wallbox_4_prohibit_usage", - name="wallbox_4_prohibit_usage", - icon="mdi:toggle-switch", - ), # SOCKETS PERMANENT ON ExtSwitchEntityDescription( @@ -791,6 +751,47 @@ class ExtNumberEntityDescription(NumberEntityDescription): icon_off="mdi:toggle-switch-off", entity_category=EntityCategory.DIAGNOSTIC, ), + ExtBinarySensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + array_key="wallbox_prohibit_usage", + array_pos=0, + key="wallbox_1_prohibit_usage", + name="wallbox_1_prohibit_usage", + icon="mdi:toggle-switch", + icon_off="mdi:toggle-switch-off", + ), + ExtBinarySensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + array_key="wallbox_prohibit_usage", + array_pos=1, + key="wallbox_2_prohibit_usage", + name="wallbox_2_prohibit_usage", + icon="mdi:toggle-switch", + icon_off="mdi:toggle-switch-off", + ), + ExtBinarySensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + array_key="wallbox_prohibit_usage", + array_pos=2, + key="wallbox_3_prohibit_usage", + name="wallbox_3_prohibit_usage", + icon="mdi:toggle-switch", + icon_off="mdi:toggle-switch-off", + ), + + ExtBinarySensorEntityDescription( + senec_lala_section=SENEC_SECTION_WALLBOX, + entity_registry_enabled_default=False, + array_key="wallbox_prohibit_usage", + array_pos=3, + key="wallbox_4_prohibit_usage", + name="wallbox_4_prohibit_usage", + icon="mdi:toggle-switch", + icon_off="mdi:toggle-switch-off", + ), ExtBinarySensorEntityDescription( senec_lala_section=SENEC_SECTION_FAN_SPEED, entity_registry_enabled_default=False, diff --git a/custom_components/senec/pysenec_ha/__init__.py b/custom_components/senec/pysenec_ha/__init__.py index 1afd6bc..e714f92 100644 --- a/custom_components/senec/pysenec_ha/__init__.py +++ b/custom_components/senec/pysenec_ha/__init__.py @@ -1766,18 +1766,20 @@ async def switch_array_smart_charge_active(self, pos: int, value: int): def wallbox_prohibit_usage(self) -> [int]: return self.read_array_data(SENEC_SECTION_WALLBOX, "PROHIBIT_USAGE") - async def switch_array_wallbox_prohibit_usage(self, pos: int, value: bool, sync: bool = True): - mode = None - if value: - mode = APP_API_WEB_MODE_LOCKED - else: - mode = APP_API_WEB_MODE_SSGCM - if IntBridge.app_api._app_last_wallbox_modes[pos] is not None: - mode = IntBridge.app_api._app_last_wallbox_modes[pos] - - await self._set_wallbox_mode_post(pos=pos, mode_to_set_in_lc=mode) - if sync and IntBridge.avail(): - await IntBridge.app_api.app_set_wallbox_mode(mode_to_set_in_lc=mode, wallbox_num=(pos + 1), sync=False) + # async def switch_array_wallbox_prohibit_usage(self, pos: int, value: bool, sync: bool = True): + # mode = None + # if value: + # mode = APP_API_WEB_MODE_LOCKED + # else: + # mode = APP_API_WEB_MODE_SSGCM + # if IntBridge.app_api._app_last_wallbox_modes_lc[pos] is not None: + # mode = IntBridge.app_api._app_last_wallbox_modes_lc[pos] + # elif IntBridge.app_api._app_raw_wallbox[pos] is not None: + # pass + # + # await self._set_wallbox_mode_post(pos=pos, mode_to_set_in_lc=mode) + # if sync and IntBridge.avail(): + # await IntBridge.app_api.app_set_wallbox_mode(mode_to_set_in_lc=mode, wallbox_num=(pos + 1), sync=False) def read_array_data(self, section_key: str, array_values_key) -> []: if hasattr(self, '_raw') and section_key in self._raw and array_values_key in self._raw[section_key]: @@ -2330,7 +2332,7 @@ def __init__(self, user, pwd, web_session, master_plant_number: int = 0, options self._app_token = None self._app_master_plant_id = None self._app_raw_wallbox = [None, None, None, None] - self._app_last_wallbox_modes = [None, None, None, None] + #self._app_last_wallbox_modes_lc = [None, None, None, None] self._app_wallbox_num_max = 4 IntBridge.app_api = self @@ -2585,10 +2587,10 @@ async def app_set_wallbox_mode(self, mode_to_set_in_lc: str, wallbox_num: int = if self._app_raw_wallbox[idx] is not None: cur_mode = self._app_raw_wallbox[idx]["chargingMode"].lower() # if the NEW mode will be the LOCKED mode we will keep/store the previous active mode - if mode_to_set_in_lc == APP_API_WEB_MODE_LOCKED: - self._app_last_wallbox_modes[idx] = cur_mode - else: - self._app_last_wallbox_modes[idx] = None + #if mode_to_set_in_lc == APP_API_WEB_MODE_LOCKED: + # self._app_last_wallbox_modes_lc[idx] = cur_mode + #else: + # self._app_last_wallbox_modes_lc[idx] = None else: cur_mode = "unknown" diff --git a/custom_components/senec/strings.json b/custom_components/senec/strings.json index a1cb84d..f3bdb41 100644 --- a/custom_components/senec/strings.json +++ b/custom_components/senec/strings.json @@ -44,18 +44,6 @@ "wallbox_allow_intercharge": { "name": "Wallbox load from battery" }, - "wallbox_1_prohibit_usage": { - "name": "Wallbox I activated" - }, - "wallbox_2_prohibit_usage": { - "name": "Wallbox II activated" - }, - "wallbox_3_prohibit_usage": { - "name": "Wallbox III activated" - }, - "wallbox_4_prohibit_usage": { - "name": "Wallbox IV activated" - }, "sockets_1_force_on": { "name": "Socket1 permanent on" }, @@ -223,6 +211,18 @@ "wallbox_4_smart_charge_active": { "name": "Wallbox IV Smart-Charge active" }, + "wallbox_1_prohibit_usage": { + "name": "Wallbox I locked" + }, + "wallbox_2_prohibit_usage": { + "name": "Wallbox II locked" + }, + "wallbox_3_prohibit_usage": { + "name": "Wallbox III locked" + }, + "wallbox_4_prohibit_usage": { + "name": "Wallbox IV locked" + }, "fan_inv_lv": { "name": "Fan LV-Inverter" }, diff --git a/custom_components/senec/translations/de.json b/custom_components/senec/translations/de.json index e750e62..7b44c41 100644 --- a/custom_components/senec/translations/de.json +++ b/custom_components/senec/translations/de.json @@ -129,18 +129,6 @@ "wallbox_allow_intercharge": { "name": "Wallbox laden aus Speicher" }, - "wallbox_1_prohibit_usage": { - "name": "Wallbox I aktiv" - }, - "wallbox_2_prohibit_usage": { - "name": "Wallbox II aktiv" - }, - "wallbox_3_prohibit_usage": { - "name": "Wallbox III aktiv" - }, - "wallbox_4_prohibit_usage": { - "name": "Wallbox IV aktiv" - }, "sockets_1_force_on": { "name": "Kontakt1 permanent ein" }, @@ -308,6 +296,18 @@ "wallbox_4_smart_charge_active": { "name": "Wallbox IV Smart-Charge aktiv" }, + "wallbox_1_prohibit_usage": { + "name": "Wallbox I gesperrt" + }, + "wallbox_2_prohibit_usage": { + "name": "Wallbox II gesperrt" + }, + "wallbox_3_prohibit_usage": { + "name": "Wallbox III gesperrt" + }, + "wallbox_4_prohibit_usage": { + "name": "Wallbox IV gesperrt" + }, "fan_inv_lv": { "name": "Lüfter LV-Inverter" }, diff --git a/custom_components/senec/translations/en.json b/custom_components/senec/translations/en.json index 75b67c6..361211e 100644 --- a/custom_components/senec/translations/en.json +++ b/custom_components/senec/translations/en.json @@ -129,18 +129,6 @@ "wallbox_allow_intercharge": { "name": "Wallbox load from battery" }, - "wallbox_1_prohibit_usage": { - "name": "Wallbox I activated" - }, - "wallbox_2_prohibit_usage": { - "name": "Wallbox II activated" - }, - "wallbox_3_prohibit_usage": { - "name": "Wallbox III activated" - }, - "wallbox_4_prohibit_usage": { - "name": "Wallbox IV activated" - }, "sockets_1_force_on": { "name": "Socket1 permanent on" }, @@ -308,6 +296,18 @@ "wallbox_4_smart_charge_active": { "name": "Wallbox IV Smart-Charge active" }, + "wallbox_1_prohibit_usage": { + "name": "Wallbox I locked" + }, + "wallbox_2_prohibit_usage": { + "name": "Wallbox II locked" + }, + "wallbox_3_prohibit_usage": { + "name": "Wallbox III locked" + }, + "wallbox_4_prohibit_usage": { + "name": "Wallbox IV locked" + }, "fan_inv_lv": { "name": "Fan LV-Inverter" },