diff --git a/homeassistant/components/smarthab/__init__.py b/homeassistant/components/smarthab/__init__.py index 2d22841660a..c826b5d8f4d 100644 --- a/homeassistant/components/smarthab/__init__.py +++ b/homeassistant/components/smarthab/__init__.py @@ -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 diff --git a/homeassistant/components/smarthab/config_flow.py b/homeassistant/components/smarthab/config_flow.py index f0a1df88695..a277388c140 100644 --- a/homeassistant/components/smarthab/config_flow.py +++ b/homeassistant/components/smarthab/config_flow.py @@ -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)