From f541b101c9fd32879b4df3bb646130da7796b187 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 4 Nov 2018 12:19:04 +0100 Subject: [PATCH] Bugfix discovery (delete/mqtt) call for Hass.io (#18159) * Bugfix discovery delete call for Hass.io * Fix host * fix tests --- homeassistant/components/hassio/discovery.py | 2 +- homeassistant/components/mqtt/config_flow.py | 6 +++--- tests/components/mqtt/test_config_flow.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/hassio/discovery.py b/homeassistant/components/hassio/discovery.py index 4c7c5a6597f..a5f62b9e1a1 100644 --- a/homeassistant/components/hassio/discovery.py +++ b/homeassistant/components/hassio/discovery.py @@ -71,7 +71,7 @@ class HassIODiscovery(HomeAssistantView): async def delete(self, request, uuid): """Handle remove discovery requests.""" - data = request.json() + data = await request.json() await self.async_process_del(data) return web.Response() diff --git a/homeassistant/components/mqtt/config_flow.py b/homeassistant/components/mqtt/config_flow.py index e0d1e692c60..aee825d06de 100644 --- a/homeassistant/components/mqtt/config_flow.py +++ b/homeassistant/components/mqtt/config_flow.py @@ -6,7 +6,7 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.const import ( - CONF_PASSWORD, CONF_PORT, CONF_USERNAME, CONF_PROTOCOL) + CONF_PASSWORD, CONF_PORT, CONF_USERNAME, CONF_PROTOCOL, CONF_HOST) from .const import CONF_BROKER, CONF_DISCOVERY, DEFAULT_DISCOVERY @@ -80,7 +80,7 @@ class FlowHandler(config_entries.ConfigFlow): data = self._hassio_discovery can_connect = await self.hass.async_add_executor_job( try_connection, - data[CONF_BROKER], + data[CONF_HOST], data[CONF_PORT], data.get(CONF_USERNAME), data.get(CONF_PASSWORD), @@ -90,7 +90,7 @@ class FlowHandler(config_entries.ConfigFlow): if can_connect: return self.async_create_entry( title=data['addon'], data={ - CONF_BROKER: data[CONF_BROKER], + CONF_BROKER: data[CONF_HOST], CONF_PORT: data[CONF_PORT], CONF_USERNAME: data.get(CONF_USERNAME), CONF_PASSWORD: data.get(CONF_PASSWORD), diff --git a/tests/components/mqtt/test_config_flow.py b/tests/components/mqtt/test_config_flow.py index 08bb4e54a39..66bf9b97807 100644 --- a/tests/components/mqtt/test_config_flow.py +++ b/tests/components/mqtt/test_config_flow.py @@ -119,7 +119,7 @@ async def test_hassio_confirm(hass, mock_try_connection, 'mqtt', data={ 'addon': 'Mock Addon', - 'broker': 'mock-broker', + 'host': 'mock-broker', 'port': 1883, 'username': 'mock-user', 'password': 'mock-pass',