Skip to content

Commit

Permalink
add delay for testing on candela
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoohb committed Aug 2, 2022
1 parent f5243f2 commit 0c6d211
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/yeelight_bt/yeelightbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# 3rd party imports
from bleak import BleakClient, BleakError

BLEAK_TIMEOUT = 10

NOTIFY_UUID = "8f65073d-9f57-4aaa-afea-397d19d5bbeb"
CONTROL_UUID = "aa7d3f34-2d4f-41e0-807f-52fbf8cf7443"

Expand Down Expand Up @@ -126,10 +128,11 @@ async def connect(self, num_tries=3):
_LOGGER.debug(f"Connect retry {i}")
await self.disconnect()
self._client = BleakClient(self._mac, timeout=10)
await self._client.connect()
await self._client.connect(timeout=BLEAK_TIMEOUT)
self._conn = Conn.UNPAIRED
_LOGGER.debug(f"Connected: {self._client.is_connected}")
self._client.set_disconnected_callback(self.diconnected_cb)
asyncio.sleep(15) # temporary to see if the connection or the request fails
_LOGGER.debug("Request Notify")
await self._client.start_notify(NOTIFY_UUID, self.notification_handler)
await asyncio.sleep(0.3)
Expand Down

0 comments on commit 0c6d211

Please # to comment.