diff --git a/homeassistant/components/iss/binary_sensor.py b/homeassistant/components/iss/binary_sensor.py index 12a8a7514b2..e2034fb48f9 100644 --- a/homeassistant/components/iss/binary_sensor.py +++ b/homeassistant/components/iss/binary_sensor.py @@ -7,24 +7,14 @@ import logging import pyiss import requests from requests.exceptions import HTTPError -import voluptuous as vol -from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity -from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry -from homeassistant.const import ( - ATTR_LATITUDE, - ATTR_LONGITUDE, - CONF_NAME, - CONF_SHOW_ON_MAP, -) +from homeassistant.components.binary_sensor import BinarySensorEntity +from homeassistant.config_entries import ConfigEntry +from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CONF_SHOW_ON_MAP from homeassistant.core import HomeAssistant -import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util import Throttle -from .const import DOMAIN - _LOGGER = logging.getLogger(__name__) ATTR_ISS_NEXT_RISE = "next_rise" @@ -35,35 +25,6 @@ DEFAULT_DEVICE_CLASS = "visible" MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Optional(CONF_SHOW_ON_MAP, default=False): cv.boolean, - } -) - - -def setup_platform( - hass: HomeAssistant, - config: ConfigType, - add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Import ISS configuration from yaml.""" - _LOGGER.warning( - "Configuration of the iss platform in YAML is deprecated and will be " - "removed in Home Assistant 2022.5; Your existing configuration " - "has been imported into the UI automatically and can be safely removed " - "from your configuration.yaml file" - ) - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data=config, - ) - ) - async def async_setup_entry( hass: HomeAssistant, diff --git a/homeassistant/components/iss/config_flow.py b/homeassistant/components/iss/config_flow.py index dc80126bd14..b43949daadc 100644 --- a/homeassistant/components/iss/config_flow.py +++ b/homeassistant/components/iss/config_flow.py @@ -43,15 +43,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): return self.async_show_form(step_id="user") - async def async_step_import(self, conf: dict) -> FlowResult: - """Import a configuration from configuration.yaml.""" - return await self.async_step_user( - user_input={ - CONF_NAME: conf[CONF_NAME], - CONF_SHOW_ON_MAP: conf[CONF_SHOW_ON_MAP], - } - ) - class OptionsFlowHandler(config_entries.OptionsFlow): """Config flow options handler for iss.""" diff --git a/tests/components/iss/test_config_flow.py b/tests/components/iss/test_config_flow.py index 09f7f391b89..3260b76432f 100644 --- a/tests/components/iss/test_config_flow.py +++ b/tests/components/iss/test_config_flow.py @@ -2,31 +2,15 @@ from unittest.mock import patch from homeassistant import data_entry_flow -from homeassistant.components.iss.binary_sensor import DEFAULT_NAME from homeassistant.components.iss.const import DOMAIN from homeassistant.config import async_process_ha_core_config -from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER -from homeassistant.const import CONF_NAME, CONF_SHOW_ON_MAP +from homeassistant.config_entries import SOURCE_USER +from homeassistant.const import CONF_SHOW_ON_MAP from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry -async def test_import(hass: HomeAssistant): - """Test entry will be imported.""" - - imported_config = {CONF_NAME: DEFAULT_NAME, CONF_SHOW_ON_MAP: False} - - with patch("homeassistant.components.iss.async_setup_entry", return_value=True): - - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=imported_config - ) - assert result.get("type") == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result.get("result").title == DEFAULT_NAME - assert result.get("result").options == {CONF_SHOW_ON_MAP: False} - - async def test_create_entry(hass: HomeAssistant): """Test we can finish a config flow."""