From 661aedde90ac2c2a881601fb7dba18de8cf03666 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Wed, 31 May 2023 09:02:48 +0200 Subject: [PATCH] Remove MQTT platform schema warnings (#93785) --- .../components/mqtt/alarm_control_panel.py | 14 +----- .../components/mqtt/binary_sensor.py | 8 ---- homeassistant/components/mqtt/button.py | 15 +----- homeassistant/components/mqtt/camera.py | 13 +---- homeassistant/components/mqtt/climate.py | 14 +----- homeassistant/components/mqtt/cover.py | 13 +---- .../components/mqtt/device_tracker.py | 6 --- homeassistant/components/mqtt/fan.py | 13 +---- homeassistant/components/mqtt/humidifier.py | 14 +----- .../components/mqtt/light/__init__.py | 8 +--- homeassistant/components/mqtt/lock.py | 13 +---- homeassistant/components/mqtt/mixins.py | 48 +------------------ homeassistant/components/mqtt/number.py | 13 +---- homeassistant/components/mqtt/scene.py | 7 --- homeassistant/components/mqtt/select.py | 12 +---- homeassistant/components/mqtt/sensor.py | 7 --- homeassistant/components/mqtt/siren.py | 13 +---- homeassistant/components/mqtt/strings.json | 10 ---- homeassistant/components/mqtt/switch.py | 14 +----- .../components/mqtt/vacuum/__init__.py | 9 +--- .../components/mqtt/vacuum/schema_legacy.py | 10 +--- .../components/mqtt/vacuum/schema_state.py | 10 +--- tests/components/mqtt/test_init.py | 26 ---------- 23 files changed, 17 insertions(+), 293 deletions(-) diff --git a/homeassistant/components/mqtt/alarm_control_panel.py b/homeassistant/components/mqtt/alarm_control_panel.py index b685daaf6f1..dbed1c8aa9e 100644 --- a/homeassistant/components/mqtt/alarm_control_panel.py +++ b/homeassistant/components/mqtt/alarm_control_panel.py @@ -41,12 +41,7 @@ from .const import ( CONF_STATE_TOPIC, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .util import get_mqtt_data, valid_publish_topic, valid_subscribe_topic @@ -112,13 +107,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT alarm control panels under the alarm_control_panel platform key -# was deprecated in HA Core 2022.6; -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(alarm.DOMAIN), -) - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index d09e31f65f9..50af9ef8a55 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -43,7 +43,6 @@ from .mixins import ( MqttAvailability, MqttEntity, async_setup_entry_helper, - warn_for_legacy_schema, ) from .models import MqttValueTemplate, ReceiveMessage from .util import get_mqtt_data @@ -69,13 +68,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_RO_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Binary sensors under the binary_sensor platform key was deprecated in -# HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(binary_sensor.DOMAIN), -) - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/homeassistant/components/mqtt/button.py b/homeassistant/components/mqtt/button.py index f81f78a487a..46ecc16d385 100644 --- a/homeassistant/components/mqtt/button.py +++ b/homeassistant/components/mqtt/button.py @@ -22,12 +22,7 @@ from .const import ( CONF_QOS, CONF_RETAIN, ) -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import MqttCommandTemplate from .util import valid_publish_topic @@ -46,14 +41,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Buttons under the button platform key was deprecated in -# HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(button.DOMAIN), -) - - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/homeassistant/components/mqtt/camera.py b/homeassistant/components/mqtt/camera.py index b3a78f4d2ff..75ab25efcfa 100644 --- a/homeassistant/components/mqtt/camera.py +++ b/homeassistant/components/mqtt/camera.py @@ -20,12 +20,7 @@ from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_QOS, CONF_TOPIC from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ReceiveMessage from .util import valid_subscribe_topic @@ -56,12 +51,6 @@ PLATFORM_SCHEMA_MODERN = vol.All( PLATFORM_SCHEMA_BASE.schema, ) -# Configuring MQTT Camera under the camera platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(camera.DOMAIN), -) - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_BASE.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 140d9fb128b..fcb3271f10f 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -58,12 +58,7 @@ from .const import ( PAYLOAD_NONE, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, @@ -389,13 +384,6 @@ PLATFORM_SCHEMA_MODERN = vol.All( valid_humidity_state_configuration, ) -# Configuring MQTT Climate under the climate platform key was deprecated in -# HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(climate.DOMAIN), -) - _DISCOVERY_SCHEMA_BASE = _PLATFORM_SCHEMA_BASE.extend({}, extra=vol.REMOVE_EXTRA) DISCOVERY_SCHEMA = vol.All( diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index e7c458e6822..da2f1b4496d 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -46,12 +46,7 @@ from .const import ( DEFAULT_OPTIMISTIC, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .util import get_mqtt_data, valid_publish_topic, valid_subscribe_topic @@ -210,12 +205,6 @@ PLATFORM_SCHEMA_MODERN = vol.All( validate_options, ) -# Configuring MQTT Covers under the cover platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(cover.DOMAIN), -) - DISCOVERY_SCHEMA = vol.All( cv.removed("tilt_invert_state"), _PLATFORM_SCHEMA_BASE.extend({}, extra=vol.REMOVE_EXTRA), diff --git a/homeassistant/components/mqtt/device_tracker.py b/homeassistant/components/mqtt/device_tracker.py index dbe7188da7d..a9c4017593c 100644 --- a/homeassistant/components/mqtt/device_tracker.py +++ b/homeassistant/components/mqtt/device_tracker.py @@ -36,7 +36,6 @@ from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper, - warn_for_legacy_schema, ) from .models import MqttValueTemplate, ReceiveMessage, ReceivePayloadType from .util import get_mqtt_data, valid_subscribe_topic @@ -78,11 +77,6 @@ DISCOVERY_SCHEMA = vol.All( PLATFORM_SCHEMA_MODERN_BASE.extend({}, extra=vol.REMOVE_EXTRA), valid_config ) -# Configuring MQTT Device Trackers under the device_tracker platform key was deprecated -# in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All(warn_for_legacy_schema(device_tracker.DOMAIN)) - async def async_setup_entry( hass: HomeAssistant, diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index e8259c60809..f5e92d8ecf9 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -50,12 +50,7 @@ from .const import ( PAYLOAD_NONE, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MessageCallbackType, MqttCommandTemplate, @@ -181,12 +176,6 @@ _PLATFORM_SCHEMA_BASE = MQTT_RW_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Fans under the fan platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(fan.DOMAIN), -) - PLATFORM_SCHEMA_MODERN = vol.All( _PLATFORM_SCHEMA_BASE, valid_speed_range_configuration, diff --git a/homeassistant/components/mqtt/humidifier.py b/homeassistant/components/mqtt/humidifier.py index 2c6dae54f4c..f00944fc091 100644 --- a/homeassistant/components/mqtt/humidifier.py +++ b/homeassistant/components/mqtt/humidifier.py @@ -45,12 +45,7 @@ from .const import ( PAYLOAD_NONE, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, @@ -151,13 +146,6 @@ _PLATFORM_SCHEMA_BASE = MQTT_RW_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Humidifiers under the humidifier platform key was deprecated in -# HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(humidifier.DOMAIN), -) - PLATFORM_SCHEMA_MODERN = vol.All( _PLATFORM_SCHEMA_BASE, valid_humidity_range_configuration, diff --git a/homeassistant/components/mqtt/light/__init__.py b/homeassistant/components/mqtt/light/__init__.py index f91f76c6a82..5cd42ef1934 100644 --- a/homeassistant/components/mqtt/light/__init__.py +++ b/homeassistant/components/mqtt/light/__init__.py @@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType -from ..mixins import async_setup_entry_helper, warn_for_legacy_schema +from ..mixins import async_setup_entry_helper from .schema import CONF_SCHEMA, MQTT_LIGHT_SCHEMA_SCHEMA from .schema_basic import ( DISCOVERY_SCHEMA_BASIC, @@ -58,12 +58,6 @@ DISCOVERY_SCHEMA = vol.All( validate_mqtt_light_discovery, ) -# Configuring MQTT Lights under the light platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(light.DOMAIN), -) - PLATFORM_SCHEMA_MODERN = vol.All( MQTT_LIGHT_SCHEMA_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA), validate_mqtt_light_modern, diff --git a/homeassistant/components/mqtt/lock.py b/homeassistant/components/mqtt/lock.py index 0598c0354ed..966cbc21105 100644 --- a/homeassistant/components/mqtt/lock.py +++ b/homeassistant/components/mqtt/lock.py @@ -33,12 +33,7 @@ from .const import ( CONF_STATE_TOPIC, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, @@ -94,12 +89,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Locks under the lock platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(lock.DOMAIN), -) - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) STATE_CONFIG_KEYS = [ diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index c78fb77bab6..46744c4d65d 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -28,7 +28,7 @@ from homeassistant.const import ( CONF_UNIQUE_ID, CONF_VALUE_TEMPLATE, ) -from homeassistant.core import Event, HomeAssistant, async_get_hass, callback +from homeassistant.core import Event, HomeAssistant, callback from homeassistant.helpers import ( config_validation as cv, device_registry as dr, @@ -50,7 +50,6 @@ from homeassistant.helpers.event import ( async_track_device_registry_updated_event, async_track_entity_registry_updated_event, ) -from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util.json import json_loads @@ -231,51 +230,6 @@ MQTT_ENTITY_COMMON_SCHEMA = MQTT_AVAILABILITY_SCHEMA.extend( ) -def warn_for_legacy_schema(domain: str) -> Callable[[ConfigType], ConfigType]: - """Warn once when a legacy platform schema is used.""" - warned = set() - - def validator(config: ConfigType) -> ConfigType: - """Return a validator.""" - nonlocal warned - - # Logged error and repair can be removed from HA 2023.6 - if domain in warned: - return config - - _LOGGER.error( - ( - "Manually configured MQTT %s(s) found under platform key '%s', " - "please move to the mqtt integration key, see " - "https://www.home-assistant.io/integrations/%s.mqtt/" - ), - domain, - domain, - domain, - ) - warned.add(domain) - # Register a repair - async_create_issue( - async_get_hass(), - DOMAIN, - f"deprecated_yaml_{domain}", - breaks_in_ha_version="2022.12.0", # Warning first added in 2022.6.0 - is_fixable=False, - severity=IssueSeverity.ERROR, - translation_key="deprecated_yaml", - translation_placeholders={ - "more_info_url": ( - "https://www.home-assistant.io" - f"/integrations/{domain}.mqtt/#new_format" - ), - "platform": domain, - }, - ) - return config - - return validator - - class SetupEntity(Protocol): """Protocol type for async_setup_entities.""" diff --git a/homeassistant/components/mqtt/number.py b/homeassistant/components/mqtt/number.py index 1ab14b2b4f8..c0cb00211e3 100644 --- a/homeassistant/components/mqtt/number.py +++ b/homeassistant/components/mqtt/number.py @@ -42,12 +42,7 @@ from .const import ( CONF_STATE_TOPIC, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, @@ -107,12 +102,6 @@ PLATFORM_SCHEMA_MODERN = vol.All( validate_config, ) -# Configuring MQTT Number under the number platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(number.DOMAIN), -) - DISCOVERY_SCHEMA = vol.All( _PLATFORM_SCHEMA_BASE.extend({}, extra=vol.REMOVE_EXTRA), validate_config, diff --git a/homeassistant/components/mqtt/scene.py b/homeassistant/components/mqtt/scene.py index dd7f3347845..f716e4fe46f 100644 --- a/homeassistant/components/mqtt/scene.py +++ b/homeassistant/components/mqtt/scene.py @@ -24,7 +24,6 @@ from .mixins import ( MQTT_AVAILABILITY_SCHEMA, MqttEntity, async_setup_entry_helper, - warn_for_legacy_schema, ) from .util import valid_publish_topic @@ -46,12 +45,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend( } ).extend(MQTT_AVAILABILITY_SCHEMA.schema) -# Configuring MQTT Scenes under the scene platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(scene.DOMAIN), -) - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/homeassistant/components/mqtt/select.py b/homeassistant/components/mqtt/select.py index b783a001f15..26e72af9192 100644 --- a/homeassistant/components/mqtt/select.py +++ b/homeassistant/components/mqtt/select.py @@ -28,12 +28,7 @@ from .const import ( CONF_STATE_TOPIC, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, @@ -65,11 +60,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend( }, ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Select under the select platform key was deprecated in HA Core 2022.6 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(select.DOMAIN), -) - DISCOVERY_SCHEMA = vol.All(PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA)) diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index d63c41964bb..e4b5f61bda0 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -45,7 +45,6 @@ from .mixins import ( MqttAvailability, MqttEntity, async_setup_entry_helper, - warn_for_legacy_schema, ) from .models import ( MqttValueTemplate, @@ -93,12 +92,6 @@ PLATFORM_SCHEMA_MODERN = vol.All( _PLATFORM_SCHEMA_BASE, ) -# Configuring MQTT Sensors under the sensor platform key was deprecated in -# HA Core 2022.6 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(sensor.DOMAIN), -) - DISCOVERY_SCHEMA = vol.All( # Deprecated in HA Core 2021.11.0 https://github.com/home-assistant/core/pull/54840 # Removed in HA Core 2023.6.0 diff --git a/homeassistant/components/mqtt/siren.py b/homeassistant/components/mqtt/siren.py index e279deb70b3..4134dd97148 100644 --- a/homeassistant/components/mqtt/siren.py +++ b/homeassistant/components/mqtt/siren.py @@ -50,12 +50,7 @@ from .const import ( PAYLOAD_NONE, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, @@ -96,12 +91,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend( }, ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Sirens under the siren platform key was deprecated in HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(siren.DOMAIN), -) - DISCOVERY_SCHEMA = vol.All(PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA)) MQTT_SIREN_ATTRIBUTES_BLOCKED = frozenset( diff --git a/homeassistant/components/mqtt/strings.json b/homeassistant/components/mqtt/strings.json index b55fa5779b8..b06794c9b32 100644 --- a/homeassistant/components/mqtt/strings.json +++ b/homeassistant/components/mqtt/strings.json @@ -1,14 +1,4 @@ { - "issues": { - "deprecated_yaml": { - "title": "Your manually configured MQTT {platform}(s) needs attention", - "description": "Manually configured MQTT {platform}(s) found under platform key `{platform}`.\n\nPlease move the configuration to the `mqtt` integration key and restart Home Assistant to fix this issue. See the [documentation]({more_info_url}), for more information." - }, - "deprecated_yaml_broker_settings": { - "title": "Deprecated MQTT settings found in `configuration.yaml`", - "description": "The following settings found in `configuration.yaml` were migrated to MQTT config entry and will now override the settings in `configuration.yaml`:\n`{deprecated_settings}`\n\nPlease remove these settings from `configuration.yaml` and restart Home Assistant to fix this issue. See the [documentation]({more_info_url}), for more information." - } - }, "config": { "step": { "broker": { diff --git a/homeassistant/components/mqtt/switch.py b/homeassistant/components/mqtt/switch.py index 521b08d2748..7f4f609f265 100644 --- a/homeassistant/components/mqtt/switch.py +++ b/homeassistant/components/mqtt/switch.py @@ -37,12 +37,7 @@ from .const import ( PAYLOAD_NONE, ) from .debug_info import log_messages -from .mixins import ( - MQTT_ENTITY_COMMON_SCHEMA, - MqttEntity, - async_setup_entry_helper, - warn_for_legacy_schema, -) +from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper from .models import MqttValueTemplate, ReceiveMessage from .util import get_mqtt_data @@ -64,13 +59,6 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend( } ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) -# Configuring MQTT Switches under the switch platform key was deprecated in -# HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(switch.DOMAIN), -) - DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/homeassistant/components/mqtt/vacuum/__init__.py b/homeassistant/components/mqtt/vacuum/__init__.py index 86d94883c90..068bc183ec4 100644 --- a/homeassistant/components/mqtt/vacuum/__init__.py +++ b/homeassistant/components/mqtt/vacuum/__init__.py @@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType -from ..mixins import async_setup_entry_helper, warn_for_legacy_schema +from ..mixins import async_setup_entry_helper from .schema import CONF_SCHEMA, LEGACY, MQTT_VACUUM_SCHEMA, STATE from .schema_legacy import ( DISCOVERY_SCHEMA_LEGACY, @@ -46,13 +46,6 @@ DISCOVERY_SCHEMA = vol.All( MQTT_VACUUM_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA), validate_mqtt_vacuum_discovery ) -# Configuring MQTT Vacuums under the vacuum platform key was deprecated in -# HA Core 2022.6 -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA = vol.All( - warn_for_legacy_schema(vacuum.DOMAIN), -) - PLATFORM_SCHEMA_MODERN = vol.All( MQTT_VACUUM_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA), validate_mqtt_vacuum_modern ) diff --git a/homeassistant/components/mqtt/vacuum/schema_legacy.py b/homeassistant/components/mqtt/vacuum/schema_legacy.py index 8a2912f1910..6cab62cdb5d 100644 --- a/homeassistant/components/mqtt/vacuum/schema_legacy.py +++ b/homeassistant/components/mqtt/vacuum/schema_legacy.py @@ -8,7 +8,6 @@ import voluptuous as vol from homeassistant.components.vacuum import ( ATTR_STATUS, - DOMAIN as VACUUM_DOMAIN, ENTITY_ID_FORMAT, VacuumEntity, VacuumEntityFeature, @@ -26,7 +25,7 @@ from .. import subscription from ..config import MQTT_BASE_SCHEMA from ..const import CONF_COMMAND_TOPIC, CONF_ENCODING, CONF_QOS, CONF_RETAIN from ..debug_info import log_messages -from ..mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, warn_for_legacy_schema +from ..mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity from ..models import ( MqttValueTemplate, PayloadSentinel, @@ -160,13 +159,6 @@ PLATFORM_SCHEMA_LEGACY_MODERN = ( .extend(MQTT_VACUUM_SCHEMA.schema) ) -# Configuring MQTT Vacuums under the vacuum platform key was deprecated in -# HA Core 2022.6; -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA_LEGACY = vol.All( - warn_for_legacy_schema(VACUUM_DOMAIN), -) - DISCOVERY_SCHEMA_LEGACY = PLATFORM_SCHEMA_LEGACY_MODERN.extend( {}, extra=vol.REMOVE_EXTRA ) diff --git a/homeassistant/components/mqtt/vacuum/schema_state.py b/homeassistant/components/mqtt/vacuum/schema_state.py index 3f8c6953abe..385d60a3886 100644 --- a/homeassistant/components/mqtt/vacuum/schema_state.py +++ b/homeassistant/components/mqtt/vacuum/schema_state.py @@ -6,7 +6,6 @@ from typing import Any, cast import voluptuous as vol from homeassistant.components.vacuum import ( - DOMAIN as VACUUM_DOMAIN, ENTITY_ID_FORMAT, STATE_CLEANING, STATE_DOCKED, @@ -39,7 +38,7 @@ from ..const import ( CONF_STATE_TOPIC, ) from ..debug_info import log_messages -from ..mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, warn_for_legacy_schema +from ..mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity from ..models import ReceiveMessage from ..util import get_mqtt_data, valid_publish_topic from .const import MQTT_VACUUM_ATTRIBUTES_BLOCKED @@ -155,13 +154,6 @@ PLATFORM_SCHEMA_STATE_MODERN = ( .extend(MQTT_VACUUM_SCHEMA.schema) ) -# Configuring MQTT Vacuums under the vacuum platform key was deprecated in -# HA Core 2022.6; -# Setup for the legacy YAML format was removed in HA Core 2022.12 -PLATFORM_SCHEMA_STATE = vol.All( - warn_for_legacy_schema(VACUUM_DOMAIN), -) - DISCOVERY_SCHEMA_STATE = PLATFORM_SCHEMA_STATE_MODERN.extend({}, extra=vol.REMOVE_EXTRA) diff --git a/tests/components/mqtt/test_init.py b/tests/components/mqtt/test_init.py index adbef1464a2..1e3dbc6c323 100644 --- a/tests/components/mqtt/test_init.py +++ b/tests/components/mqtt/test_init.py @@ -1,7 +1,6 @@ """The tests for the MQTT component.""" import asyncio from collections.abc import Generator -import copy from datetime import datetime, timedelta from functools import partial import json @@ -3470,31 +3469,6 @@ async def test_subscribe_connection_status( assert mqtt_connected_calls_async[1] is False -# Test existence of removed YAML configuration under the platform key -# This warning and test is to be removed from HA core 2023.6 -async def test_one_deprecation_warning_per_platform( - hass: HomeAssistant, - mqtt_mock_entry: MqttMockHAClientGenerator, - caplog: pytest.LogCaptureFixture, -) -> None: - """Test a deprecation warning is is logged once per platform.""" - platform = "light" - config = {"platform": "mqtt", "command_topic": "test-topic"} - config1 = copy.deepcopy(config) - config1["name"] = "test1" - config2 = copy.deepcopy(config) - config2["name"] = "test2" - await async_setup_component(hass, platform, {platform: [config1, config2]}) - count = 0 - for record in caplog.records: - if record.levelname == "ERROR" and ( - f"Manually configured MQTT {platform}(s) found under platform key '{platform}'" - in record.message - ): - count += 1 - assert count == 1 - - @patch("homeassistant.components.mqtt.PLATFORMS", [Platform.LIGHT]) async def test_unload_config_entry( hass: HomeAssistant,