diff --git a/homeassistant/components/config/config_entries.py b/homeassistant/components/config/config_entries.py index f67bfb98641..b8d9944d7af 100644 --- a/homeassistant/components/config/config_entries.py +++ b/homeassistant/components/config/config_entries.py @@ -318,7 +318,9 @@ async def config_entry_update(hass, connection, msg): @websocket_api.require_admin @websocket_api.async_response -@websocket_api.websocket_command({"type": "config_entries/ignore_flow", "flow_id": str}) +@websocket_api.websocket_command( + {"type": "config_entries/ignore_flow", "flow_id": str, "title": str} +) async def ignore_config_flow(hass, connection, msg): """Ignore a config flow.""" flow = next( @@ -345,7 +347,7 @@ async def ignore_config_flow(hass, connection, msg): await hass.config_entries.flow.async_init( flow["handler"], context={"source": config_entries.SOURCE_IGNORE}, - data={"unique_id": flow["context"]["unique_id"]}, + data={"unique_id": flow["context"]["unique_id"], "title": msg["title"]}, ) connection.send_result(msg["id"]) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 601ce1efbfe..f87e76edec8 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -975,7 +975,7 @@ class ConfigFlow(data_entry_flow.FlowHandler): async def async_step_ignore(self, user_input: Dict[str, Any]) -> Dict[str, Any]: """Ignore this config flow.""" await self.async_set_unique_id(user_input["unique_id"], raise_on_progress=False) - return self.async_create_entry(title="Ignored", data={}) + return self.async_create_entry(title=user_input["title"], data={}) async def async_step_unignore(self, user_input: Dict[str, Any]) -> Dict[str, Any]: """Rediscover a config entry by it's unique_id.""" diff --git a/tests/components/config/test_config_entries.py b/tests/components/config/test_config_entries.py index 6873bc8311a..87b1559a21b 100644 --- a/tests/components/config/test_config_entries.py +++ b/tests/components/config/test_config_entries.py @@ -750,6 +750,7 @@ async def test_ignore_flow(hass, hass_ws_client): "id": 5, "type": "config_entries/ignore_flow", "flow_id": result["flow_id"], + "title": "Test Integration", } ) response = await ws_client.receive_json() @@ -761,3 +762,4 @@ async def test_ignore_flow(hass, hass_ws_client): entry = hass.config_entries.async_entries("test")[0] assert entry.source == "ignore" assert entry.unique_id == "mock-unique-id" + assert entry.title == "Test Integration" diff --git a/tests/helpers/test_config_entry_flow.py b/tests/helpers/test_config_entry_flow.py index a70f6ad8d5c..b5ba206f908 100644 --- a/tests/helpers/test_config_entry_flow.py +++ b/tests/helpers/test_config_entry_flow.py @@ -220,7 +220,7 @@ async def test_ignored_discoveries(hass, discovery_flow_conf): await hass.config_entries.flow.async_init( flow["handler"], context={"source": config_entries.SOURCE_IGNORE}, - data={"unique_id": flow["context"]["unique_id"]}, + data={"unique_id": flow["context"]["unique_id"], "title": "Ignored Entry"}, ) # Second discovery should be aborted diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index a048f5a7043..56387069fe4 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -1523,7 +1523,7 @@ async def test_unique_id_ignore(hass, manager): result2 = await manager.flow.async_init( "comp", context={"source": config_entries.SOURCE_IGNORE}, - data={"unique_id": "mock-unique-id"}, + data={"unique_id": "mock-unique-id", "title": "Ignored Title"}, ) assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY @@ -1537,6 +1537,7 @@ async def test_unique_id_ignore(hass, manager): assert entry.source == "ignore" assert entry.unique_id == "mock-unique-id" + assert entry.title == "Ignored Title" async def test_manual_add_overrides_ignored_entry(hass, manager): @@ -1605,7 +1606,7 @@ async def test_unignore_step_form(hass, manager): result = await manager.flow.async_init( "comp", context={"source": config_entries.SOURCE_IGNORE}, - data={"unique_id": "mock-unique-id"}, + data={"unique_id": "mock-unique-id", "title": "Ignored Title"}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY @@ -1613,6 +1614,7 @@ async def test_unignore_step_form(hass, manager): assert entry.source == "ignore" assert entry.unique_id == "mock-unique-id" assert entry.domain == "comp" + assert entry.title == "Ignored Title" await manager.async_remove(entry.entry_id) @@ -1649,7 +1651,7 @@ async def test_unignore_create_entry(hass, manager): result = await manager.flow.async_init( "comp", context={"source": config_entries.SOURCE_IGNORE}, - data={"unique_id": "mock-unique-id"}, + data={"unique_id": "mock-unique-id", "title": "Ignored Title"}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY @@ -1657,6 +1659,7 @@ async def test_unignore_create_entry(hass, manager): assert entry.source == "ignore" assert entry.unique_id == "mock-unique-id" assert entry.domain == "comp" + assert entry.title == "Ignored Title" await manager.async_remove(entry.entry_id) @@ -1690,7 +1693,7 @@ async def test_unignore_default_impl(hass, manager): result = await manager.flow.async_init( "comp", context={"source": config_entries.SOURCE_IGNORE}, - data={"unique_id": "mock-unique-id"}, + data={"unique_id": "mock-unique-id", "title": "Ignored Title"}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY @@ -1698,6 +1701,7 @@ async def test_unignore_default_impl(hass, manager): assert entry.source == "ignore" assert entry.unique_id == "mock-unique-id" assert entry.domain == "comp" + assert entry.title == "Ignored Title" await manager.async_remove(entry.entry_id) await hass.async_block_till_done()