Throw ConfigEntryNotReady when august servers are offline or u… (#32635)

* Throw ConfigEntryNotReady when august servers are offline

* august has tests now and its nearing 100%

* Adjust per review

* define in init
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-03-10 17:10:00 -07:00
1 parent ae147fd9c7
commit 048f9e7daa
4 files changed
+39 -12

No files matched your search

+6 -3
View File
@@ -11,7 +11,7 @@ import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
import homeassistant.helpers.config_validation as cv
from .activity import ActivityStream
@@ -164,9 +164,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up August from a config entry."""
august_gateway = AugustGateway(hass)
await august_gateway.async_setup(entry.data)
return await async_setup_august(hass, entry, august_gateway)
try:
await august_gateway.async_setup(entry.data)
return await async_setup_august(hass, entry, august_gateway)
except asyncio.TimeoutError:
raise ConfigEntryNotReady
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):