diff --git a/homeassistant/components/zwave_js/config_flow.py b/homeassistant/components/zwave_js/config_flow.py index 37923c574b4..ac466223fb6 100644 --- a/homeassistant/components/zwave_js/config_flow.py +++ b/homeassistant/components/zwave_js/config_flow.py @@ -117,7 +117,15 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): await self.async_set_unique_id( version_info.home_id, raise_on_progress=False ) - self._abort_if_unique_id_configured(user_input) + # Make sure we disable any add-on handling + # if the controller is reconfigured in a manual step. + self._abort_if_unique_id_configured( + updates={ + **user_input, + CONF_USE_ADDON: False, + CONF_INTEGRATION_CREATED_ADDON: False, + } + ) self.ws_address = user_input[CONF_URL] return self._async_create_entry_from_vars() diff --git a/tests/components/zwave_js/test_config_flow.py b/tests/components/zwave_js/test_config_flow.py index fc97f7420cf..c6b59e07412 100644 --- a/tests/components/zwave_js/test_config_flow.py +++ b/tests/components/zwave_js/test_config_flow.py @@ -184,7 +184,16 @@ async def test_manual_errors( async def test_manual_already_configured(hass): """Test that only one unique instance is allowed.""" - entry = MockConfigEntry(domain=DOMAIN, data={}, title=TITLE, unique_id=1234) + entry = MockConfigEntry( + domain=DOMAIN, + data={ + "url": "ws://localhost:3000", + "use_addon": True, + "integration_created_addon": True, + }, + title=TITLE, + unique_id=1234, + ) entry.add_to_hass(hass) await setup.async_setup_component(hass, "persistent_notification", {}) @@ -198,12 +207,15 @@ async def test_manual_already_configured(hass): result = await hass.config_entries.flow.async_configure( result["flow_id"], { - "url": "ws://localhost:3000", + "url": "ws://1.1.1.1:3001", }, ) assert result["type"] == "abort" assert result["reason"] == "already_configured" + assert entry.data["url"] == "ws://1.1.1.1:3001" + assert entry.data["use_addon"] is False + assert entry.data["integration_created_addon"] is False @pytest.mark.parametrize("discovery_info", [{"config": ADDON_DISCOVERY_INFO}])