diff --git a/homeassistant/components/speedtestdotnet/__init__.py b/homeassistant/components/speedtestdotnet/__init__.py index 17238f7481081f..8cf32def197dd6 100644 --- a/homeassistant/components/speedtestdotnet/__init__.py +++ b/homeassistant/components/speedtestdotnet/__init__.py @@ -8,9 +8,8 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_STARTED -from homeassistant.core import CoreState, HomeAssistant, ServiceCall +from homeassistant.core import CoreState, HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady -from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .const import ( @@ -20,7 +19,6 @@ DEFAULT_SERVER, DOMAIN, PLATFORMS, - SPEED_TEST_SERVICE, ) _LOGGER = logging.getLogger(__name__) @@ -58,8 +56,6 @@ async def _enable_scheduled_speedtests(*_): async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Unload SpeedTest Entry from config_entry.""" - hass.services.async_remove(DOMAIN, SPEED_TEST_SERVICE) - unload_ok = await hass.config_entries.async_unload_platforms( config_entry, PLATFORMS ) @@ -141,30 +137,6 @@ async def async_setup(self) -> None: except speedtest.SpeedtestException as err: raise ConfigEntryNotReady from err - async def request_update(call: ServiceCall) -> None: - """Request update.""" - async_create_issue( - self.hass, - DOMAIN, - "deprecated_service", - breaks_in_ha_version="2022.11.0", - is_fixable=True, - is_persistent=True, - severity=IssueSeverity.WARNING, - translation_key="deprecated_service", - ) - - _LOGGER.warning( - ( - 'The "%s" service is deprecated and will be removed in "2022.11.0"; ' - 'use the "homeassistant.update_entity" service and pass it a target Speedtest entity_id' - ), - SPEED_TEST_SERVICE, - ) - await self.async_request_refresh() - - self.hass.services.async_register(DOMAIN, SPEED_TEST_SERVICE, request_update) - self.config_entry.async_on_unload( self.config_entry.add_update_listener(options_updated_listener) ) diff --git a/homeassistant/components/speedtestdotnet/const.py b/homeassistant/components/speedtestdotnet/const.py index e2455ad63df09f..e6ced462b4524f 100644 --- a/homeassistant/components/speedtestdotnet/const.py +++ b/homeassistant/components/speedtestdotnet/const.py @@ -14,8 +14,6 @@ DOMAIN: Final = "speedtestdotnet" -SPEED_TEST_SERVICE: Final = "speedtest" - @dataclass class SpeedtestSensorEntityDescription(SensorEntityDescription): diff --git a/homeassistant/components/speedtestdotnet/services.yaml b/homeassistant/components/speedtestdotnet/services.yaml deleted file mode 100644 index fdc6be746f865e..00000000000000 --- a/homeassistant/components/speedtestdotnet/services.yaml +++ /dev/null @@ -1,3 +0,0 @@ -speedtest: - name: Speedtest - description: Immediately execute a speed test with Speedtest.net diff --git a/homeassistant/components/speedtestdotnet/strings.json b/homeassistant/components/speedtestdotnet/strings.json index d4117d82cf3821..c4dad30cb096a1 100644 --- a/homeassistant/components/speedtestdotnet/strings.json +++ b/homeassistant/components/speedtestdotnet/strings.json @@ -19,18 +19,5 @@ } } } - }, - "issues": { - "deprecated_service": { - "title": "The speedtest service is being removed", - "fix_flow": { - "step": { - "confirm": { - "title": "The speedtest service is being removed", - "description": "Update any automations or scripts that use this service to instead use the `homeassistant.update_entity` service with a target Speedtest entity_id. Then, click SUBMIT below to mark this issue as resolved." - } - } - } - } } } diff --git a/tests/components/speedtestdotnet/test_init.py b/tests/components/speedtestdotnet/test_init.py index b4186ecacef4d7..4b8071ad1eaada 100644 --- a/tests/components/speedtestdotnet/test_init.py +++ b/tests/components/speedtestdotnet/test_init.py @@ -1,11 +1,8 @@ """Tests for SpeedTest integration.""" -from collections.abc import Awaitable from datetime import timedelta -from typing import Callable from unittest.mock import MagicMock -from aiohttp import ClientWebSocketResponse import speedtest from homeassistant.components.speedtestdotnet.const import ( @@ -13,7 +10,6 @@ CONF_SERVER_ID, CONF_SERVER_NAME, DOMAIN, - SPEED_TEST_SERVICE, ) from homeassistant.config_entries import ConfigEntryState from homeassistant.const import CONF_SCAN_INTERVAL, STATE_UNAVAILABLE @@ -21,7 +17,6 @@ import homeassistant.util.dt as dt_util from tests.common import MockConfigEntry, async_fire_time_changed -from tests.components.repairs import get_repairs async def test_successful_config_entry(hass: HomeAssistant) -> None: @@ -43,7 +38,6 @@ async def test_successful_config_entry(hass: HomeAssistant) -> None: assert entry.state == ConfigEntryState.LOADED assert hass.data[DOMAIN] - assert hass.services.has_service(DOMAIN, SPEED_TEST_SERVICE) async def test_setup_failed(hass: HomeAssistant, mock_api: MagicMock) -> None: @@ -125,28 +119,3 @@ async def test_get_best_server_error(hass: HomeAssistant, mock_api: MagicMock) - state = hass.states.get("sensor.speedtest_ping") assert state is not None assert state.state == STATE_UNAVAILABLE - - -async def test_deprecated_service_alert( - hass: HomeAssistant, - hass_ws_client: Callable[[HomeAssistant], Awaitable[ClientWebSocketResponse]], -) -> None: - """Test that an issue is raised if deprecated services is called.""" - entry = MockConfigEntry( - domain=DOMAIN, - ) - entry.add_to_hass(hass) - - await hass.config_entries.async_setup(entry.entry_id) - await hass.async_block_till_done() - - await hass.services.async_call( - DOMAIN, - "speedtest", - {}, - blocking=True, - ) - await hass.async_block_till_done() - issues = await get_repairs(hass, hass_ws_client) - assert len(issues) == 1 - assert issues[0]["issue_id"] == "deprecated_service"