Skip to content

Commit 953a6be

Browse files
committed
small enhancements to possible 401 @ wallbox search requests (even if session is authorized) - when this happens during initial-startup this will be some sort of fatal - so logging this as ERROR now
1 parent fb317ab commit 953a6be

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

custom_components/senec/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
"iot_class": "local_polling",
1616
"issue_tracker": "https://github.com/marq24/ha-senec-v3/issues",
1717
"requirements": ["pyotp>=2.8.0", "xmltodict>=0.13.0", "packaging>=21.0", "python-dateutil>=2.8.0"],
18-
"version": "2026.5.3"
18+
"version": "2026.5.4"
1919
}

custom_components/senec/pysenec_ha/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,14 +4213,17 @@ async def _app_do_post_request(self, a_url:str, post_data: dict, read_response:
42134213
if res is not None:
42144214
if res.status == 408:
42154215
_LOGGER.info(f"_app_do_post_request(): http status 408 while access {a_url}")
4216+
elif self.is_integration_startup_phase:
4217+
_LOGGER.error(f"_app_do_post_request(): Error while access {a_url}: [Exception: {exc}] - [Response: {res}]")
42164218
else:
4217-
_LOGGER.warning(f"_app_do_post_request(): Error while access {a_url}: [Exception: {exc}] - [Response: {res}]")
4219+
_LOGGER.info(f"_app_do_post_request(): Error while access {a_url}: [Exception: {exc}] - [Response: {res}]")
42184220
else:
42194221
_LOGGER.warning(f"_app_do_post_request(): Error while access {a_url}: [Exception: {exc}]")
42204222
except Exception as exc:
42214223
_LOGGER.warning(f"_app_do_post_request(): Error when try to call {a_url}: [Exception: {exc}]")
42224224
else:
42234225
_LOGGER.warning(f"_app_do_post_request(): 'self._app_is_authenticated' is False")
4226+
42244227
return False
42254228

42264229
# async def app_post_data(self, a_url: str, post_data: dict, read_response: bool = False) -> bool:
@@ -5353,9 +5356,14 @@ async def app_update_all_wallboxes(self):
53535356
# Check if data is valid and has content
53545357
if not data or not isinstance(data, list):
53555358
if self.is_integration_startup_phase:
5356-
_LOGGER.debug(f"app_update_all_wallboxes(): No valid wallbox data received or data is not a list '{data}'")
5359+
if data is False:
5360+
_LOGGER.error(f"app_update_all_wallboxes(): Senec backend probably respond wih HTTP-status 401 to the initial wallbox search - this will cause fatal issues during restart - please check yor provided credentials and restart the integration!")
5361+
else:
5362+
_LOGGER.warning(f"app_update_all_wallboxes(): No valid wallbox data received or data is not a list '{data}'")
53575363
else:
5358-
_LOGGER.warning(f"app_update_all_wallboxes(): No valid wallbox data received or data is not a list '{data}'")
5364+
_LOGGER.debug(f"app_update_all_wallboxes(): No valid wallbox data received or data is not a list '{data}'")
5365+
5366+
# we do not update any data in our 'self._app_raw_wallbox[idx]' object (so we keep the old wallbox data)
53595367
return
53605368
else:
53615369
if self.is_integration_startup_phase:

custom_components/senec/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry,
5353
elif CONF_TYPE in config_entry.data and config_entry.data[CONF_TYPE] == CONF_SYSTYPE_WEB:
5454
for description in WEB_SENSOR_TYPES:
5555
# when we have wallbox data, we want to enable the entity by default...
56-
if description.key.startswith("wallbox"):
56+
if description.key.startswith("wallbox") and description.key != "wallbox_consumption_total":
5757
possible_idx_str = description.key.lower().split('_')[1]
5858
try:
5959
idx = int(possible_idx_str) - 1

custom_components/senec/switch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry,
3535
elif CONF_TYPE in config_entry.data and config_entry.data[CONF_TYPE] == CONF_SYSTYPE_WEB:
3636
for description in WEB_SWITCH_TYPES:
3737
# when we have wallbox data, we want to enable the entity by default...
38-
if description.key.startswith("wallbox"):
38+
if description.key.startswith("wallbox") and description.key != "wallbox_allow_intercharge":
3939
possible_idx_str = description.key.lower().split('_')[1]
4040
try:
4141
idx = int(possible_idx_str) - 1

0 commit comments

Comments
 (0)