3737 SwitchbotModel .LOCK_PRO : f"{ COMMAND_HEADER } 0f4e0101000000" ,
3838 SwitchbotModel .LOCK_ULTRA : f"{ COMMAND_HEADER } 0f4e0101000000" ,
3939}
40- COMMAND_ENABLE_NOTIFICATIONS = f"{ COMMAND_HEADER } 0e01001e00008101"
40+ COMMAND_ENABLE_NOTIFICATIONS = {
41+ SwitchbotModel .LOCK : f"{ COMMAND_HEADER } 0e01001e00008101" ,
42+ SwitchbotModel .LOCK_LITE : f"{ COMMAND_HEADER } 0e01001e00008101" ,
43+ SwitchbotModel .LOCK_PRO : f"{ COMMAND_HEADER } 0e01001e00008104" ,
44+ SwitchbotModel .LOCK_ULTRA : f"{ COMMAND_HEADER } 0e01001e00008107" ,
45+ }
4146COMMAND_DISABLE_NOTIFICATIONS = f"{ COMMAND_HEADER } 0e00"
4247
4348MOVING_STATUSES = {LockStatus .LOCKING , LockStatus .UNLOCKING }
@@ -197,12 +202,8 @@ async def _get_lock_info(self) -> bytes | None:
197202 return _data
198203
199204 async def _enable_notifications (self ) -> bool :
200- if self ._notifications_enabled :
201- return True
202- result = await self ._send_command (COMMAND_ENABLE_NOTIFICATIONS )
203- if self ._check_command_result (result , 0 , COMMAND_RESULT_EXPECTED_VALUES ):
204- self ._notifications_enabled = True
205- return self ._notifications_enabled
205+ result = await self ._send_command (COMMAND_ENABLE_NOTIFICATIONS [self ._model ])
206+ return self ._check_command_result (result , 0 , COMMAND_RESULT_EXPECTED_VALUES )
206207
207208 async def _disable_notifications (self ) -> bool :
208209 if not self ._notifications_enabled :
@@ -213,7 +214,7 @@ async def _disable_notifications(self) -> bool:
213214 return not self ._notifications_enabled
214215
215216 def _notification_handler (self , _sender : int , data : bytearray ) -> None :
216- if self ._notifications_enabled and self . _check_command_result (data , 0 , {0xF }):
217+ if self ._check_command_result (data , 0 , {0xF }):
217218 if self ._expected_disconnect :
218219 _LOGGER .debug (
219220 "%s: Ignoring lock notification during expected disconnect" ,
0 commit comments