Skip to content

Commit 0b8d98d

Browse files
committed
scan_configure(): try-except response added for testing
1 parent b1be32d commit 0b8d98d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plugwise_usb/nodes/scan.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
)
2020
from ..connection import StickController
2121
from ..constants import MAX_UINT_2
22-
from ..exceptions import MessageError, NodeError, NodeTimeout
22+
from ..exceptions import MessageError, NodeError, NodeTimeout, StickError
2323
from ..messages.requests import ScanConfigureRequest, ScanLightCalibrateRequest
2424
from ..messages.responses import (
2525
NODE_SWITCH_GROUP_ID,
@@ -504,7 +504,12 @@ async def scan_configure(
504504
sensitivity_value,
505505
daylight_mode,
506506
)
507-
if (response := await request.send()) is not None:
507+
try:
508+
response = await request.send()
509+
except StickError as exc:
510+
return False
511+
512+
if response is not None:
508513
if response.node_ack_type == NodeAckResponseType.SCAN_CONFIG_FAILED:
509514
self._new_reset_timer = None
510515
self._new_sensitivity_level = None

0 commit comments

Comments
 (0)