37
37
SwitchbotModel .LOCK_PRO : f"{ COMMAND_HEADER } 0f4e0101000000" ,
38
38
SwitchbotModel .LOCK_ULTRA : f"{ COMMAND_HEADER } 0f4e0101000000" ,
39
39
}
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
+ }
41
46
COMMAND_DISABLE_NOTIFICATIONS = f"{ COMMAND_HEADER } 0e00"
42
47
43
48
MOVING_STATUSES = {LockStatus .LOCKING , LockStatus .UNLOCKING }
@@ -197,12 +202,8 @@ async def _get_lock_info(self) -> bytes | None:
197
202
return _data
198
203
199
204
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 )
206
207
207
208
async def _disable_notifications (self ) -> bool :
208
209
if not self ._notifications_enabled :
@@ -213,7 +214,7 @@ async def _disable_notifications(self) -> bool:
213
214
return not self ._notifications_enabled
214
215
215
216
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 }):
217
218
if self ._expected_disconnect :
218
219
_LOGGER .debug (
219
220
"%s: Ignoring lock notification during expected disconnect" ,
0 commit comments