Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions homeassistant/components/config/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"])

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ def _async_in_progress(self) -> List[Dict]:
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."""
Expand Down
2 changes: 2 additions & 0 deletions tests/components/config/test_config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ async def async_step_user(self, user_input=None):
"id": 5,
"type": "config_entries/ignore_flow",
"flow_id": result["flow_id"],
"title": "Test Integration",
}
)
response = await ws_client.receive_json()
Expand All @@ -761,3 +762,4 @@ async def async_step_user(self, user_input=None):
entry = hass.config_entries.async_entries("test")[0]
assert entry.source == "ignore"
assert entry.unique_id == "mock-unique-id"
assert entry.title == "Test Integration"
2 changes: 1 addition & 1 deletion tests/helpers/test_config_entry_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions tests/test_config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ async def async_step_user(self, user_input=None):
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
Expand All @@ -1537,6 +1537,7 @@ async def async_step_user(self, user_input=None):

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):
Expand Down Expand Up @@ -1605,14 +1606,15 @@ async def async_step_unignore(self, user_input):
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

entry = hass.config_entries.async_entries("comp")[0]
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)

Expand Down Expand Up @@ -1649,14 +1651,15 @@ async def async_step_unignore(self, user_input):
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

entry = hass.config_entries.async_entries("comp")[0]
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)

Expand Down Expand Up @@ -1690,14 +1693,15 @@ class TestFlow(config_entries.ConfigFlow):
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

entry = hass.config_entries.async_entries("comp")[0]
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()
Expand Down