Remove deprecated async_setup_platforms() for xiaomi_miio (#54930)
This commit is contained in:
parent
dbc4470979
commit
3048923dc2
6 changed files with 5 additions and 186 deletions
|
@ -13,17 +13,14 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.switch import (
|
||||
DEVICE_CLASS_SWITCH,
|
||||
PLATFORM_SCHEMA,
|
||||
SwitchEntity,
|
||||
SwitchEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_MODE,
|
||||
ATTR_TEMPERATURE,
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
CONF_TOKEN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
|
@ -95,28 +92,6 @@ GATEWAY_SWITCH_VARS = {
|
|||
"status_ch2": {KEY_CHANNEL: 2},
|
||||
}
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
{
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Required(CONF_TOKEN): vol.All(cv.string, vol.Length(min=32, max=32)),
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
vol.Optional(CONF_MODEL): vol.In(
|
||||
[
|
||||
"chuangmi.plug.v1",
|
||||
"qmi.powerstrip.v1",
|
||||
"zimi.powerstrip.v2",
|
||||
"chuangmi.plug.m1",
|
||||
"chuangmi.plug.m3",
|
||||
"chuangmi.plug.v2",
|
||||
"chuangmi.plug.v3",
|
||||
"chuangmi.plug.hmi205",
|
||||
"chuangmi.plug.hmi206",
|
||||
"chuangmi.plug.hmi208",
|
||||
"lumi.acpartner.v3",
|
||||
]
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
ATTR_AUTO_DETECT = "auto_detect"
|
||||
ATTR_BUZZER = "buzzer"
|
||||
|
@ -254,20 +229,6 @@ SWITCH_TYPES = (
|
|||
)
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
"""Import Miio configuration from YAML."""
|
||||
_LOGGER.warning(
|
||||
"Loading Xiaomi Miio Switch via platform setup is deprecated; Please remove it from your configuration"
|
||||
)
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data=config,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up the switch from a config entry."""
|
||||
model = config_entry.data[CONF_MODEL]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue