From 14664719d98b2cb1e7cbee71ede9baf4bf1ad2c9 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 5 Jun 2025 18:02:11 +0200 Subject: [PATCH] Remove zeroconf discovery from Spotify (#146213) --- .../components/spotify/manifest.json | 3 +- homeassistant/components/spotify/strings.json | 3 -- homeassistant/generated/zeroconf.py | 5 --- tests/components/spotify/test_config_flow.py | 41 +------------------ 4 files changed, 2 insertions(+), 50 deletions(-) diff --git a/homeassistant/components/spotify/manifest.json b/homeassistant/components/spotify/manifest.json index 27b8da7cecf..80fcc777e73 100644 --- a/homeassistant/components/spotify/manifest.json +++ b/homeassistant/components/spotify/manifest.json @@ -8,6 +8,5 @@ "integration_type": "service", "iot_class": "cloud_polling", "loggers": ["spotifyaio"], - "requirements": ["spotifyaio==0.8.11"], - "zeroconf": ["_spotify-connect._tcp.local."] + "requirements": ["spotifyaio==0.8.11"] } diff --git a/homeassistant/components/spotify/strings.json b/homeassistant/components/spotify/strings.json index 303942803be..66d837c503f 100644 --- a/homeassistant/components/spotify/strings.json +++ b/homeassistant/components/spotify/strings.json @@ -7,9 +7,6 @@ "reauth_confirm": { "title": "[%key:common::config_flow::title::reauth%]", "description": "The Spotify integration needs to re-authenticate with Spotify for account: {account}" - }, - "oauth_discovery": { - "description": "Home Assistant has found Spotify on your network. Press **Submit** to continue setting up Spotify." } }, "abort": { diff --git a/homeassistant/generated/zeroconf.py b/homeassistant/generated/zeroconf.py index ed5ac37c0cd..e675a0bb237 100644 --- a/homeassistant/generated/zeroconf.py +++ b/homeassistant/generated/zeroconf.py @@ -865,11 +865,6 @@ ZEROCONF = { "domain": "soundtouch", }, ], - "_spotify-connect._tcp.local.": [ - { - "domain": "spotify", - }, - ], "_ssh._tcp.local.": [ { "domain": "smappee", diff --git a/tests/components/spotify/test_config_flow.py b/tests/components/spotify/test_config_flow.py index 0f48002e5db..31842253c0c 100644 --- a/tests/components/spotify/test_config_flow.py +++ b/tests/components/spotify/test_config_flow.py @@ -1,33 +1,21 @@ """Tests for the Spotify config flow.""" from http import HTTPStatus -from ipaddress import ip_address from unittest.mock import MagicMock, patch import pytest from spotifyaio import SpotifyConnectionError from homeassistant.components.spotify.const import DOMAIN -from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF +from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType from homeassistant.helpers import config_entry_oauth2_flow -from homeassistant.helpers.service_info.zeroconf import ZeroconfServiceInfo from tests.common import MockConfigEntry from tests.test_util.aiohttp import AiohttpClientMocker from tests.typing import ClientSessionGenerator -BLANK_ZEROCONF_INFO = ZeroconfServiceInfo( - ip_address=ip_address("1.2.3.4"), - ip_addresses=[ip_address("1.2.3.4")], - hostname="mock_hostname", - name="mock_name", - port=None, - properties={}, - type="mock_type", -) - async def test_abort_if_no_configuration(hass: HomeAssistant) -> None: """Check flow aborts when no configuration is present.""" @@ -39,18 +27,6 @@ async def test_abort_if_no_configuration(hass: HomeAssistant) -> None: assert result["reason"] == "missing_credentials" -async def test_zeroconf_abort_if_existing_entry(hass: HomeAssistant) -> None: - """Check zeroconf flow aborts when an entry already exist.""" - MockConfigEntry(domain=DOMAIN).add_to_hass(hass) - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_ZEROCONF}, data=BLANK_ZEROCONF_INFO - ) - - assert result["type"] is FlowResultType.ABORT - assert result["reason"] == "already_configured" - - @pytest.mark.usefixtures("current_request_with_host") @pytest.mark.usefixtures("setup_credentials") async def test_full_flow( @@ -258,18 +234,3 @@ async def test_reauth_account_mismatch( assert result["type"] is FlowResultType.ABORT assert result["reason"] == "reauth_account_mismatch" - - -async def test_zeroconf(hass: HomeAssistant) -> None: - """Check zeroconf flow aborts when an entry already exist.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_ZEROCONF}, data=BLANK_ZEROCONF_INFO - ) - - assert result["type"] is FlowResultType.FORM - assert result["step_id"] == "oauth_discovery" - - result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - - assert result["type"] is FlowResultType.ABORT - assert result["reason"] == "missing_credentials"