giachello / mlgw

This components integrates Bang & Olufsen Master Link Gateway and Beolink Gateway to Home Assistant, the open-source home automation platform.
28 stars 6 forks source link

Remove deprecated use of discovery_info and superfluous sleep calls in networking stack #15

Closed giachello closed 2 years ago

astrandb commented 2 years ago

PR #17 fixes the deprecations. I have looked at the use of timer.sleep() but I have not found any simple fix yet. There are no performance problems in my systems but it would of course nice to get rid of the warnings. So not maximum priority to fix, but I can continue to try. Or have you @giachello any ideas?

giachello commented 2 years ago

There must be a way to fix it, using some form of async sleep call or a different structure. the calls are required -- the code is flaky without some wait times. will look into it in the weekend.

astrandb commented 2 years ago

time.sleep is called in 5 places in gateway.py I removed the problem in two places in gateway.py by changing def ml_connect to async defand await gateway.mlconnect() in a few places. Delays are handled by asyncio.sleep().

I have not tested that everything works though.

Remaining calls of time.sleep() remain...

giachello commented 2 years ago

v2022.5.1 fixes all this. Thank you @astrandb !!!