From 350726d938a525b9d89c2500a9a59572a58d1c4c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 14 Feb 2020 15:47:14 -0800 Subject: [PATCH] Revert "For vizio integration, set unique ID early to prevent multiple zeroconf discovery items for the same device to appear (#31686)" This reverts commit 295963f8e8c554bf8b614dae06aca95ccc99ade6. --- homeassistant/components/vizio/config_flow.py | 5 ---- tests/components/vizio/test_config_flow.py | 26 ------------------- 2 files changed, 31 deletions(-) diff --git a/homeassistant/components/vizio/config_flow.py b/homeassistant/components/vizio/config_flow.py index 4fba0f06165..04f70da4a8c 100644 --- a/homeassistant/components/vizio/config_flow.py +++ b/homeassistant/components/vizio/config_flow.py @@ -205,11 +205,6 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): ) -> Dict[str, Any]: """Handle zeroconf discovery.""" - # Set unique ID early to prevent device from getting rediscovered multiple times - await self.async_set_unique_id( - unique_id=discovery_info[CONF_HOST].split(":")[0], raise_on_progress=True - ) - discovery_info[ CONF_HOST ] = f"{discovery_info[CONF_HOST]}:{discovery_info[CONF_PORT]}" diff --git a/tests/components/vizio/test_config_flow.py b/tests/components/vizio/test_config_flow.py index 044ca11bc8d..cf6cdb6afdb 100644 --- a/tests/components/vizio/test_config_flow.py +++ b/tests/components/vizio/test_config_flow.py @@ -506,29 +506,3 @@ async def test_zeroconf_flow_already_configured( # Flow should abort because device is already setup assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "already_setup" - - -async def test_zeroconf_dupe_fail( - hass: HomeAssistantType, - vizio_connect: pytest.fixture, - vizio_bypass_setup: pytest.fixture, - vizio_guess_device_type: pytest.fixture, -) -> None: - """Test zeroconf config flow when device gets discovered multiple times.""" - discovery_info = MOCK_ZEROCONF_SERVICE_INFO.copy() - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info - ) - - # Form should always show even if all required properties are discovered - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM - assert result["step_id"] == "user" - - discovery_info = MOCK_ZEROCONF_SERVICE_INFO.copy() - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info - ) - - # Flow should abort because device is already setup - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_in_progress"