mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Remove ConfigEntriesFlowManager.async_post_init
(#142463)
Remove ConfigEntriesFlowManager.async_post_init
This commit is contained in:
parent
2ed70ef241
commit
33fa8df73e
@ -1367,12 +1367,12 @@ class ConfigEntriesFlowManager(
|
|||||||
self._initialize_futures: defaultdict[str, set[asyncio.Future[None]]] = (
|
self._initialize_futures: defaultdict[str, set[asyncio.Future[None]]] = (
|
||||||
defaultdict(set)
|
defaultdict(set)
|
||||||
)
|
)
|
||||||
self._discovery_debouncer = Debouncer[None](
|
self._discovery_event_debouncer = Debouncer[None](
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
cooldown=DISCOVERY_COOLDOWN,
|
cooldown=DISCOVERY_COOLDOWN,
|
||||||
immediate=True,
|
immediate=True,
|
||||||
function=self._async_discovery,
|
function=self._async_fire_discovery_event,
|
||||||
background=True,
|
background=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1454,8 +1454,12 @@ class ConfigEntriesFlowManager(
|
|||||||
if not self._pending_import_flows[handler]:
|
if not self._pending_import_flows[handler]:
|
||||||
del self._pending_import_flows[handler]
|
del self._pending_import_flows[handler]
|
||||||
|
|
||||||
if result["type"] != data_entry_flow.FlowResultType.ABORT:
|
if (
|
||||||
await self.async_post_init(flow, result)
|
result["type"] != data_entry_flow.FlowResultType.ABORT
|
||||||
|
and source in DISCOVERY_SOURCES
|
||||||
|
):
|
||||||
|
# Fire discovery event
|
||||||
|
await self._discovery_event_debouncer.async_call()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -1497,7 +1501,7 @@ class ConfigEntriesFlowManager(
|
|||||||
for future_list in self._initialize_futures.values():
|
for future_list in self._initialize_futures.values():
|
||||||
for future in future_list:
|
for future in future_list:
|
||||||
future.set_result(None)
|
future.set_result(None)
|
||||||
self._discovery_debouncer.async_shutdown()
|
self._discovery_event_debouncer.async_shutdown()
|
||||||
|
|
||||||
async def async_finish_flow(
|
async def async_finish_flow(
|
||||||
self,
|
self,
|
||||||
@ -1691,21 +1695,9 @@ class ConfigEntriesFlowManager(
|
|||||||
flow.init_step = context["source"]
|
flow.init_step = context["source"]
|
||||||
return flow
|
return flow
|
||||||
|
|
||||||
async def async_post_init(
|
|
||||||
self,
|
|
||||||
flow: data_entry_flow.FlowHandler[ConfigFlowContext, ConfigFlowResult],
|
|
||||||
result: ConfigFlowResult,
|
|
||||||
) -> None:
|
|
||||||
"""After a flow is initialised trigger new flow notifications."""
|
|
||||||
source = flow.context["source"]
|
|
||||||
|
|
||||||
# Create notification.
|
|
||||||
if source in DISCOVERY_SOURCES:
|
|
||||||
await self._discovery_debouncer.async_call()
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_discovery(self) -> None:
|
def _async_fire_discovery_event(self) -> None:
|
||||||
"""Handle discovery."""
|
"""Fire discovery event."""
|
||||||
# async_fire_internal is used here because this is only
|
# async_fire_internal is used here because this is only
|
||||||
# called from the Debouncer so we know the usage is safe
|
# called from the Debouncer so we know the usage is safe
|
||||||
self.hass.bus.async_fire_internal(EVENT_FLOW_DISCOVERED)
|
self.hass.bus.async_fire_internal(EVENT_FLOW_DISCOVERED)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user