Skip to content

Commit

Permalink
Merge pull request #57 from timniklas/timniklas-patch-1
Browse files Browse the repository at this point in the history
Improved connection stability
  • Loading branch information
timniklas authored Dec 28, 2024
2 parents fd3922a + 6e8735f commit bc47cbe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/govee_light_ble/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def _responseExpected(self):

async def _ensureConnected(self):
""" connects to a bluetooth device """
if self._client == None or not self._client.is_connected:
self.receiving_in_progress = False
self._client = await bleak_retry_connector.establish_connection(BleakClient, self._ble_device, self.address)
if self._client != None and self._client.is_connected:
return None
if self.receiving_in_progress:
self._stopReceiving()
self._client = await bleak_retry_connector.establish_connection(BleakClient, self._ble_device, self.address)

async def _transmitPacket(self, packet: LedPacket):
""" transmit the actiual packet """
Expand Down

0 comments on commit bc47cbe

Please sign in to comment.