mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Don't create persistent notification when starting discovery flow (#141546)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
@ -30,7 +30,6 @@ from propcache.api import cached_property
|
||||
import voluptuous as vol
|
||||
|
||||
from . import data_entry_flow, loader
|
||||
from .components import persistent_notification
|
||||
from .const import (
|
||||
CONF_NAME,
|
||||
EVENT_HOMEASSISTANT_STARTED,
|
||||
@ -178,7 +177,6 @@ class ConfigEntryState(Enum):
|
||||
|
||||
|
||||
DEFAULT_DISCOVERY_UNIQUE_ID = "default_discovery_unique_id"
|
||||
DISCOVERY_NOTIFICATION_ID = "config_entry_discovery"
|
||||
DISCOVERY_SOURCES = {
|
||||
SOURCE_BLUETOOTH,
|
||||
SOURCE_DHCP,
|
||||
@ -1385,14 +1383,6 @@ class ConfigEntriesFlowManager(
|
||||
|
||||
await asyncio.wait(current.values())
|
||||
|
||||
@callback
|
||||
def _async_has_other_discovery_flows(self, flow_id: str) -> bool:
|
||||
"""Check if there are any other discovery flows in progress."""
|
||||
for flow in self._progress.values():
|
||||
if flow.flow_id != flow_id and flow.context["source"] in DISCOVERY_SOURCES:
|
||||
return True
|
||||
return False
|
||||
|
||||
async def async_init(
|
||||
self,
|
||||
handler: str,
|
||||
@ -1527,10 +1517,6 @@ class ConfigEntriesFlowManager(
|
||||
# init to be done.
|
||||
self._set_pending_import_done(flow)
|
||||
|
||||
# Remove notification if no other discovery config entries in progress
|
||||
if not self._async_has_other_discovery_flows(flow.flow_id):
|
||||
persistent_notification.async_dismiss(self.hass, DISCOVERY_NOTIFICATION_ID)
|
||||
|
||||
# Clean up issue if this is a reauth flow
|
||||
if flow.context["source"] == SOURCE_REAUTH:
|
||||
if (entry_id := flow.context.get("entry_id")) is not None and (
|
||||
@ -1719,15 +1705,6 @@ class ConfigEntriesFlowManager(
|
||||
# async_fire_internal is used here because this is only
|
||||
# called from the Debouncer so we know the usage is safe
|
||||
self.hass.bus.async_fire_internal(EVENT_FLOW_DISCOVERED)
|
||||
persistent_notification.async_create(
|
||||
self.hass,
|
||||
title="New devices discovered",
|
||||
message=(
|
||||
"We have discovered new devices on your network. "
|
||||
"[Check it out](/config/integrations)."
|
||||
),
|
||||
notification_id=DISCOVERY_NOTIFICATION_ID,
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_has_matching_discovery_flow(
|
||||
|
Reference in New Issue
Block a user