diff --git a/custom_components/govee_light_ble/api.py b/custom_components/govee_light_ble/api.py index 82b5e8b..c6cbd2e 100644 --- a/custom_components/govee_light_ble/api.py +++ b/custom_components/govee_light_ble/api.py @@ -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 """