From 3f99dec858a59a9bfcfd54a72a13a84eff53f664 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 26 Jan 2018 15:21:23 +0100 Subject: [PATCH 1/6] Pump version to 0.85 --- hassio/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hassio/const.py b/hassio/const.py index 23ec877aa..cdd9f3d47 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -2,7 +2,7 @@ from pathlib import Path from ipaddress import ip_network -HASSIO_VERSION = '0.84' +HASSIO_VERSION = '0.85' URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/' 'hassio/{}/version.json') From f77e176a6e0361dd9034cb30715047a247021391 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 28 Jan 2018 09:02:23 +0100 Subject: [PATCH 2/6] Update HomeAssistant to version 0.62.0 --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 04556917b..b07176f65 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "hassio": "0.84", - "homeassistant": "0.61.1", + "homeassistant": "0.62.0", "resinos": "1.1", "resinhup": "0.3", "generic": "0.3", From eb6c7535147589b9537ea37f39d79cfda61649fd Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 29 Jan 2018 10:17:53 +0100 Subject: [PATCH 3/6] Add support for undocument ha version inside wesocket (#333) --- hassio/api/proxy.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hassio/api/proxy.py b/hassio/api/proxy.py index 9b25ec618..27a6c7cfc 100644 --- a/hassio/api/proxy.py +++ b/hassio/api/proxy.py @@ -133,9 +133,15 @@ class APIProxy(CoreSysAttributes): await server.prepare(request) # handle authentication - await server.send_json({'type': 'auth_required'}) + await server.send_json({ + 'type': 'auth_required', + 'ha_version': self._homeassistant.version, + }) await server.receive_json() # get internal token - await server.send_json({'type': 'auth_ok'}) + await server.send_json({ + 'type': 'auth_ok', + 'ha_version': self._homeassistant.version, + }) # init connection to hass client = await self._websocket_client() From 142cdcffcaebcc1b7ea20666180021efc1123be8 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 29 Jan 2018 12:36:58 +0100 Subject: [PATCH 4/6] Better error handling for proxy (#334) --- hassio/api/proxy.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/hassio/api/proxy.py b/hassio/api/proxy.py index 27a6c7cfc..f3ddf4b92 100644 --- a/hassio/api/proxy.py +++ b/hassio/api/proxy.py @@ -4,7 +4,7 @@ import logging import aiohttp from aiohttp import web -from aiohttp.web_exceptions import HTTPBadGateway +from aiohttp.web_exceptions import HTTPBadGateway, HTTPInternalServerError from aiohttp.hdrs import CONTENT_TYPE import async_timeout @@ -133,15 +133,19 @@ class APIProxy(CoreSysAttributes): await server.prepare(request) # handle authentication - await server.send_json({ - 'type': 'auth_required', - 'ha_version': self._homeassistant.version, - }) - await server.receive_json() # get internal token - await server.send_json({ - 'type': 'auth_ok', - 'ha_version': self._homeassistant.version, - }) + try: + await server.send_json({ + 'type': 'auth_required', + 'ha_version': self._homeassistant.version, + }) + await server.receive_json() # get internal token + await server.send_json({ + 'type': 'auth_ok', + 'ha_version': self._homeassistant.version, + }) + except RuntimeError as err: + _LOGGER.error("Can't initialize handshake: %s", err) + raise HTTPInternalServerError() from None # init connection to hass client = await self._websocket_client() From 385a4e9f6f745d7e13e69a97c0b8b5022da92e40 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 29 Jan 2018 22:45:03 +0100 Subject: [PATCH 5/6] Update hass.io to version 0.85 --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index b07176f65..fd5f4699a 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "hassio": "0.84", + "hassio": "0.85", "homeassistant": "0.62.0", "resinos": "1.1", "resinhup": "0.3", From ee867705706986b9ceb8a92dff7f67004bc9d637 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 29 Jan 2018 23:27:31 +0100 Subject: [PATCH 6/6] Fix API URL --- hassio/api/proxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hassio/api/proxy.py b/hassio/api/proxy.py index f3ddf4b92..3cbc35cf5 100644 --- a/hassio/api/proxy.py +++ b/hassio/api/proxy.py @@ -100,7 +100,7 @@ class APIProxy(CoreSysAttributes): async def _websocket_client(self): """Initialize a websocket api connection.""" - url = f"{self.homeassistant.api_url}/api/websocket" + url = f"{self._homeassistant.api_url}/api/websocket" try: client = await self._websession_ssl.ws_connect( @@ -143,7 +143,7 @@ class APIProxy(CoreSysAttributes): 'type': 'auth_ok', 'ha_version': self._homeassistant.version, }) - except RuntimeError as err: + except (RuntimeError, ValueError) as err: _LOGGER.error("Can't initialize handshake: %s", err) raise HTTPInternalServerError() from None