Skip to content

Add proper exception handling for sockets, properly close them.

Johnnie Ho requested to merge Silvest/python-yeelight-asyncio:master into master

Since we cannot fully trust on proper implementation of sockets on the Yeelight firmwares. Sockets should be properly closed. (According to specs they support max 4 connections) So it's easy to have dangling connections which causes bulb availability. Easy to test by just telnetting and keep connections open. The fifth connection would just fail. So it is better to properly close sockets since we don't maintain the firmware code and be depending of the Yeelight Team.

I also add timeouts since after extensive testing, get_prop most of the time gets stuck waiting for response. All other commands works fine even when get_prop is not.

Further more I use SSDP as a fallback should get_prop fail (this happens in some of the latest beta firmwares). This should also fix the bulbs availability in HA.

All my bulbs color4, ceiling10, ceiling20, bslamp2 have zero problems ever since.

Merge request reports