diff --git a/homeassistant/helpers/discovery_flow.py b/homeassistant/helpers/discovery_flow.py index 7ad9caa5a93..d3e65851deb 100644 --- a/homeassistant/helpers/discovery_flow.py +++ b/homeassistant/helpers/discovery_flow.py @@ -86,17 +86,20 @@ class FlowDispatcher: pending_flows = self.pending_flows self.pending_flows = {} self.started = True - init_coros = [ - _async_init_flow( - self.hass, flow_key.domain, flow_values.context, flow_values.data - ) + init_coros = ( + init_coro for flow_key, flows in pending_flows.items() for flow_values in flows - ] - await gather_with_limited_concurrency( - FLOW_INIT_LIMIT, - *[init_coro for init_coro in init_coros if init_coro is not None], + if ( + init_coro := _async_init_flow( + self.hass, + flow_key.domain, + flow_values.context, + flow_values.data, + ) + ) ) + await gather_with_limited_concurrency(FLOW_INIT_LIMIT, *init_coros) @callback def async_create(self, domain: str, context: dict[str, Any], data: Any) -> None: