fsaris / home-assistant-awox

AwoX mesh light integration for Home Assistant
MIT License
83 stars 23 forks source link

Support remote BT Adapters #86

Closed tbe closed 1 year ago

tbe commented 1 year ago

Currently, this integration directly uses bluetooth utilities and pygatt. This prevents the usage of remote adapters like ESPHome BT Proxy.

Instead this integration should use bleak instead for all components. A quick look at the "failed" beta showed, that while discovery was made with Bleak, connection handling was not, which may have let to the instability issues.

fsaris commented 1 year ago

AwoX BLE mesh doesn't respect the BLE standards and doesn't work with bleak. And due to that it can not work with the HA Bluetooth component.

I start working on a esphome based component to replace this integration https://github.com/fsaris/EspHome-AwoX-BLE-mesh-hub

tbe commented 1 year ago

@fsaris , do you have some more details about "doesn't respect the BLE standards" ? I had a look at both codebases. While i'm not a python guy, i speak C++ pretty well and i don't see any out of the ordinary there.

fsaris commented 1 year ago

The notification characteristics handle is wrong.

See https://github.com/hbldh/bleak/issues/972#issuecomment-1239715515

Maybe you can circumvent this by only using remote BT adapters. Not sure if that is possible in HA. But I can recommend to switch to a dedicated device that performs all communication with the mesh devices. In my current tests the BT connection is much more stable then when going through HA and sharing it with other processes.

In one of the next days I expect to add support for other devices then only RGBW lights to https://github.com/fsaris/EspHome-AwoX-BLE-mesh-hub it's still in POC state but is already more stable then this integration and also more responsive. No freezing BT connections after a few hours etc.

(Please do not look to closely at the code ;) it's still work in progress and mainly a collection of trail and error. Once I found all the missing pieces regarding communication with the mesh it will be restructured)