Skip to content

Commit

Permalink
ConfigEntryNotReady
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomes committed Feb 21, 2021
1 parent 554955d commit b39d896
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions homeassistant/components/kmtronic/__init__.py
Expand Up @@ -53,6 +53,8 @@ async def async_update_data():
try:
async with async_timeout.timeout(10):
await hub.async_update_relays()
except aiohttp.client_exceptions.ClientResponseError as err:
raise UpdateFailed(f"Wrong credentials: {err}") from err
except aiohttp.client_exceptions.ClientConnectorError as err:
raise UpdateFailed(f"Error communicating with API: {err}") from err

Expand All @@ -64,10 +66,9 @@ async def async_update_data():
update_interval=timedelta(seconds=30),
)

try:
await coordinator.async_refresh()
except UpdateFailed as err:
raise ConfigEntryNotReady from err
await coordinator.async_refresh()
if not coordinator.last_update_success:
raise ConfigEntryNotReady

if DOMAIN not in hass.data:
hass.data[DOMAIN] = {}
Expand Down

0 comments on commit b39d896

Please sign in to comment.