Fix opentherm_gw blocks HA startup when gateway unreachable. (#22106)
This commit is contained in:
parent
0466e43478
commit
c90f0d5bd6
1 changed files with 9 additions and 4 deletions
|
@ -8,8 +8,9 @@ from homeassistant.components.binary_sensor import DOMAIN as COMP_BINARY_SENSOR
|
|||
from homeassistant.components.sensor import DOMAIN as COMP_SENSOR
|
||||
from homeassistant.const import (
|
||||
ATTR_DATE, ATTR_ID, ATTR_TEMPERATURE, ATTR_TIME, CONF_DEVICE,
|
||||
CONF_MONITORED_VARIABLES, CONF_NAME, EVENT_HOMEASSISTANT_STOP,
|
||||
PRECISION_HALVES, PRECISION_TENTHS, PRECISION_WHOLE)
|
||||
CONF_MONITORED_VARIABLES, CONF_NAME, EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP, PRECISION_HALVES, PRECISION_TENTHS,
|
||||
PRECISION_WHOLE)
|
||||
from homeassistant.helpers.discovery import async_load_platform
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
|
||||
|
@ -115,14 +116,18 @@ async def async_setup(hass, config):
|
|||
DATA_GW_VARS: pyotgw.vars,
|
||||
DATA_LATEST_STATUS: {}
|
||||
}
|
||||
hass.async_create_task(connect_and_subscribe(
|
||||
hass, conf[CONF_DEVICE], gateway))
|
||||
hass.async_create_task(register_services(hass, gateway))
|
||||
hass.async_create_task(async_load_platform(
|
||||
hass, 'climate', DOMAIN, conf.get(CONF_CLIMATE), config))
|
||||
if monitored_vars:
|
||||
hass.async_create_task(setup_monitored_vars(
|
||||
hass, config, monitored_vars))
|
||||
|
||||
def schedule_connect(event):
|
||||
"""Schedule the connect_and_subscribe coroutine."""
|
||||
hass.async_create_task(
|
||||
connect_and_subscribe(hass, conf[CONF_DEVICE], gateway))
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, schedule_connect)
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue