Prevent verisure lock from looping forever and sleeping in test (#37425)

This commit is contained in:
J. Nick Koston 2020-07-03 13:33:12 -05:00 committed by GitHub
parent 0c771f1c42
commit 78e53e35c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()