Skip to content

Commit

Permalink
Merge pull request #92 from domwillcode/no-minigw_lock_status
Browse files Browse the repository at this point in the history
Handle when device has no minigw_lock_status
  • Loading branch information
gjohansson-ST authored Aug 19, 2024
2 parents f457d5e + bdee77f commit d2f6afb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yalesmartalarmclient/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def set_state(self, new_state: YaleLockState) -> None:
def _calc_state(self) -> YaleLockState:
raw_state: str = self._device["status1"]

lock_status_str = self._device["minigw_lock_status"]
if lock_status_str != "":
lock_status_str: str | None = self._device.get("minigw_lock_status")
if lock_status_str and lock_status_str != "":
lock_status = int(lock_status_str, 16)
closed = (lock_status & 16) == 16
locked = (lock_status & 1) == 1
Expand Down

0 comments on commit d2f6afb

Please sign in to comment.