Skip to content

Commit

Permalink
Do reconnect/reload only for affected interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ committed Nov 17, 2024
1 parent 9cf3fb9 commit 8aad75d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 2024.11.2 (2024-11-15)

- Add get_data_point_path to central
- Do reconnect/reload only for affected interfaces
- Ignore unknown interfaces
- Remove clients for not available interfaces

Expand Down
8 changes: 7 additions & 1 deletion hahomematic/central/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,7 @@ async def _check_connection(self) -> None:
await self._central.restart_clients()
else:
reconnects: list[Any] = []
reloads: list[Any] = []
for interface_id in self._central.interface_ids:
# check:
# - client is available
Expand All @@ -1491,10 +1492,15 @@ async def _check_connection(self) -> None:
or not client.is_callback_alive()
):
reconnects.append(client.reconnect())
reloads.append(
self._central.load_and_refresh_data_point_data(
interface=client.interface
)
)
if reconnects:
await asyncio.gather(*reconnects)
if self._central.available:
await self._central.load_and_refresh_data_point_data()
await asyncio.gather(*reloads)
except NoConnectionException as nex:
_LOGGER.error("CHECK_CONNECTION failed: no connection: %s", reduce_args(args=nex.args))
except Exception as ex:
Expand Down

0 comments on commit 8aad75d

Please sign in to comment.