From 28389ebebe8c647af8192693c0fe02272f2e5ee4 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Thu, 24 Sep 2020 21:01:03 +0200 Subject: [PATCH] abort if already setup --- custom_components/adaptive_lighting/config_flow.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/adaptive_lighting/config_flow.py b/custom_components/adaptive_lighting/config_flow.py index 397a3975..b86fe3ea 100644 --- a/custom_components/adaptive_lighting/config_flow.py +++ b/custom_components/adaptive_lighting/config_flow.py @@ -44,6 +44,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): _DOMAIN_SCHEMA = get_domain_schema(yaml=False) schema = {k: v for k, v in _DOMAIN_SCHEMA.items() if k in user_input} vol.Schema(schema)(user_input) + await self.async_set_unique_id(user_input["name"]) + self._abort_if_unique_id_configured() return self.async_create_entry(title=user_input["name"], data=user_input) @staticmethod