mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +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."""
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
sh_conf = config.get(DOMAIN)
|
||||
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data=sh_conf,
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
||||
if not hass.config_entries.async_entries(DOMAIN):
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data=config[DOMAIN],
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -16,6 +16,9 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class SmartHabConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""SmartHab config flow."""
|
||||
|
||||
VERSION = 1
|
||||
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||||
|
||||
def _show_setup_form(self, user_input=None, errors=None):
|
||||
"""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)
|
||||
|
||||
async def async_step_import(self, user_input):
|
||||
async def async_step_import(self, import_info):
|
||||
"""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