Handle new API / Frontend early boot (#1770)

* Handle new API / Frontend early boot

* Adjust part 2

* fix hanging landingpage

* Fix catch error

* Fix watchdog
This commit is contained in:
Pascal Vizeli
2020-06-02 14:53:57 +02:00
committed by GitHub
parent ec43448163
commit af412c3105
2 changed files with 24 additions and 7 deletions

View File

@@ -75,6 +75,8 @@ class APIProxy(CoreSysAttributes):
async def stream(self, request: web.Request):
"""Proxy HomeAssistant EventStream Requests."""
self._check_access(request)
if not await self.sys_homeassistant.check_api_state():
raise HTTPBadGateway()
_LOGGER.info("Home Assistant EventStream start")
async with self._api_client(request, "stream", timeout=None) as client:
@@ -94,6 +96,8 @@ class APIProxy(CoreSysAttributes):
async def api(self, request: web.Request):
"""Proxy Home Assistant API Requests."""
self._check_access(request)
if not await self.sys_homeassistant.check_api_state():
raise HTTPBadGateway()
# Normal request
path = request.match_info.get("path", "")
@@ -153,6 +157,8 @@ class APIProxy(CoreSysAttributes):
async def websocket(self, request: web.Request):
"""Initialize a WebSocket API connection."""
if not await self.sys_homeassistant.check_api_state():
raise HTTPBadGateway()
_LOGGER.info("Home Assistant WebSocket API request initialize")
# init server