From 2879761eae6d1a8007a1d337e57c0683141bc725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20St=C3=A5hl?= Date: Fri, 25 Sep 2020 22:11:03 +0200 Subject: [PATCH] Remove unneeded YAML import flag --- custom_components/localtuya/config_flow.py | 6 +----- custom_components/localtuya/const.py | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/custom_components/localtuya/config_flow.py b/custom_components/localtuya/config_flow.py index 431ef87..9fddaeb 100644 --- a/custom_components/localtuya/config_flow.py +++ b/custom_components/localtuya/config_flow.py @@ -21,7 +21,6 @@ from .const import ( # pylint: disable=unused-import CONF_LOCAL_KEY, CONF_PROTOCOL_VERSION, CONF_DPS_STRINGS, - CONF_YAML_IMPORT, DOMAIN, PLATFORMS, ) @@ -307,9 +306,6 @@ class LocaltuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def async_step_import(self, user_input): """Handle import from YAML.""" await self.async_set_unique_id(user_input[CONF_DEVICE_ID]) - - user_input[CONF_YAML_IMPORT] = True - self._abort_if_unique_id_configured(updates=user_input) return self.async_create_entry( title=f"{user_input[CONF_FRIENDLY_NAME]} (YAML)", data=user_input @@ -339,7 +335,7 @@ class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow): return await self.async_step_entity() # Not supported for YAML imports - if self.config_entry.data.get(CONF_YAML_IMPORT): + if self.config_entry.source == config_entries.SOURCE_IMPORT: return await self.async_step_yaml_import() return self.async_show_form( diff --git a/custom_components/localtuya/const.py b/custom_components/localtuya/const.py index 42b9bc9..af1cde8 100644 --- a/custom_components/localtuya/const.py +++ b/custom_components/localtuya/const.py @@ -7,7 +7,6 @@ ATTR_VOLTAGE = "voltage" CONF_LOCAL_KEY = "local_key" CONF_PROTOCOL_VERSION = "protocol_version" CONF_DPS_STRINGS = "dps_strings" -CONF_YAML_IMPORT = "yaml_import" # switch CONF_CURRENT = "current"