diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index 544a79c42df..7d3c10636fa 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -7,7 +7,6 @@ from regenmaschine import Client from regenmaschine.errors import RainMachineError import voluptuous as vol -from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_IP_ADDRESS, @@ -33,7 +32,6 @@ from .const import ( DATA_RESTRICTIONS_UNIVERSAL, DATA_ZONES, DATA_ZONES_DETAILS, - DEFAULT_PORT, DEFAULT_SCAN_INTERVAL, DEFAULT_ZONE_RUN, DOMAIN, @@ -44,7 +42,6 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -CONF_CONTROLLERS = "controllers" CONF_PROGRAM_ID = "program_id" CONF_SECONDS = "seconds" CONF_ZONE_ID = "zone_id" @@ -76,50 +73,12 @@ SERVICE_STOP_PROGRAM_SCHEMA = vol.Schema( SERVICE_STOP_ZONE_SCHEMA = vol.Schema({vol.Required(CONF_ZONE_ID): cv.positive_int}) -CONTROLLER_SCHEMA = vol.Schema( - { - vol.Required(CONF_IP_ADDRESS): cv.string, - vol.Required(CONF_PASSWORD): cv.string, - vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, - vol.Optional(CONF_SSL, default=DEFAULT_SSL): cv.boolean, - vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL): vol.All( - cv.time_period, lambda value: value.total_seconds() - ), - vol.Optional(CONF_ZONE_RUN_TIME, default=DEFAULT_ZONE_RUN): cv.positive_int, - } -) - -CONFIG_SCHEMA = vol.Schema( - { - DOMAIN: vol.Schema( - { - vol.Required(CONF_CONTROLLERS): vol.All( - cv.ensure_list, [CONTROLLER_SCHEMA] - ) - } - ) - }, - extra=vol.ALLOW_EXTRA, -) +CONFIG_SCHEMA = cv.deprecated(DOMAIN, invalidation_version="0.119") async def async_setup(hass, config): """Set up the RainMachine component.""" - hass.data[DOMAIN] = {} - hass.data[DOMAIN][DATA_CLIENT] = {} - - if DOMAIN not in config: - return True - - conf = config[DOMAIN] - - for controller in conf[CONF_CONTROLLERS]: - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=controller - ) - ) - + hass.data[DOMAIN] = {DATA_CLIENT: {}} return True diff --git a/homeassistant/components/rainmachine/config_flow.py b/homeassistant/components/rainmachine/config_flow.py index b6e429f2e83..d942ecccfab 100644 --- a/homeassistant/components/rainmachine/config_flow.py +++ b/homeassistant/components/rainmachine/config_flow.py @@ -46,10 +46,6 @@ class RainMachineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): errors=errors if errors else {}, ) - async def async_step_import(self, import_config): - """Import a config entry from configuration.yaml.""" - return await self.async_step_user(import_config) - async def async_step_user(self, user_input=None): """Handle the start of the config flow.""" if not user_input: diff --git a/tests/components/rainmachine/test_config_flow.py b/tests/components/rainmachine/test_config_flow.py index 28de0da39fa..b07e5ab81d3 100644 --- a/tests/components/rainmachine/test_config_flow.py +++ b/tests/components/rainmachine/test_config_flow.py @@ -69,38 +69,6 @@ async def test_show_form(hass): assert result["step_id"] == "user" -async def test_step_import(hass): - """Test that the import step works.""" - conf = { - CONF_IP_ADDRESS: "192.168.1.100", - CONF_PASSWORD: "password", - CONF_PORT: 8080, - CONF_SSL: True, - CONF_SCAN_INTERVAL: 60, - } - - flow = config_flow.RainMachineFlowHandler() - flow.hass = hass - flow.context = {"source": SOURCE_USER} - - with patch( - "regenmaschine.client.Client.load_local", - return_value=True, - ): - result = await flow.async_step_import(import_config=conf) - - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result["title"] == "192.168.1.100" - assert result["data"] == { - CONF_IP_ADDRESS: "192.168.1.100", - CONF_PASSWORD: "password", - CONF_PORT: 8080, - CONF_SSL: True, - CONF_SCAN_INTERVAL: 60, - CONF_ZONE_RUN_TIME: 600, - } - - async def test_step_user(hass): """Test that the user step works.""" conf = {