Make color extractor single config entry (#115016)

* Make color extractor single config entry

* Make color extractor single config entry

* Fix
This commit is contained in:
Joost Lekkerkerker 2024-04-13 13:04:39 +02:00 committed by GitHub
parent 38c7b99aef
commit 5e8b46c670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 9 deletions

View File

@ -18,10 +18,6 @@ class ColorExtractorConfigFlow(ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if user_input is not None: if user_input is not None:
return self.async_create_entry(title=DEFAULT_NAME, data={}) return self.async_create_entry(title=DEFAULT_NAME, data={})
return self.async_show_form(step_id="user") return self.async_show_form(step_id="user")

View File

@ -4,5 +4,6 @@
"codeowners": ["@GenericStudent"], "codeowners": ["@GenericStudent"],
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/color_extractor", "documentation": "https://www.home-assistant.io/integrations/color_extractor",
"requirements": ["colorthief==0.2.1"] "requirements": ["colorthief==0.2.1"],
"single_config_entry": true
} }

View File

@ -4,9 +4,6 @@
"user": { "user": {
"description": "[%key:common::config_flow::description::confirm_setup%]" "description": "[%key:common::config_flow::description::confirm_setup%]"
} }
},
"abort": {
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
} }
}, },
"services": { "services": {

View File

@ -957,7 +957,8 @@
"color_extractor": { "color_extractor": {
"name": "ColorExtractor", "name": "ColorExtractor",
"integration_type": "hub", "integration_type": "hub",
"config_flow": true "config_flow": true,
"single_config_entry": true
}, },
"comed": { "comed": {
"name": "Commonwealth Edison (ComEd)", "name": "Commonwealth Edison (ComEd)",