Skip to content

Commit 794b74e

Browse files
authored
Handle additional retry-able exceptions (#120)
1 parent 01e8bdc commit 794b74e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name="PySwitchbot",
55
packages=["switchbot", "switchbot.devices", "switchbot.adv_parsers"],
6-
install_requires=["async_timeout>=4.0.1", "bleak>=0.17.0", "bleak-retry-connector>=1.15.0"],
6+
install_requires=["async_timeout>=4.0.1", "bleak>=0.17.0", "bleak-retry-connector>=1.17.1"],
77
version="0.19.8",
88
description="A library to communicate with Switchbot",
99
author="Daniel Hjelseth Hoyer",

switchbot/devices/device.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from bleak.backends.service import BleakGATTCharacteristic, BleakGATTServiceCollection
1515
from bleak.exc import BleakDBusError
1616
from bleak_retry_connector import (
17+
BLEAK_RETRY_EXCEPTIONS,
1718
BleakClientWithServiceCache,
1819
BleakNotFoundError,
1920
ble_device_has_changed,
@@ -37,12 +38,6 @@
3738
# Base key when encryption is set
3839
KEY_PASSWORD_PREFIX = "571"
3940

40-
BLEAK_EXCEPTIONS = (
41-
AttributeError,
42-
BleakError,
43-
EOFError,
44-
asyncio.exceptions.TimeoutError,
45-
)
4641

4742
# How long to hold the connection
4843
# to wait for additional commands for
@@ -181,7 +176,7 @@ async def _send_command(self, key: str, retry: int | None = None) -> bytes | Non
181176
self.rssi,
182177
exc_info=True,
183178
)
184-
except BLEAK_EXCEPTIONS:
179+
except BLEAK_RETRY_EXCEPTIONS:
185180
if attempt == retry:
186181
_LOGGER.error(
187182
"%s: communication failed; Stopping trying; RSSI: %s",

0 commit comments

Comments
 (0)