juanboro / cync2mqtt

Bridge Cync bluetooth mesh to mqtt
38 stars 7 forks source link

Timeout when connecting to CbyGE light bulb #20

Closed harrysummer closed 1 year ago

harrysummer commented 1 year ago

Hi, there. Thanks for this great project that allows me to control my CbyGE light bulbs with Home Assistant. While it failed to connect to my bulb on the initial trial, I did some debugging and found it is the BleakClient.connect that returns timeout even though I can successfully connect with bluez CLI. So I increased the default timeout of 10 to 20:

--- src/acync/mesh.py   2023-09-26 13:48:10.436544329 -0700
+++ ../venv/cync2mqtt/lib/python3.11/site-packages/acync/mesh.py        2023-09-21 23:14:42.019285293 -0700
@@ -136,7 +136,7 @@
             if self.meshmacs[mac]<0: continue
             self.client=BleakClient(mac)
             try:
-                await self.client.connect()
+                await self.client.connect(timeout=20)
             except:
                 self.meshmacs[mac]+=1
                 self.log.info(f"Unable to connect to mesh mac: {mac}")

And it works like a charm now!

juanboro commented 1 year ago

Awesome --- I've updated it in main now. Thanks!