diff --git a/homeassistant/components/myq/config_flow.py b/homeassistant/components/myq/config_flow.py index d06f01342a1..352283607d8 100644 --- a/homeassistant/components/myq/config_flow.py +++ b/homeassistant/components/myq/config_flow.py @@ -81,12 +81,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): await self.async_set_unique_id(properties["id"]) return await self.async_step_user() - async def async_step_import(self, user_input): - """Handle import.""" - await self.async_set_unique_id(user_input[CONF_USERNAME]) - self._abort_if_unique_id_configured() - return await self.async_step_user(user_input) - class CannotConnect(exceptions.HomeAssistantError): """Error to indicate we cannot connect.""" diff --git a/homeassistant/components/myq/cover.py b/homeassistant/components/myq/cover.py index 59a7fb5bb2e..6fef6b25bab 100644 --- a/homeassistant/components/myq/cover.py +++ b/homeassistant/components/myq/cover.py @@ -9,27 +9,16 @@ from pymyq.const import ( KNOWN_MODELS, MANUFACTURER, ) -import voluptuous as vol from homeassistant.components.cover import ( DEVICE_CLASS_GARAGE, DEVICE_CLASS_GATE, - PLATFORM_SCHEMA, SUPPORT_CLOSE, SUPPORT_OPEN, CoverEntity, ) -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import ( - CONF_PASSWORD, - CONF_TYPE, - CONF_USERNAME, - STATE_CLOSED, - STATE_CLOSING, - STATE_OPENING, -) +from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPENING from homeassistant.core import callback -from homeassistant.helpers import config_validation as cv from homeassistant.helpers.event import async_call_later from homeassistant.helpers.update_coordinator import CoordinatorEntity @@ -42,31 +31,6 @@ from .const import ( TRANSITION_START_DURATION, ) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_USERNAME): cv.string, - vol.Required(CONF_PASSWORD): cv.string, - # This parameter is no longer used; keeping it to avoid a breaking change in - # a hotfix, but in a future main release, this should be removed: - vol.Optional(CONF_TYPE): cv.string, - }, -) - - -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Set up the platform.""" - - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data={ - CONF_USERNAME: config[CONF_USERNAME], - CONF_PASSWORD: config[CONF_PASSWORD], - }, - ) - ) - async def async_setup_entry(hass, config_entry, async_add_entities): """Set up mysq covers.""" diff --git a/tests/components/myq/test_config_flow.py b/tests/components/myq/test_config_flow.py index edf37895fd3..bbfa090b01c 100644 --- a/tests/components/myq/test_config_flow.py +++ b/tests/components/myq/test_config_flow.py @@ -44,36 +44,6 @@ async def test_form_user(hass): assert len(mock_setup_entry.mock_calls) == 1 -async def test_import(hass): - """Test we can import.""" - await setup.async_setup_component(hass, "persistent_notification", {}) - - with patch( - "homeassistant.components.myq.config_flow.pymyq.login", - return_value=True, - ), patch( - "homeassistant.components.myq.async_setup", return_value=True - ) as mock_setup, patch( - "homeassistant.components.myq.async_setup_entry", - return_value=True, - ) as mock_setup_entry: - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_IMPORT}, - data={"username": "test-username", "password": "test-password"}, - ) - await hass.async_block_till_done() - - assert result["type"] == "create_entry" - assert result["title"] == "test-username" - assert result["data"] == { - "username": "test-username", - "password": "test-password", - } - assert len(mock_setup.mock_calls) == 1 - assert len(mock_setup_entry.mock_calls) == 1 - - async def test_form_invalid_auth(hass): """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init(