py-electrolux-ocp
py-electrolux-ocp copied to clipboard
Blocking await
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
Thanks for your support
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
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.
I'll try to create a separate task as hinted thanks