diff --git a/homeassistant/components/vesync/__init__.py b/homeassistant/components/vesync/__init__.py index 3a17af55c93..48a7a577313 100644 --- a/homeassistant/components/vesync/__init__.py +++ b/homeassistant/components/vesync/__init__.py @@ -2,9 +2,7 @@ import logging from pyvesync import VeSync -import voluptuous as vol -from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send @@ -25,42 +23,7 @@ PLATFORMS = ["switch", "fan", "light"] _LOGGER = logging.getLogger(__name__) -CONFIG_SCHEMA = vol.Schema( - vol.All( - cv.deprecated(DOMAIN), - { - DOMAIN: vol.Schema( - { - vol.Required(CONF_USERNAME): cv.string, - vol.Required(CONF_PASSWORD): cv.string, - } - ) - }, - ), - extra=vol.ALLOW_EXTRA, -) - - -async def async_setup(hass, config): - """Set up the VeSync component.""" - conf = config.get(DOMAIN) - - if conf is None: - return True - - if not hass.config_entries.async_entries(DOMAIN): - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data={ - CONF_USERNAME: conf[CONF_USERNAME], - CONF_PASSWORD: conf[CONF_PASSWORD], - }, - ) - ) - - return True +CONFIG_SCHEMA = cv.deprecated(DOMAIN) async def async_setup_entry(hass, config_entry): diff --git a/homeassistant/components/vesync/config_flow.py b/homeassistant/components/vesync/config_flow.py index f91848c5238..d9cd1bfc648 100644 --- a/homeassistant/components/vesync/config_flow.py +++ b/homeassistant/components/vesync/config_flow.py @@ -33,10 +33,6 @@ class VeSyncFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): errors=errors if errors else {}, ) - async def async_step_import(self, import_config): - """Handle external yaml configuration.""" - return await self.async_step_user(import_config) - async def async_step_user(self, user_input=None): """Handle a flow start.""" if self._async_current_entries(): diff --git a/tests/components/vesync/test_config_flow.py b/tests/components/vesync/test_config_flow.py index f302d0ca5b3..cd68a0b5877 100644 --- a/tests/components/vesync/test_config_flow.py +++ b/tests/components/vesync/test_config_flow.py @@ -33,18 +33,6 @@ async def test_invalid_login_error(hass): assert result["errors"] == {"base": "invalid_auth"} -async def test_config_flow_configuration_yaml(hass): - """Test config flow with configuration.yaml user input.""" - test_dict = {CONF_USERNAME: "user", CONF_PASSWORD: "pass"} - flow = config_flow.VeSyncFlowHandler() - flow.hass = hass - with patch("pyvesync.vesync.VeSync.login", return_value=True): - result = await flow.async_step_import(test_dict) - - assert result["data"].get(CONF_USERNAME) == test_dict[CONF_USERNAME] - assert result["data"].get(CONF_PASSWORD) == test_dict[CONF_PASSWORD] - - async def test_config_flow_user_input(hass): """Test config flow with user input.""" flow = config_flow.VeSyncFlowHandler()