mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Increase timeout for setup of rfxtrx (#43003)
* Increase timeout and remove reload * Use asyncio.TimeoutError * Remove import * Add logging * Minor tweak * Fix black * Update homeassistant/components/rfxtrx/__init__.py Co-authored-by: Joakim Plate <elupus@ecce.se>
This commit is contained in:
parent
5541721899
commit
f09004acf5
@ -36,7 +36,6 @@ from homeassistant.const import (
|
|||||||
VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
|
|
||||||
@ -191,7 +190,14 @@ async def async_setup_entry(hass, entry: config_entries.ConfigEntry):
|
|||||||
|
|
||||||
hass.data[DOMAIN][DATA_CLEANUP_CALLBACKS] = []
|
hass.data[DOMAIN][DATA_CLEANUP_CALLBACKS] = []
|
||||||
|
|
||||||
|
try:
|
||||||
await async_setup_internal(hass, entry)
|
await async_setup_internal(hass, entry)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
# Library currently doesn't support reload
|
||||||
|
_LOGGER.error(
|
||||||
|
"Connection timeout: failed to receive response from RFXtrx device"
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
for domain in DOMAINS:
|
for domain in DOMAINS:
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
@ -263,11 +269,8 @@ async def async_setup_internal(hass, entry: config_entries.ConfigEntry):
|
|||||||
config = entry.data
|
config = entry.data
|
||||||
|
|
||||||
# Initialize library
|
# Initialize library
|
||||||
try:
|
async with async_timeout.timeout(30):
|
||||||
async with async_timeout.timeout(5):
|
|
||||||
rfx_object = await hass.async_add_executor_job(_create_rfx, config)
|
rfx_object = await hass.async_add_executor_job(_create_rfx, config)
|
||||||
except asyncio.TimeoutError as err:
|
|
||||||
raise ConfigEntryNotReady from err
|
|
||||||
|
|
||||||
# Setup some per device config
|
# Setup some per device config
|
||||||
devices = _get_device_lookup(config[CONF_DEVICES])
|
devices = _get_device_lookup(config[CONF_DEVICES])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user