Prevent OpenUV from blocking other integrations' startup (#59956)
* Prevent OpenUV from blocking other integrations' startup * Commentpull/60007/head
parent
6f091d235f
commit
dedc4a8285
homeassistant/components/openuv
|
@ -51,23 +51,31 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
"""Set up OpenUV as config entry."""
|
||||
_verify_domain_control = verify_domain_control(hass, DOMAIN)
|
||||
|
||||
websession = aiohttp_client.async_get_clientsession(hass)
|
||||
openuv = OpenUV(
|
||||
entry,
|
||||
Client(
|
||||
entry.data[CONF_API_KEY],
|
||||
entry.data.get(CONF_LATITUDE, hass.config.latitude),
|
||||
entry.data.get(CONF_LONGITUDE, hass.config.longitude),
|
||||
altitude=entry.data.get(CONF_ELEVATION, hass.config.elevation),
|
||||
session=websession,
|
||||
),
|
||||
)
|
||||
|
||||
# We disable the client's request retry abilities here to avoid a lengthy (and
|
||||
# blocking) startup:
|
||||
openuv.client.disable_request_retries()
|
||||
|
||||
try:
|
||||
websession = aiohttp_client.async_get_clientsession(hass)
|
||||
openuv = OpenUV(
|
||||
entry,
|
||||
Client(
|
||||
entry.data[CONF_API_KEY],
|
||||
entry.data.get(CONF_LATITUDE, hass.config.latitude),
|
||||
entry.data.get(CONF_LONGITUDE, hass.config.longitude),
|
||||
altitude=entry.data.get(CONF_ELEVATION, hass.config.elevation),
|
||||
session=websession,
|
||||
),
|
||||
)
|
||||
await openuv.async_update()
|
||||
except OpenUvError as err:
|
||||
LOGGER.error("Config entry failed: %s", err)
|
||||
raise ConfigEntryNotReady from err
|
||||
|
||||
# Once we've successfully authenticated, we re-enable client request retries:
|
||||
openuv.client.enable_request_retries()
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
hass.data[DOMAIN][entry.entry_id] = openuv
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "OpenUV",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/openuv",
|
||||
"requirements": ["pyopenuv==2.2.1"],
|
||||
"requirements": ["pyopenuv==2021.11.0"],
|
||||
"codeowners": ["@bachya"],
|
||||
"iot_class": "cloud_polling"
|
||||
}
|
||||
|
|
|
@ -1691,7 +1691,7 @@ pyoctoprintapi==0.1.6
|
|||
pyombi==0.1.10
|
||||
|
||||
# homeassistant.components.openuv
|
||||
pyopenuv==2.2.1
|
||||
pyopenuv==2021.11.0
|
||||
|
||||
# homeassistant.components.opnsense
|
||||
pyopnsense==0.2.0
|
||||
|
|
|
@ -1034,7 +1034,7 @@ pynzbgetapi==0.2.0
|
|||
pyoctoprintapi==0.1.6
|
||||
|
||||
# homeassistant.components.openuv
|
||||
pyopenuv==2.2.1
|
||||
pyopenuv==2021.11.0
|
||||
|
||||
# homeassistant.components.opnsense
|
||||
pyopnsense==0.2.0
|
||||
|
|
Loading…
Reference in New Issue