|
19 | 19 | ) |
20 | 20 | from ..connection import StickController |
21 | 21 | from ..constants import MAX_UINT_2 |
22 | | -from ..exceptions import MessageError, NodeError, NodeTimeout |
| 22 | +from ..exceptions import MessageError, NodeError |
23 | 23 | from ..messages.requests import ScanConfigureRequest, ScanLightCalibrateRequest |
24 | 24 | from ..messages.responses import ( |
25 | 25 | NODE_SWITCH_GROUP_ID, |
@@ -331,7 +331,7 @@ async def set_motion_sensitivity_level(self, level: MotionSensitivity) -> bool: |
331 | 331 | _LOGGER.debug( |
332 | 332 | "set_motion_sensitivity_level | Device %s | %s -> %s", |
333 | 333 | self.name, |
334 | | - self._motion_config.sensitivity_level.name, |
| 334 | + self.sensitivity_level.name, |
335 | 335 | level.name, |
336 | 336 | ) |
337 | 337 | if self._motion_config.sensitivity_level == level: |
@@ -504,17 +504,23 @@ async def scan_calibrate_light(self) -> bool: |
504 | 504 | async def _scan_calibrate_light(self) -> bool: |
505 | 505 | """Request to calibration light sensitivity of Scan device.""" |
506 | 506 | 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 | + ) |
514 | 513 | 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, |
518 | 524 | ) |
519 | 525 |
|
520 | 526 | async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any]: |
|
0 commit comments