Skip to content

Commit b2b4c91

Browse files
authored
Merge pull request #245 from dknowles2/auto-lock-time
Add 5 seconds as a valid auto-lock time
2 parents ac9c380 + f8086a8 commit b2b4c91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pyschlage/lock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from .notification import ON_UNLOCK_ACTION, Notification
1515
from .user import User
1616

17+
AUTO_LOCK_TIMES = (0, 5, 15, 30, 60, 120, 240, 300)
18+
1719

1820
@dataclass
1921
class LockStateMetadata:
@@ -382,8 +384,6 @@ def set_lock_and_leave(self, enabled: bool):
382384
def set_auto_lock_time(self, auto_lock_time: int):
383385
"""Sets the auto_lock_time setting. Setting it to `0` turns off the
384386
auto-lock feature."""
385-
if auto_lock_time not in (0, 15, 30, 60, 120, 240, 300):
386-
raise ValueError(
387-
"auto_lock_time must be one of: (0, 15, 30, 60, 120, 240, 300)"
388-
)
387+
if auto_lock_time not in AUTO_LOCK_TIMES:
388+
raise ValueError(f"auto_lock_time must be one of: {AUTO_LOCK_TIMES}")
389389
self._put_attributes({"autoLockTime": auto_lock_time})

0 commit comments

Comments
 (0)