Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name="PySwitchbot",
packages=["switchbot", "switchbot.devices", "switchbot.adv_parsers"],
install_requires=["async_timeout>=4.0.1", "bleak>=0.17.0", "bleak-retry-connector>=1.17.1"],
install_requires=["async_timeout>=4.0.1", "bleak>=0.17.0", "bleak-retry-connector>=2.9.0"],
version="0.20.7",
description="A library to communicate with Switchbot",
author="Daniel Hjelseth Hoyer",
Expand Down
11 changes: 11 additions & 0 deletions switchbot/devices/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,17 @@ async def _send_command_locked(self, key: str, command: bytes) -> bytes:
await self._ensure_connected()
try:
return await self._execute_command_locked(key, command)
except CharacteristicMissingError as ex:
_LOGGER.debug(
"%s: characteristic missing, clearing cache: %s; RSSI: %s",
self.name,
ex,
self.rssi,
exc_info=True,
)
await self._client.clear_cache()
await self._execute_forced_disconnect()
raise
except BleakDBusError as ex:
# Disconnect so we can reset state and try again
await asyncio.sleep(0.25)
Expand Down