diff --git a/homeassistant/components/fastdotcom/__init__.py b/homeassistant/components/fastdotcom/__init__.py index 12bd355b82b..4074e9a479d 100644 --- a/homeassistant/components/fastdotcom/__init__.py +++ b/homeassistant/components/fastdotcom/__init__.py @@ -4,46 +4,23 @@ from __future__ import annotations import logging -import voluptuous as vol - -from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry -from homeassistant.const import CONF_SCAN_INTERVAL +from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.start import async_at_started from homeassistant.helpers.typing import ConfigType -from .const import CONF_MANUAL, DEFAULT_INTERVAL, DOMAIN, PLATFORMS +from .const import DOMAIN, PLATFORMS from .coordinator import FastdotcomDataUpdateCoordinator from .services import async_setup_services _LOGGER = logging.getLogger(__name__) -CONFIG_SCHEMA = vol.Schema( - { - DOMAIN: vol.Schema( - { - vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_INTERVAL): vol.All( - cv.time_period, cv.positive_timedelta - ), - vol.Optional(CONF_MANUAL, default=False): cv.boolean, - } - ) - }, - extra=vol.ALLOW_EXTRA, -) +CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Fastdotcom component.""" - if DOMAIN in config: - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data=config[DOMAIN], - ) - ) async_setup_services(hass) return True diff --git a/homeassistant/components/fastdotcom/config_flow.py b/homeassistant/components/fastdotcom/config_flow.py index 36b6f81ae5b..b84c30cf58d 100644 --- a/homeassistant/components/fastdotcom/config_flow.py +++ b/homeassistant/components/fastdotcom/config_flow.py @@ -5,8 +5,6 @@ from __future__ import annotations from typing import Any from homeassistant.config_entries import ConfigFlow, ConfigFlowResult -from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN -from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from .const import DEFAULT_NAME, DOMAIN @@ -24,24 +22,3 @@ class FastdotcomConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_create_entry(title=DEFAULT_NAME, data={}) return self.async_show_form(step_id="user") - - async def async_step_import( - self, user_input: dict[str, Any] | None = None - ) -> ConfigFlowResult: - """Handle a flow initiated by configuration file.""" - async_create_issue( - self.hass, - HOMEASSISTANT_DOMAIN, - f"deprecated_yaml_{DOMAIN}", - breaks_in_ha_version="2024.6.0", - is_fixable=False, - issue_domain=DOMAIN, - severity=IssueSeverity.WARNING, - translation_key="deprecated_yaml", - translation_placeholders={ - "domain": DOMAIN, - "integration_title": "Fast.com", - }, - ) - - return await self.async_step_user(user_input) diff --git a/tests/components/fastdotcom/test_config_flow.py b/tests/components/fastdotcom/test_config_flow.py index db28aaec703..88dda3a4aae 100644 --- a/tests/components/fastdotcom/test_config_flow.py +++ b/tests/components/fastdotcom/test_config_flow.py @@ -4,7 +4,6 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries from homeassistant.components.fastdotcom.const import DOMAIN from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER from homeassistant.core import HomeAssistant @@ -54,19 +53,3 @@ async def test_single_instance_allowed( assert result["type"] is FlowResultType.ABORT assert result["reason"] == "single_instance_allowed" - - -async def test_import_flow_success(hass: HomeAssistant) -> None: - """Test import flow.""" - with patch("homeassistant.components.fastdotcom.coordinator.fast_com"): - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_IMPORT}, - data={}, - ) - await hass.async_block_till_done() - - assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["title"] == "Fast.com" - assert result["data"] == {} - assert result["options"] == {} diff --git a/tests/components/fastdotcom/test_init.py b/tests/components/fastdotcom/test_init.py index c17b455057b..b1be0b53d34 100644 --- a/tests/components/fastdotcom/test_init.py +++ b/tests/components/fastdotcom/test_init.py @@ -11,7 +11,6 @@ from homeassistant.config_entries import ConfigEntryState from homeassistant.const import EVENT_HOMEASSISTANT_STARTED, STATE_UNKNOWN from homeassistant.core import CoreState, HomeAssistant from homeassistant.helpers import issue_registry as ir -from homeassistant.setup import async_setup_component from tests.common import MockConfigEntry @@ -37,23 +36,6 @@ async def test_unload_entry(hass: HomeAssistant) -> None: assert config_entry.state is ConfigEntryState.NOT_LOADED -async def test_from_import(hass: HomeAssistant) -> None: - """Test imported entry.""" - with patch( - "homeassistant.components.fastdotcom.coordinator.fast_com", return_value=5.0 - ): - await async_setup_component( - hass, - DOMAIN, - {"fastdotcom": {}}, - ) - await hass.async_block_till_done() - - state = hass.states.get("sensor.fast_com_download") - assert state is not None - assert state.state == "5.0" - - async def test_delayed_speedtest_during_startup( hass: HomeAssistant, freezer: FrozenDateTimeFactory ) -> None: