Skip to content

Commit

Permalink
Merge pull request #34 from MangelSpec/master
Browse files Browse the repository at this point in the history
Change default CannotConnect strategy to retrying instead of failure …
  • Loading branch information
dvejsada authored Jan 30, 2025
2 parents da10d89 + 773e7d6 commit 46db753
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_components/pid_departures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Departure Board from a config entry flow."""
hub = DepartureBoard(hass, entry.data[CONF_API_KEY], entry.data[CONF_ID], entry.data[CONF_DEP_NUM]) # type: ignore[Any]
await hub.async_update()
try:
await hub.async_update()
except CannotConnect:
# try again later again
raise ConfigEntryNotReady from None
except StopNotFound:
return False
except WrongApiKey:
return False

hass.data.setdefault(DOMAIN, {})[entry.entry_id] = hub # type: ignore[Any]

Expand Down

0 comments on commit 46db753

Please sign in to comment.