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

Blocking await #8

Open
albaintor opened this issue Feb 15, 2024 · 3 comments
Open

Blocking await #8

albaintor opened this issue Feb 15, 2024 · 3 comments

Comments

@albaintor
Copy link

Hi,

since this update, the call to "watch_for_appliance_state_updates" blocks and won't return.
So the component initialization is blocked. Before the method would return immediately and the callback would be called at each message received
image

Thanks for your support

@Woyken
Copy link
Owner

Woyken commented Feb 15, 2024

Is this a problem? I can change it back.
You can always start this as a background task on client side.
using asyncio.create_task(watch_for_appliance_state_updates()) instead of calling it directly

But there might be scenarios where websocket listening fails and you would want be informed when watch_for_appliance_state_updates fails or stops.
Then you can call it again, or do some more actions before retrying

@albaintor
Copy link
Author

This is exactly what I wonder : I am facing the same question on another integration.
For electrolux we only want to receive messages on my other integration if I want to send messages I need to know when the websocket connection is initialized before sending any message.

@albaintor
Copy link
Author

I'll try to create a separate task as hinted thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants