diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index e5a36b980ed..232d3e5cbf1 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -5,7 +5,6 @@ import asyncio from collections import ChainMap from collections.abc import Callable, Coroutine, Iterable, Mapping from contextvars import ContextVar -import dataclasses from enum import Enum import functools import logging @@ -1446,13 +1445,19 @@ class ConfigFlow(data_entry_flow.FlowHandler): if self._async_in_progress(include_uninitialized=True): raise data_entry_flow.AbortFlow("already_in_progress") - async def async_step_discovery( - self, discovery_info: DiscoveryInfoType + async def _async_step_discovery_without_unique_id( + self, ) -> data_entry_flow.FlowResult: """Handle a flow initialized by discovery.""" await self._async_handle_discovery_without_unique_id() return await self.async_step_user() + async def async_step_discovery( + self, discovery_info: DiscoveryInfoType + ) -> data_entry_flow.FlowResult: + """Handle a flow initialized by discovery.""" + return await self._async_step_discovery_without_unique_id() + @callback def async_abort( self, @@ -1481,55 +1486,55 @@ class ConfigFlow(data_entry_flow.FlowHandler): self, discovery_info: BluetoothServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by Bluetooth discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() async def async_step_dhcp( self, discovery_info: DhcpServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by DHCP discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() async def async_step_hassio( self, discovery_info: HassioServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by HASS IO discovery.""" - return await self.async_step_discovery(discovery_info.config) + return await self._async_step_discovery_without_unique_id() async def async_step_integration_discovery( self, discovery_info: DiscoveryInfoType ) -> data_entry_flow.FlowResult: """Handle a flow initialized by integration specific discovery.""" - return await self.async_step_discovery(discovery_info) + return await self._async_step_discovery_without_unique_id() async def async_step_homekit( self, discovery_info: ZeroconfServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by Homekit discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() async def async_step_mqtt( self, discovery_info: MqttServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by MQTT discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() async def async_step_ssdp( self, discovery_info: SsdpServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by SSDP discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() async def async_step_usb( self, discovery_info: UsbServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by USB discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() async def async_step_zeroconf( self, discovery_info: ZeroconfServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by Zeroconf discovery.""" - return await self.async_step_discovery(dataclasses.asdict(discovery_info)) + return await self._async_step_discovery_without_unique_id() @callback def async_create_entry(