Skip to content
Closed
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
14 changes: 6 additions & 8 deletions homeassistant/components/config/config_entries.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Http views to control the config manager."""
from typing import Any, Dict, Optional

import aiohttp.web_exceptions
import voluptuous as vol
import voluptuous_serialize
Expand Down Expand Up @@ -312,16 +314,12 @@ async def ignore_config_flow(hass, connection, msg):
)
return

if "unique_id" not in flow["context"]:
connection.send_error(
msg["id"], "no_unique_id", "Specified flow has no unique ID."
)
return
data: Optional[Dict[str, Any]] = None
if "unique_id" in flow["context"]:
data = {"unique_id": flow["context"]["unique_id"]}

await hass.config_entries.flow.async_init(
flow["handler"],
context={"source": config_entries.SOURCE_IGNORE},
data={"unique_id": flow["context"]["unique_id"]},
flow["handler"], context={"source": config_entries.SOURCE_IGNORE}, data=data,
)
connection.send_result(msg["id"])

Expand Down
9 changes: 7 additions & 2 deletions homeassistant/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,14 @@ def _async_in_progress(self) -> List[Dict]:
if flw["handler"] == self.handler and flw["flow_id"] != self.flow_id
]

async def async_step_ignore(self, user_input: Dict[str, Any]) -> Dict[str, Any]:
async def async_step_ignore(
self, user_input: Optional[Dict[str, Any]]
) -> Dict[str, Any]:
"""Ignore this config flow."""
await self.async_set_unique_id(user_input["unique_id"], raise_on_progress=False)
if user_input is not None and "unique_id" in user_input:
await self.async_set_unique_id(
user_input["unique_id"], raise_on_progress=False
)
return self.async_create_entry(title="Ignored", data={})

async def async_step_unignore(self, user_input: Dict[str, Any]) -> Dict[str, Any]:
Expand Down