mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Protect Doorbird platform from failing when individual doorbird fails (#29374)
* Wrap connection attempt by try/except block so an individual downed doorbird does not fail the whole platform * Fixed lint warning * Disable too-broad-exception pylint warning since the whole point of this is to catch all exceptions and log them while letting processing continue; I don't disable a lint warning lightly, but this is the entire intent of this PR. * Fixed name of pylint warning to broad-except * Use _LOGGER.exception to get the stack trace too, per PEP8 recommendation for a bare Exception being caught. * per @balloob, switch to just catching OSError on a narrow block; I'm not sure this protects all problems with Doorbird device startup, but it protects against the primary one I experience.
This commit is contained in:
parent
8dea7f0f98
commit
6996ad3541
@ -67,8 +67,14 @@ def setup(hass, config):
|
||||
token = doorstation_config.get(CONF_TOKEN)
|
||||
name = doorstation_config.get(CONF_NAME) or "DoorBird {}".format(index + 1)
|
||||
|
||||
device = DoorBird(device_ip, username, password)
|
||||
status = device.ready()
|
||||
try:
|
||||
device = DoorBird(device_ip, username, password)
|
||||
status = device.ready()
|
||||
except OSError as oserr:
|
||||
_LOGGER.error(
|
||||
"Failed to setup doorbird at %s: %s; not retrying", device_ip, oserr
|
||||
)
|
||||
continue
|
||||
|
||||
if status[0]:
|
||||
doorstation = ConfiguredDoorBird(device, name, events, custom_url, token)
|
||||
|
Loading…
x
Reference in New Issue
Block a user