Remove deprecated YAML configuration from Abode (#52357)
parent
4a94ed8f5a
commit
635cf59909
|
@ -1,5 +1,4 @@
|
|||
"""Support for the Abode Security System."""
|
||||
from copy import deepcopy
|
||||
from functools import partial
|
||||
|
||||
from abodepy import Abode
|
||||
|
@ -8,7 +7,6 @@ import abodepy.helpers.timeline as TIMELINE
|
|||
from requests.exceptions import ConnectTimeout, HTTPError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_DATE,
|
||||
|
@ -44,22 +42,7 @@ ATTR_APP_TYPE = "app_type"
|
|||
ATTR_EVENT_BY = "event_by"
|
||||
ATTR_VALUE = "value"
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
vol.All(
|
||||
# Deprecated in Home Assistant 2021.6
|
||||
cv.deprecated(DOMAIN),
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_USERNAME): cv.string,
|
||||
vol.Required(CONF_PASSWORD): cv.string,
|
||||
vol.Optional(CONF_POLLING, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
||||
|
||||
CHANGE_SETTING_SCHEMA = vol.Schema(
|
||||
{vol.Required(ATTR_SETTING): cv.string, vol.Required(ATTR_VALUE): cv.string}
|
||||
|
@ -92,22 +75,6 @@ class AbodeSystem:
|
|||
self.logout_listener = None
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up Abode integration."""
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
||||
conf = config[DOMAIN]
|
||||
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=deepcopy(conf)
|
||||
)
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
"""Set up Abode integration from a config entry."""
|
||||
username = config_entry.data.get(CONF_USERNAME)
|
||||
|
|
|
@ -158,13 +158,3 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
self._password = user_input[CONF_PASSWORD]
|
||||
|
||||
return await self._async_abode_login(step_id="reauth_confirm")
|
||||
|
||||
async def async_step_import(self, import_config):
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
if self._async_current_entries():
|
||||
LOGGER.warning("Already configured; Only a single configuration possible")
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
||||
self._polling = import_config.get(CONF_POLLING, False)
|
||||
|
||||
return await self.async_step_user(import_config)
|
||||
|
|
|
@ -7,7 +7,7 @@ from abodepy.helpers.errors import MFA_CODE_REQUIRED
|
|||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components.abode import config_flow
|
||||
from homeassistant.components.abode.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
|
||||
from homeassistant.const import (
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
|
@ -46,17 +46,6 @@ async def test_one_config_allowed(hass):
|
|||
assert step_user_result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert step_user_result["reason"] == "single_instance_allowed"
|
||||
|
||||
conf = {
|
||||
CONF_USERNAME: "user@email.com",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_POLLING: False,
|
||||
}
|
||||
|
||||
import_config_result = await flow.async_step_import(conf)
|
||||
|
||||
assert import_config_result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert import_config_result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
async def test_invalid_credentials(hass):
|
||||
"""Test that invalid credentials throws an error."""
|
||||
|
@ -90,29 +79,6 @@ async def test_connection_error(hass):
|
|||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
async def test_step_import(hass):
|
||||
"""Test that the import step works."""
|
||||
conf = {
|
||||
CONF_USERNAME: "user@email.com",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_POLLING: False,
|
||||
}
|
||||
|
||||
with patch("homeassistant.components.abode.config_flow.Abode"), patch(
|
||||
"abodepy.UTILS"
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "user@email.com"
|
||||
assert result["data"] == {
|
||||
CONF_USERNAME: "user@email.com",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_POLLING: False,
|
||||
}
|
||||
|
||||
|
||||
async def test_step_user(hass):
|
||||
"""Test that the user step works."""
|
||||
conf = {CONF_USERNAME: "user@email.com", CONF_PASSWORD: "password"}
|
||||
|
|
Loading…
Reference in New Issue