Преглед на файлове

Don't update config from yaml if it was already imported.

Allow setting options if the flow was imported.  It won't be overwritten by
changes from yaml, so we don't need to block it.
Jason Rumney преди 4 години
родител
ревизия
a2c5362bd3
променени са 1 файла, в които са добавени 1 реда и са изтрити 10 реда
  1. 1 10
      custom_components/tuya_local/config_flow.py

+ 1 - 10
custom_components/tuya_local/config_flow.py

@@ -52,9 +52,6 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
             None,
         )
         if existing_entry is not None:
-            self.hass.config_entries.async_update_entry(
-                existing_entry, title=title, options=user_input
-            )
             return self.async_abort(reason="imported")
         else:
             await self.async_set_unique_id(user_input[CONF_DEVICE_ID])
@@ -72,10 +69,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
         self.config_entry = config_entry
 
     async def async_step_init(self, user_input=None):
-        if self.config_entry.data.get(config_entries.SOURCE_IMPORT, False):
-            return await self.async_step_imported(user_input)
-        else:
-            return await self.async_step_user(user_input)
+        return await self.async_step_user(user_input)
 
     async def async_step_user(self, user_input=None):
         """Manage the options."""
@@ -98,9 +92,6 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
             errors=errors,
         )
 
-    async def async_step_imported(self, user_input=None):
-        return {**self.async_abort(reason="imported"), "data": {}}
-
 
 async def async_test_connection(config: dict, hass: HomeAssistant):
     device = TuyaLocalDevice(