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
1 changed files with 10 additions and 7 deletions
|
@ -36,7 +36,6 @@ from homeassistant.const import (
|
|||
VOLT,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
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] = []
|
||||
|
||||
await async_setup_internal(hass, entry)
|
||||
try:
|
||||
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:
|
||||
hass.async_create_task(
|
||||
|
@ -263,11 +269,8 @@ async def async_setup_internal(hass, entry: config_entries.ConfigEntry):
|
|||
config = entry.data
|
||||
|
||||
# Initialize library
|
||||
try:
|
||||
async with async_timeout.timeout(5):
|
||||
rfx_object = await hass.async_add_executor_job(_create_rfx, config)
|
||||
except asyncio.TimeoutError as err:
|
||||
raise ConfigEntryNotReady from err
|
||||
async with async_timeout.timeout(30):
|
||||
rfx_object = await hass.async_add_executor_job(_create_rfx, config)
|
||||
|
||||
# Setup some per device config
|
||||
devices = _get_device_lookup(config[CONF_DEVICES])
|
||||
|
|
Loading…
Add table
Reference in a new issue