@@ -86,7 +86,7 @@ def __init__(
8686
8787 self ._motion_state = MotionState ()
8888 self ._motion_config = MotionConfig ()
89-
89+ self . _scan_calibrate_light_scheduled : bool = False
9090 self ._configure_daylight_mode_task : Task [Coroutine [Any , Any , None ]] | None = (
9191 None
9292 )
@@ -449,6 +449,8 @@ async def _run_awake_tasks(self) -> None:
449449 await super ()._run_awake_tasks ()
450450 if self ._motion_config .dirty :
451451 await self ._configure_scan_task ()
452+ if self ._scan_calibrate_light_scheduled :
453+ await self ._scan_calibrate_light ()
452454 await self .publish_feature_update_to_subscribers (
453455 NodeFeature .MOTION_CONFIG ,
454456 self ._motion_config ,
@@ -511,14 +513,19 @@ async def _scan_configure_update(self) -> None:
511513 self .save_cache (),
512514 )
513515
514- async def scan_calibrate_light (self ) -> bool :
516+ async def scan_calibrate_light (self ) -> None :
517+ """Schedule light sensitivity calibration of Scan device."""
518+ self ._scan_calibrate_light_scheduled = True
519+
520+ async def _scan_calibrate_light (self ) -> bool :
515521 """Request to calibration light sensitivity of Scan device."""
516522 request = ScanLightCalibrateRequest (self ._send , self ._mac_in_bytes )
517523 if (response := await request .send ()) is not None :
518524 if (
519525 response .node_ack_type
520526 == NodeAckResponseType .SCAN_LIGHT_CALIBRATION_ACCEPTED
521527 ):
528+ self ._scan_calibrate_light_scheduled = False
522529 return True
523530 return False
524531 raise NodeTimeout (
0 commit comments