Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
zweckj committed Dec 5, 2023
1 parent 994ca42 commit 59e018d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyacaia_async/acaiascale.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ async def _write_msg(self, char_id: str, payload: bytearray) -> None:
await self._client.write_gatt_char(char_id, payload)
self._timestamp_last_command = time.time()
except (BleakDeviceNotFoundError, BleakError, TimeoutError) as ex:
if self._connected:
if (
self._connected
): # might have been disconnected by the disconnected_callback in the meantime
self._connected = False
self._last_disconnect_time = time.time()
if isinstance(ex, BleakDeviceNotFoundError):
Expand Down Expand Up @@ -198,7 +200,9 @@ async def _process_queue(self) -> None:
except asyncio.CancelledError:
return
except (AcaiaDeviceNotFound, AcaiaError) as ex:
if self.connected:
if (
self.connected
): # might have been disconnected by the disconnected_callback in the meantime
_LOGGER.warning("Error writing to device: %s", ex)
return

Expand Down

0 comments on commit 59e018d

Please sign in to comment.