mirror of
https://github.com/home-assistant/core.git
synced 2025-06-08 23:27:08 +00:00
Fix exception in august if bridge is missing (#60316)
This commit is contained in:
parent
3372288c88
commit
995f01cb68
@ -272,19 +272,13 @@ class AugustData(AugustSubscriberMixin):
|
|||||||
def _remove_inoperative_doorbells(self):
|
def _remove_inoperative_doorbells(self):
|
||||||
for doorbell in list(self.doorbells):
|
for doorbell in list(self.doorbells):
|
||||||
device_id = doorbell.device_id
|
device_id = doorbell.device_id
|
||||||
doorbell_is_operative = False
|
if self._device_detail_by_id.get(device_id):
|
||||||
doorbell_detail = self._device_detail_by_id.get(device_id)
|
continue
|
||||||
if doorbell_detail is None:
|
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"The doorbell %s could not be setup because the system could not fetch details about the doorbell",
|
"The doorbell %s could not be setup because the system could not fetch details about the doorbell",
|
||||||
doorbell.device_name,
|
doorbell.device_name,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
doorbell_is_operative = True
|
|
||||||
|
|
||||||
if not doorbell_is_operative:
|
|
||||||
del self._doorbells_by_id[device_id]
|
del self._doorbells_by_id[device_id]
|
||||||
del self._device_detail_by_id[device_id]
|
|
||||||
|
|
||||||
def _remove_inoperative_locks(self):
|
def _remove_inoperative_locks(self):
|
||||||
# Remove non-operative locks as there must
|
# Remove non-operative locks as there must
|
||||||
@ -292,7 +286,6 @@ class AugustData(AugustSubscriberMixin):
|
|||||||
# be usable
|
# be usable
|
||||||
for lock in list(self.locks):
|
for lock in list(self.locks):
|
||||||
device_id = lock.device_id
|
device_id = lock.device_id
|
||||||
lock_is_operative = False
|
|
||||||
lock_detail = self._device_detail_by_id.get(device_id)
|
lock_detail = self._device_detail_by_id.get(device_id)
|
||||||
if lock_detail is None:
|
if lock_detail is None:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
@ -304,14 +297,12 @@ class AugustData(AugustSubscriberMixin):
|
|||||||
"The lock %s could not be setup because it does not have a bridge (Connect)",
|
"The lock %s could not be setup because it does not have a bridge (Connect)",
|
||||||
lock.device_name,
|
lock.device_name,
|
||||||
)
|
)
|
||||||
|
del self._device_detail_by_id[device_id]
|
||||||
# Bridge may come back online later so we still add the device since we will
|
# Bridge may come back online later so we still add the device since we will
|
||||||
# have a pubnub subscription to tell use when it recovers
|
# have a pubnub subscription to tell use when it recovers
|
||||||
else:
|
else:
|
||||||
lock_is_operative = True
|
continue
|
||||||
|
|
||||||
if not lock_is_operative:
|
|
||||||
del self._locks_by_id[device_id]
|
del self._locks_by_id[device_id]
|
||||||
del self._device_detail_by_id[device_id]
|
|
||||||
|
|
||||||
|
|
||||||
def _save_live_attrs(lock_detail):
|
def _save_live_attrs(lock_detail):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user