Skip to content

Commit

Permalink
Improved connection stability
Browse files Browse the repository at this point in the history
  • Loading branch information
timniklas authored Dec 28, 2024
1 parent fd3922a commit 6e8735f
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 6e8735f

Please sign in to comment.