From 88257c9c4223bea1963bc5ed4ff55c9be95a235a Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Thu, 23 May 2024 08:41:12 +0200 Subject: [PATCH] Allow to reconfigure integrations with `single_config_entry` set (#117939) --- homeassistant/config_entries.py | 3 ++- tests/test_config_entries.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 3ae3830a8d7..4999eb6d34a 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -1231,7 +1231,8 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]): # Avoid starting a config flow on an integration that only supports # a single config entry, but which already has an entry if ( - context.get("source") not in {SOURCE_IGNORE, SOURCE_REAUTH, SOURCE_UNIGNORE} + context.get("source") + not in {SOURCE_IGNORE, SOURCE_REAUTH, SOURCE_UNIGNORE, SOURCE_RECONFIGURE} and self.config_entries.async_has_entries(handler, include_ignore=False) and await _support_single_config_entry_only(self.hass, handler) ): diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index 16692e620cb..f055af7224e 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -5027,6 +5027,11 @@ async def test_hashable_non_string_unique_id( None, {"type": data_entry_flow.FlowResultType.FORM, "step_id": "reauth_confirm"}, ), + ( + config_entries.SOURCE_RECONFIGURE, + None, + {"type": data_entry_flow.FlowResultType.FORM, "step_id": "reauth_confirm"}, + ), ( config_entries.SOURCE_UNIGNORE, None, @@ -5111,6 +5116,11 @@ async def test_starting_config_flow_on_single_config_entry( None, {"type": data_entry_flow.FlowResultType.FORM, "step_id": "reauth_confirm"}, ), + ( + config_entries.SOURCE_RECONFIGURE, + None, + {"type": data_entry_flow.FlowResultType.FORM, "step_id": "reauth_confirm"}, + ), ( config_entries.SOURCE_UNIGNORE, None,