Skip to content

Commit 01d1db4

Browse files
committed
CR: remove unwanted exception
1 parent 1696031 commit 01d1db4

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

plugwise_usb/nodes/scan.py

Lines changed: 18 additions & 12 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
2323
from ..messages.requests import ScanConfigureRequest, ScanLightCalibrateRequest
2424
from ..messages.responses import (
2525
NODE_SWITCH_GROUP_ID,
@@ -331,7 +331,7 @@ async def set_motion_sensitivity_level(self, level: MotionSensitivity) -> bool:
331331
_LOGGER.debug(
332332
"set_motion_sensitivity_level | Device %s | %s -> %s",
333333
self.name,
334-
self._motion_config.sensitivity_level.name,
334+
self.sensitivity_level.name,
335335
level.name,
336336
)
337337
if self._motion_config.sensitivity_level == level:
@@ -504,17 +504,23 @@ async def scan_calibrate_light(self) -> bool:
504504
async def _scan_calibrate_light(self) -> bool:
505505
"""Request to calibration light sensitivity of Scan device."""
506506
request = ScanLightCalibrateRequest(self._send, self._mac_in_bytes)
507-
if (response := await request.send()) is not None:
508-
if (
509-
response.node_ack_type
510-
== NodeAckResponseType.SCAN_LIGHT_CALIBRATION_ACCEPTED
511-
):
512-
self._scan_calibrate_light_scheduled = False
513-
return True
507+
response = await request.send()
508+
if response is None:
509+
_LOGGER.warning(
510+
"No response from %s to light calibration request",
511+
self.name,
512+
)
514513
return False
515-
raise NodeTimeout(
516-
f"No response from Scan device {self.mac} "
517-
+ "to light calibration request."
514+
if (
515+
response.node_ack_type
516+
== NodeAckResponseType.SCAN_LIGHT_CALIBRATION_ACCEPTED
517+
):
518+
self._scan_calibrate_light_scheduled = False
519+
return True
520+
_LOGGER.warning(
521+
"Unexpected ack type %s for light calibration on %s",
522+
response.node_ack_type,
523+
self.name,
518524
)
519525

520526
async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any]:

0 commit comments

Comments
 (0)