Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do reconnect/reload only for affected interfaces #1849

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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