diff --git a/homeassistant/components/xiaomi_miio/air_quality.py b/homeassistant/components/xiaomi_miio/air_quality.py index 4b56c60cd82..372a1b62e73 100644 --- a/homeassistant/components/xiaomi_miio/air_quality.py +++ b/homeassistant/components/xiaomi_miio/air_quality.py @@ -2,18 +2,14 @@ import logging from miio import AirQualityMonitor, AirQualityMonitorCGDN1, DeviceException -import voluptuous as vol -from homeassistant.components.air_quality import PLATFORM_SCHEMA, AirQualityEntity -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN -import homeassistant.helpers.config_validation as cv +from homeassistant.components.air_quality import AirQualityEntity +from homeassistant.const import CONF_HOST, CONF_TOKEN from .const import ( CONF_DEVICE, CONF_FLOW_TYPE, CONF_MODEL, - DOMAIN, MODEL_AIRQUALITYMONITOR_B1, MODEL_AIRQUALITYMONITOR_CGDN1, MODEL_AIRQUALITYMONITOR_S1, @@ -30,14 +26,6 @@ ATTR_TVOC = "total_volatile_organic_compounds" ATTR_TEMP = "temperature" ATTR_HUM = "humidity" -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, - } -) - PROP_TO_ATTR = { "carbon_dioxide_equivalent": ATTR_CO2E, "total_volatile_organic_compounds": ATTR_TVOC, @@ -249,21 +237,6 @@ DEVICE_MAP = { } -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Import Miio configuration from YAML.""" - _LOGGER.warning( - "Loading Xiaomi Miio Air Quality 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 Xiaomi Air Quality from a config entry.""" entities = [] diff --git a/homeassistant/components/xiaomi_miio/fan.py b/homeassistant/components/xiaomi_miio/fan.py index 57a4f004529..c3e3bce289a 100644 --- a/homeassistant/components/xiaomi_miio/fan.py +++ b/homeassistant/components/xiaomi_miio/fan.py @@ -10,19 +10,11 @@ from miio.airpurifier_miot import OperationMode as AirpurifierMiotOperationMode import voluptuous as vol from homeassistant.components.fan import ( - PLATFORM_SCHEMA, SUPPORT_PRESET_MODE, SUPPORT_SET_SPEED, FanEntity, ) -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import ( - ATTR_ENTITY_ID, - ATTR_MODE, - CONF_HOST, - CONF_NAME, - CONF_TOKEN, -) +from homeassistant.const import ATTR_ENTITY_ID, ATTR_MODE from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.util.percentage import ( @@ -53,7 +45,6 @@ from .const import ( MODEL_AIRPURIFIER_PRO, MODEL_AIRPURIFIER_PRO_V7, MODEL_AIRPURIFIER_V3, - MODELS_FAN, MODELS_PURIFIER_MIOT, SERVICE_RESET_FILTER, SERVICE_SET_EXTRA_FEATURES, @@ -70,16 +61,6 @@ DATA_KEY = "fan.xiaomi_miio" CONF_MODEL = "model" - -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(MODELS_FAN), - } -) - ATTR_MODEL = "model" # Air Purifier @@ -217,21 +198,6 @@ SERVICE_TO_METHOD = { } -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Import Miio configuration from YAML.""" - _LOGGER.warning( - "Loading Xiaomi Miio Fan 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 Fan from a config entry.""" entities = [] diff --git a/homeassistant/components/xiaomi_miio/light.py b/homeassistant/components/xiaomi_miio/light.py index 6025ae047c6..b916de899b9 100644 --- a/homeassistant/components/xiaomi_miio/light.py +++ b/homeassistant/components/xiaomi_miio/light.py @@ -19,14 +19,12 @@ from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, - PLATFORM_SCHEMA, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, LightEntity, ) -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_TOKEN +from homeassistant.const import ATTR_ENTITY_ID, CONF_HOST, CONF_TOKEN import homeassistant.helpers.config_validation as cv from homeassistant.util import color, dt @@ -37,7 +35,6 @@ from .const import ( CONF_MODEL, DOMAIN, KEY_COORDINATOR, - MODELS_LIGHT, MODELS_LIGHT_BULB, MODELS_LIGHT_CEILING, MODELS_LIGHT_EYECARE, @@ -60,15 +57,6 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Xiaomi Philips Light" DATA_KEY = "light.xiaomi_miio" -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(MODELS_LIGHT), - } -) - # The light does not accept cct values < 1 CCT_MIN = 1 CCT_MAX = 100 @@ -120,21 +108,6 @@ SERVICE_TO_METHOD = { } -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Import Miio configuration from YAML.""" - _LOGGER.warning( - "Loading Xiaomi Miio Light 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 Xiaomi light from a config entry.""" entities = [] diff --git a/homeassistant/components/xiaomi_miio/sensor.py b/homeassistant/components/xiaomi_miio/sensor.py index a8a2787aaed..a505c23498c 100644 --- a/homeassistant/components/xiaomi_miio/sensor.py +++ b/homeassistant/components/xiaomi_miio/sensor.py @@ -14,23 +14,19 @@ from miio.gateway.gateway import ( GATEWAY_MODEL_EU, GatewayException, ) -import voluptuous as vol from homeassistant.components.sensor import ( - PLATFORM_SCHEMA, STATE_CLASS_MEASUREMENT, STATE_CLASS_TOTAL_INCREASING, SensorEntity, SensorEntityDescription, ) -from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TEMPERATURE, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_MILLION, CONF_HOST, - CONF_NAME, CONF_TOKEN, DEVICE_CLASS_CO2, DEVICE_CLASS_GAS, @@ -47,7 +43,6 @@ from homeassistant.const import ( TIME_HOURS, VOLUME_CUBIC_METERS, ) -import homeassistant.helpers.config_validation as cv from .const import ( CONF_DEVICE, @@ -78,14 +73,6 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Xiaomi Miio Sensor" UNIT_LUMEN = "lm" -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, - } -) - ATTR_ACTUAL_SPEED = "actual_speed" ATTR_AIR_QUALITY = "air_quality" ATTR_AQI = "aqi" @@ -326,21 +313,6 @@ MODEL_TO_SENSORS_MAP = { } -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Import Miio configuration from YAML.""" - _LOGGER.warning( - "Loading Xiaomi Miio Sensor 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 Xiaomi sensor from a config entry.""" entities = [] diff --git a/homeassistant/components/xiaomi_miio/switch.py b/homeassistant/components/xiaomi_miio/switch.py index 4a6471a20b9..84503664498 100644 --- a/homeassistant/components/xiaomi_miio/switch.py +++ b/homeassistant/components/xiaomi_miio/switch.py @@ -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] diff --git a/homeassistant/components/xiaomi_miio/vacuum.py b/homeassistant/components/xiaomi_miio/vacuum.py index cdd53e784b3..94d93d77f2f 100644 --- a/homeassistant/components/xiaomi_miio/vacuum.py +++ b/homeassistant/components/xiaomi_miio/vacuum.py @@ -7,7 +7,6 @@ import voluptuous as vol from homeassistant.components.vacuum import ( ATTR_CLEANED_AREA, - PLATFORM_SCHEMA, STATE_CLEANING, STATE_DOCKED, STATE_ERROR, @@ -26,15 +25,13 @@ from homeassistant.components.vacuum import ( SUPPORT_STOP, StateVacuumEntity, ) -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN, STATE_OFF, STATE_ON +from homeassistant.const import CONF_HOST, CONF_TOKEN, STATE_OFF, STATE_ON from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.util.dt import as_utc from .const import ( CONF_DEVICE, CONF_FLOW_TYPE, - DOMAIN, SERVICE_CLEAN_SEGMENT, SERVICE_CLEAN_ZONE, SERVICE_GOTO, @@ -49,15 +46,6 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Xiaomi Vacuum cleaner" -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_HOST): cv.string, - vol.Required(CONF_TOKEN): vol.All(str, vol.Length(min=32, max=32)), - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - }, - extra=vol.ALLOW_EXTRA, -) - ATTR_CLEAN_START = "clean_start" ATTR_CLEAN_STOP = "clean_stop" ATTR_CLEANING_TIME = "cleaning_time" @@ -119,20 +107,6 @@ STATE_CODE_TO_STATE = { } -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Import Miio configuration from YAML.""" - _LOGGER.warning( - "Loading Xiaomi Miio Vacuum 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 Xiaomi vacuum cleaner robot from a config entry.""" entities = []