Skip to content

Commit

Permalink
Fix opentherm_gw blocks HA startup when gateway unreachable. (home-as…
Browse files Browse the repository at this point in the history
  • Loading branch information
mvn23 authored and hpeyerl committed Mar 29, 2019
1 parent 8e3a261 commit 1bf27ac
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions homeassistant/components/opentherm_gw/__init__.py
Expand Up @@ -8,8 +8,9 @@
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

Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 1bf27ac

Please sign in to comment.