Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion homeassistant/components/xiaomi_miio/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

_LOGGER = logging.getLogger(__name__)

CONF_IMPORT = "is_import"

DEFAULT_GATEWAY_NAME = "Xiaomi Gateway"

DEVICE_SETTINGS = {
Expand All @@ -46,6 +48,7 @@ def __init__(self):

async def async_step_import(self, conf: dict):
"""Import a configuration from config.yaml."""
conf[CONF_IMPORT] = True
return await self.async_step_device(user_input=conf)

async def async_step_user(self, user_input=None):
Expand Down Expand Up @@ -107,6 +110,7 @@ async def async_step_device(self, user_input=None):
if user_input is not None:
token = user_input[CONF_TOKEN]
model = user_input.get(CONF_MODEL)
is_import = user_input.get(CONF_IMPORT, False)
if user_input.get(CONF_HOST):
self.host = user_input[CONF_HOST]

Expand Down Expand Up @@ -146,7 +150,8 @@ async def async_step_device(self, user_input=None):
if model.startswith(device_model):
unique_id = self.mac
await self.async_set_unique_id(unique_id)
Comment thread
MartinHjelmare marked this conversation as resolved.
Outdated
self._abort_if_unique_id_configured()
if not is_import:
self._abort_if_unique_id_configured()
return self.async_create_entry(
title=name,
data={
Expand Down