Prevent verisure lock from looping forever and sleeping in test (#37425)
This commit is contained in:
parent
0c771f1c42
commit
78e53e35c2
1 changed files with 6 additions and 1 deletions
|
@ -126,9 +126,14 @@ class VerisureDoorlock(LockEntity):
|
|||
)["doorLockStateChangeTransactionId"]
|
||||
_LOGGER.debug("Verisure doorlock %s", state)
|
||||
transaction = {}
|
||||
attempts = 0
|
||||
while "result" not in transaction:
|
||||
sleep(0.5)
|
||||
transaction = hub.session.get_lock_state_transaction(transaction_id)
|
||||
attempts += 1
|
||||
if attempts == 30:
|
||||
break
|
||||
if attempts > 1:
|
||||
sleep(0.5)
|
||||
if transaction["result"] == "OK":
|
||||
self._state = state
|
||||
self._change_timestamp = monotonic()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue