mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Remove YAML support from myq (#45375)
This commit is contained in:
parent
daa9449f18
commit
bb1224d06f
@ -81,12 +81,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
await self.async_set_unique_id(properties["id"])
|
await self.async_set_unique_id(properties["id"])
|
||||||
return await self.async_step_user()
|
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):
|
class CannotConnect(exceptions.HomeAssistantError):
|
||||||
"""Error to indicate we cannot connect."""
|
"""Error to indicate we cannot connect."""
|
||||||
|
@ -9,27 +9,16 @@ from pymyq.const import (
|
|||||||
KNOWN_MODELS,
|
KNOWN_MODELS,
|
||||||
MANUFACTURER,
|
MANUFACTURER,
|
||||||
)
|
)
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
DEVICE_CLASS_GARAGE,
|
DEVICE_CLASS_GARAGE,
|
||||||
DEVICE_CLASS_GATE,
|
DEVICE_CLASS_GATE,
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPENING
|
||||||
from homeassistant.const import (
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_TYPE,
|
|
||||||
CONF_USERNAME,
|
|
||||||
STATE_CLOSED,
|
|
||||||
STATE_CLOSING,
|
|
||||||
STATE_OPENING,
|
|
||||||
)
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
@ -42,31 +31,6 @@ from .const import (
|
|||||||
TRANSITION_START_DURATION,
|
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):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up mysq covers."""
|
"""Set up mysq covers."""
|
||||||
|
@ -44,36 +44,6 @@ async def test_form_user(hass):
|
|||||||
assert len(mock_setup_entry.mock_calls) == 1
|
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):
|
async def test_form_invalid_auth(hass):
|
||||||
"""Test we handle invalid auth."""
|
"""Test we handle invalid auth."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user