File tree Expand file tree Collapse file tree 2 files changed +20
-17
lines changed Expand file tree Collapse file tree 2 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -255,24 +255,22 @@ def last_changed_by(
255
255
if self .lock_state_metadata is None :
256
256
return None
257
257
258
- if self .lock_state_metadata .action_type == "thumbTurn" :
259
- return "thumbturn"
260
-
258
+ user_suffix = ""
261
259
uuid = self .lock_state_metadata .uuid
262
-
263
- if self . lock_state_metadata . action_type == "AppleHomeNFC" :
264
- if uuid is not None and ( user := self . users . get ( uuid )):
265
- return f"apple nfc device - { user . name } "
266
- return "apple nfc device"
267
-
268
- if self . lock_state_metadata . action_type == "accesscode " :
269
- return f"keypad - { self . lock_state_metadata . name } "
270
-
271
- if self .lock_state_metadata .action_type == "virtualKey" :
272
- if uuid is not None and ( user := self . users . get ( uuid )) :
273
- return f"mobile device - { user . name } "
274
- return "mobile device"
275
-
260
+ if uuid is not None and ( user := self . users . get ( uuid )):
261
+ user_suffix = f" - { user . name } "
262
+
263
+ match self . lock_state_metadata . action_type :
264
+ case "thumbTurn" :
265
+ return "thumbturn"
266
+ case "1touchLocking " :
267
+ return "1-touch locking "
268
+ case "accesscode" :
269
+ return f"keypad - { self .lock_state_metadata .name } "
270
+ case "AppleHomeNFC" :
271
+ return f"apple nfc device { user_suffix } "
272
+ case "virtualKey" :
273
+ return f"mobile device { user_suffix } "
276
274
return "unknown"
277
275
278
276
def keypad_disabled (self , logs : list [LockLog ] | None = None ) -> bool :
Original file line number Diff line number Diff line change @@ -458,6 +458,11 @@ def test_thumbturn(self, wifi_lock: Lock) -> None:
458
458
wifi_lock .lock_state_metadata .action_type = "thumbTurn"
459
459
assert wifi_lock .last_changed_by () == "thumbturn"
460
460
461
+ def test_one_touch_locking (self , wifi_lock : Lock ) -> None :
462
+ assert wifi_lock .lock_state_metadata is not None
463
+ wifi_lock .lock_state_metadata .action_type = "1touchLocking"
464
+ assert wifi_lock .last_changed_by () == "1-touch locking"
465
+
461
466
def test_nfc_device (self , wifi_lock : Lock ) -> None :
462
467
assert wifi_lock .lock_state_metadata is not None
463
468
wifi_lock .lock_state_metadata .action_type = "AppleHomeNFC"
You can’t perform that action at this time.
0 commit comments