Skip to content

Commit 16c0f4b

Browse files
author
Boris Fersing
committed
Added the .websocket attribute to the API to allow for a smooth transition to the new websocket for challenges without breaking the current HA Hilo code
1 parent 87fb4f9 commit 16c0f4b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pyhilo/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def __init__(
8282
self.session: ClientSession = session
8383
self._oauth_session = oauth_session
8484
self.websocket_devices: WebsocketClient
85+
# Backward compatibility during transition to websocket for challenges. Currently the HA Hilo integration
86+
# uses the .websocket attribute. Re-added this attribute and point to the same object as websocket_devices.
87+
# Should be removed once the transition to the challenge websocket is completed everywhere.
88+
self.websocket: WebsocketClient
8589
self.websocket_challenges: WebsocketClient
8690
self.log_traces = log_traces
8791
self._get_device_callbacks: list[Callable[..., Any]] = []
@@ -380,6 +384,9 @@ async def _async_post_init(self) -> None:
380384
# ic-dev21 need to work on this as it can't lint as is, may need to
381385
# instantiate differently
382386
self.websocket_devices = WebsocketClient(self.websocket_manager.devicehub)
387+
388+
# For backward compatibility during the transition to challengehub websocket
389+
self.websocket = self.websocket_devices
383390
self.websocket_challenges = WebsocketClient(self.websocket_manager.challengehub)
384391

385392
async def refresh_ws_token(self) -> None:

0 commit comments

Comments
 (0)