deCONZ multiple gateways fixup (#22774)
* Initial PR was merged before a proper review was performed * These fixes follow Martins review comments after mergepull/22196/head
parent
7a33dc5cec
commit
d1bf470899
|
@ -4,7 +4,6 @@ import voluptuous as vol
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_API_KEY, CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP)
|
CONF_API_KEY, CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP)
|
||||||
from homeassistant.core import callback
|
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
|
@ -51,7 +50,7 @@ async def async_setup(hass, config):
|
||||||
"""
|
"""
|
||||||
if not hass.config_entries.async_entries(DOMAIN) and DOMAIN in config:
|
if not hass.config_entries.async_entries(DOMAIN) and DOMAIN in config:
|
||||||
deconz_config = config[DOMAIN]
|
deconz_config = config[DOMAIN]
|
||||||
hass.async_add_job(hass.config_entries.flow.async_init(
|
hass.async_create_task(hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={'source': config_entries.SOURCE_IMPORT},
|
DOMAIN, context={'source': config_entries.SOURCE_IMPORT},
|
||||||
data=deconz_config
|
data=deconz_config
|
||||||
))
|
))
|
||||||
|
@ -175,7 +174,6 @@ async def async_unload_entry(hass, config_entry):
|
||||||
return await gateway.async_reset()
|
return await gateway.async_reset()
|
||||||
|
|
||||||
|
|
||||||
@callback
|
|
||||||
async def async_populate_options(hass, config_entry):
|
async def async_populate_options(hass, config_entry):
|
||||||
"""Populate default options for gateway.
|
"""Populate default options for gateway.
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ async def test_config_with_host_passed_to_config_entry(hass):
|
||||||
}
|
}
|
||||||
}) is True
|
}) is True
|
||||||
# Import flow started
|
# Import flow started
|
||||||
assert len(mock_config_flow.mock_calls) == 2
|
assert len(mock_config_flow.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
async def test_config_without_host_not_passed_to_config_entry(hass):
|
async def test_config_without_host_not_passed_to_config_entry(hass):
|
||||||
|
|
Loading…
Reference in New Issue