diff --git a/homeassistant/components/met/config_flow.py b/homeassistant/components/met/config_flow.py index 42186a60bb9..6c4c4d33d5b 100644 --- a/homeassistant/components/met/config_flow.py +++ b/homeassistant/components/met/config_flow.py @@ -6,7 +6,6 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME from homeassistant.core import callback -from homeassistant.data_entry_flow import FlowResult import homeassistant.helpers.config_validation as cv from .const import ( @@ -79,10 +78,6 @@ class MetFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): errors=self._errors, ) - async def async_step_import(self, user_input: dict | None = None) -> FlowResult: - """Handle configuration by yaml file.""" - return await self.async_step_user(user_input) - async def async_step_onboarding(self, data=None): """Handle a flow initialized by onboarding.""" # Don't create entry if latitude or longitude isn't set. diff --git a/homeassistant/components/met/weather.py b/homeassistant/components/met/weather.py index d17bfda03f1..251d99ad295 100644 --- a/homeassistant/components/met/weather.py +++ b/homeassistant/components/met/weather.py @@ -1,12 +1,9 @@ """Support for Met.no weather service.""" from __future__ import annotations -import logging from types import MappingProxyType from typing import Any -import voluptuous as vol - from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, ATTR_FORECAST_TEMP, @@ -16,13 +13,11 @@ from homeassistant.components.weather import ( ATTR_WEATHER_TEMPERATURE, ATTR_WEATHER_WIND_BEARING, ATTR_WEATHER_WIND_SPEED, - PLATFORM_SCHEMA, Forecast, WeatherEntity, ) -from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( - CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, @@ -35,11 +30,9 @@ from homeassistant.const import ( TEMP_CELSIUS, ) from homeassistant.core import HomeAssistant -from homeassistant.helpers import config_validation as cv from homeassistant.helpers.device_registry import DeviceEntryType from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.util.distance import convert as convert_distance from homeassistant.util.pressure import convert as convert_pressure @@ -55,8 +48,6 @@ from .const import ( FORECAST_MAP, ) -_LOGGER = logging.getLogger(__name__) - ATTRIBUTION = ( "Weather forecast from met.no, delivered by the Norwegian " "Meteorological Institute." @@ -64,42 +55,6 @@ ATTRIBUTION = ( DEFAULT_NAME = "Met.no" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Inclusive( - CONF_LATITUDE, "coordinates", "Latitude and longitude must exist together" - ): cv.latitude, - vol.Inclusive( - CONF_LONGITUDE, "coordinates", "Latitude and longitude must exist together" - ): cv.longitude, - vol.Optional(CONF_ELEVATION): int, - } -) - - -async def async_setup_platform( - hass: HomeAssistant, - config: ConfigType, - async_add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the Met.no weather platform.""" - _LOGGER.warning("Loading Met.no via platform config is deprecated") - - # Add defaults. - config = {CONF_ELEVATION: hass.config.elevation, **config} - - if config.get(CONF_LATITUDE) is None: - config[CONF_TRACK_HOME] = True - - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=config - ) - ) - - async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, diff --git a/tests/components/met/test_config_flow.py b/tests/components/met/test_config_flow.py index ff5deb18194..358afe11cc2 100644 --- a/tests/components/met/test_config_flow.py +++ b/tests/components/met/test_config_flow.py @@ -125,21 +125,3 @@ async def test_onboarding_step_abort_no_home(hass, latitude, longitude): assert result["type"] == "abort" assert result["reason"] == "no_home" - - -async def test_import_step(hass): - """Test initializing via import step.""" - test_data = { - "name": "home", - CONF_LONGITUDE: None, - CONF_LATITUDE: None, - CONF_ELEVATION: 0, - "track_home": True, - } - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=test_data - ) - - assert result["type"] == "create_entry" - assert result["title"] == "home" - assert result["data"] == test_data