mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Better error reporting remote classes
This commit is contained in:
parent
c659be7e17
commit
fed36d2cd0
@ -119,7 +119,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def setup(hass, config=None):
|
def setup(hass, config=None):
|
||||||
""" Sets up the HTTP API and debug interface. """
|
""" Sets up the HTTP API and debug interface. """
|
||||||
|
|
||||||
if config is None or DOMAIN not in config:
|
if config is None or DOMAIN not in config:
|
||||||
config = {DOMAIN: {}}
|
config = {DOMAIN: {}}
|
||||||
|
|
||||||
@ -139,9 +138,14 @@ def setup(hass, config=None):
|
|||||||
|
|
||||||
sessions_enabled = config[DOMAIN].get(CONF_SESSIONS_ENABLED, True)
|
sessions_enabled = config[DOMAIN].get(CONF_SESSIONS_ENABLED, True)
|
||||||
|
|
||||||
|
try:
|
||||||
server = HomeAssistantHTTPServer(
|
server = HomeAssistantHTTPServer(
|
||||||
(server_host, server_port), RequestHandler, hass, api_password,
|
(server_host, server_port), RequestHandler, hass, api_password,
|
||||||
development, no_password_set, sessions_enabled)
|
development, no_password_set, sessions_enabled)
|
||||||
|
except OSError:
|
||||||
|
# Happens if address already in use
|
||||||
|
_LOGGER.exception("Error setting up HTTP server")
|
||||||
|
return False
|
||||||
|
|
||||||
hass.bus.listen_once(
|
hass.bus.listen_once(
|
||||||
ha.EVENT_HOMEASSISTANT_START,
|
ha.EVENT_HOMEASSISTANT_START,
|
||||||
|
@ -120,8 +120,9 @@ class HomeAssistant(ha.HomeAssistant):
|
|||||||
def start(self):
|
def start(self):
|
||||||
# Ensure a local API exists to connect with remote
|
# Ensure a local API exists to connect with remote
|
||||||
if self.config.api is None:
|
if self.config.api is None:
|
||||||
bootstrap.setup_component(self, 'http')
|
if not bootstrap.setup_component(self, 'api'):
|
||||||
bootstrap.setup_component(self, 'api')
|
raise ha.HomeAssistantError(
|
||||||
|
'Unable to setup local API to receive events')
|
||||||
|
|
||||||
ha.Timer(self)
|
ha.Timer(self)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user