Bugfix discovery (delete/mqtt) call for Hass.io (#18159)

* Bugfix discovery delete call for Hass.io

* Fix host

* fix tests
pull/18335/head
Pascal Vizeli 2018-11-04 12:19:04 +01:00
parent e9b8b290fc
commit f541b101c9
3 changed files with 5 additions and 5 deletions

View File

@ -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()

View File

@ -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),

View File

@ -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',