mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 10:47:51 +00:00
Fix SmartHab import flow (#41093)
This commit is contained in:
parent
9765fc13e8
commit
9611e5223a
@ -34,15 +34,18 @@ async def async_setup(hass, config) -> bool:
|
|||||||
"""Set up the SmartHab platform."""
|
"""Set up the SmartHab platform."""
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
sh_conf = config.get(DOMAIN)
|
|
||||||
|
|
||||||
hass.async_create_task(
|
if DOMAIN not in config:
|
||||||
hass.config_entries.flow.async_init(
|
return True
|
||||||
DOMAIN,
|
|
||||||
context={"source": SOURCE_IMPORT},
|
if not hass.config_entries.async_entries(DOMAIN):
|
||||||
data=sh_conf,
|
hass.async_create_task(
|
||||||
|
hass.config_entries.flow.async_init(
|
||||||
|
DOMAIN,
|
||||||
|
context={"source": SOURCE_IMPORT},
|
||||||
|
data=config[DOMAIN],
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class SmartHabConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class SmartHabConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
"""SmartHab config flow."""
|
"""SmartHab config flow."""
|
||||||
|
|
||||||
|
VERSION = 1
|
||||||
|
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||||||
|
|
||||||
def _show_setup_form(self, user_input=None, errors=None):
|
def _show_setup_form(self, user_input=None, errors=None):
|
||||||
"""Show the setup form to the user."""
|
"""Show the setup form to the user."""
|
||||||
|
|
||||||
@ -72,6 +75,6 @@ class SmartHabConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
return self._show_setup_form(user_input, errors)
|
return self._show_setup_form(user_input, errors)
|
||||||
|
|
||||||
async def async_step_import(self, user_input):
|
async def async_step_import(self, import_info):
|
||||||
"""Handle import from legacy config."""
|
"""Handle import from legacy config."""
|
||||||
return await self.async_step_user(user_input)
|
return await self.async_step_user(import_info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user