From 99568b133f3aef057cc03fbfa7b4538a47f32ce7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 15 Feb 2022 18:25:43 -0600 Subject: [PATCH] Switch flux_led to use integration discovery (#66574) --- homeassistant/components/flux_led/config_flow.py | 4 ++-- homeassistant/components/flux_led/discovery.py | 2 +- tests/components/flux_led/test_config_flow.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/flux_led/config_flow.py b/homeassistant/components/flux_led/config_flow.py index 9b1cda2dea1..ee8da5bd66a 100644 --- a/homeassistant/components/flux_led/config_flow.py +++ b/homeassistant/components/flux_led/config_flow.py @@ -81,10 +81,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): ) return await self._async_handle_discovery() - async def async_step_discovery( + async def async_step_integration_discovery( self, discovery_info: DiscoveryInfoType ) -> FlowResult: - """Handle discovery.""" + """Handle integration discovery.""" self._discovered_device = cast(FluxLEDDiscovery, discovery_info) return await self._async_handle_discovery() diff --git a/homeassistant/components/flux_led/discovery.py b/homeassistant/components/flux_led/discovery.py index c30418fa8e4..cd0d9424ead 100644 --- a/homeassistant/components/flux_led/discovery.py +++ b/homeassistant/components/flux_led/discovery.py @@ -213,7 +213,7 @@ def async_trigger_discovery( hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, - context={"source": config_entries.SOURCE_DISCOVERY}, + context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY}, data={**device}, ) ) diff --git a/tests/components/flux_led/test_config_flow.py b/tests/components/flux_led/test_config_flow.py index 0ff8180a761..b858f6d995a 100644 --- a/tests/components/flux_led/test_config_flow.py +++ b/tests/components/flux_led/test_config_flow.py @@ -382,7 +382,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): with _patch_discovery(), _patch_wifibulb(): result = await hass.config_entries.flow.async_init( DOMAIN, - context={"source": config_entries.SOURCE_DISCOVERY}, + context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY}, data=FLUX_DISCOVERY, ) await hass.async_block_till_done() @@ -420,7 +420,7 @@ async def test_discovered_by_discovery(hass): with _patch_discovery(), _patch_wifibulb(): result = await hass.config_entries.flow.async_init( DOMAIN, - context={"source": config_entries.SOURCE_DISCOVERY}, + context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY}, data=FLUX_DISCOVERY, ) await hass.async_block_till_done() @@ -567,7 +567,7 @@ async def test_discovered_by_dhcp_no_udp_response_or_tcp_response(hass): "source, data", [ (config_entries.SOURCE_DHCP, DHCP_DISCOVERY), - (config_entries.SOURCE_DISCOVERY, FLUX_DISCOVERY), + (config_entries.SOURCE_INTEGRATION_DISCOVERY, FLUX_DISCOVERY), ], ) async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id( @@ -593,7 +593,7 @@ async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id( "source, data", [ (config_entries.SOURCE_DHCP, DHCP_DISCOVERY), - (config_entries.SOURCE_DISCOVERY, FLUX_DISCOVERY), + (config_entries.SOURCE_INTEGRATION_DISCOVERY, FLUX_DISCOVERY), ], ) async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already_configured(