@@ -572,3 +572,46 @@ async def test_discovered_during_onboarding(hass: HomeAssistant, source, data) -
572572 }
573573 assert len (mock_setup .mock_calls ) == 1
574574 assert len (mock_setup_entry .mock_calls ) == 1
575+
576+
577+ async def test_flow_replace_ignored_device (hass : HomeAssistant ) -> None :
578+ """Test we can replace an ignored device via discovery."""
579+ # Add ignored entry to simulate previously ignored device
580+ entry = MockConfigEntry (
581+ domain = DOMAIN ,
582+ unique_id = FAKE_MAC ,
583+ source = config_entries .SOURCE_IGNORE ,
584+ )
585+ entry .add_to_hass (hass )
586+ # Patch discovery to find the same ignored device
587+ with _patch_discovery (), _patch_wizlight ():
588+ result = await hass .config_entries .flow .async_init (
589+ DOMAIN , context = {"source" : config_entries .SOURCE_USER }
590+ )
591+ result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
592+ await hass .async_block_till_done ()
593+ assert result ["type" ] is FlowResultType .FORM
594+ assert result ["step_id" ] == "pick_device"
595+ # Proceed with selecting the device — previously ignored
596+ with (
597+ _patch_wizlight (),
598+ patch (
599+ "homeassistant.components.wiz.async_setup_entry" ,
600+ return_value = True ,
601+ ) as mock_setup_entry ,
602+ patch (
603+ "homeassistant.components.wiz.async_setup" ,
604+ return_value = True ,
605+ ) as mock_setup ,
606+ ):
607+ result = await hass .config_entries .flow .async_configure (
608+ result ["flow_id" ], user_input = {CONF_DEVICE : FAKE_MAC }
609+ )
610+ await hass .async_block_till_done ()
611+ assert result ["type" ] is FlowResultType .CREATE_ENTRY
612+ assert result ["title" ] == "WiZ Dimmable White ABCABC"
613+ assert result ["data" ] == {
614+ CONF_HOST : "1.1.1.1" ,
615+ }
616+ assert len (mock_setup .mock_calls ) == 1
617+ assert len (mock_setup_entry .mock_calls ) == 1
0 commit comments