Clean up or correct from removed deprecation for MQTT platform (#82684)

Clean up or correct from removed deprecation
This commit is contained in:
Jan Bouwhuis 2022-11-25 16:11:22 +01:00 committed by GitHub
parent 34757fa539
commit 4335b0db25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 31 additions and 35 deletions

View file

@ -112,7 +112,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT alarm control panels under the alarm_control_panel platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(alarm.DOMAIN), warn_for_legacy_schema(alarm.DOMAIN),

View file

@ -69,7 +69,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RO_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Binary sensors under the binary_sensor platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(binary_sensor.DOMAIN), warn_for_legacy_schema(binary_sensor.DOMAIN),

View file

@ -46,7 +46,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Buttons under the button platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(button.DOMAIN), warn_for_legacy_schema(button.DOMAIN),

View file

@ -56,7 +56,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
PLATFORM_SCHEMA_BASE.schema, PLATFORM_SCHEMA_BASE.schema,
) )
# Configuring MQTT Camera under the camera platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(camera.DOMAIN), warn_for_legacy_schema(camera.DOMAIN),

View file

@ -307,7 +307,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
valid_preset_mode_configuration, valid_preset_mode_configuration,
) )
# Configuring MQTT Climate under the climate platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(climate.DOMAIN), warn_for_legacy_schema(climate.DOMAIN),

View file

@ -204,7 +204,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
validate_options, validate_options,
) )
# Configuring MQTT Covers under the cover platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(cover.DOMAIN), warn_for_legacy_schema(cover.DOMAIN),

View file

@ -59,7 +59,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RO_SCHEMA.extend(
DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA) DISCOVERY_SCHEMA = PLATFORM_SCHEMA_MODERN.extend({}, extra=vol.REMOVE_EXTRA)
# Configuring MQTT Device Trackers under the device_tracker platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All(warn_for_legacy_schema(device_tracker.DOMAIN)) PLATFORM_SCHEMA = vol.All(warn_for_legacy_schema(device_tracker.DOMAIN))

View file

@ -183,7 +183,7 @@ _PLATFORM_SCHEMA_BASE = MQTT_RW_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Fans under the fan platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(fan.DOMAIN), warn_for_legacy_schema(fan.DOMAIN),
@ -518,7 +518,6 @@ class MqttFan(MqttEntity, FanEntity):
# The default for FanEntity is to compute it based on percentage # The default for FanEntity is to compute it based on percentage
return self._attr_is_on return self._attr_is_on
# The speed attribute deprecated in the schema, support will be removed after a quarter (2021.7)
async def async_turn_on( async def async_turn_on(
self, self,
percentage: int | None = None, percentage: int | None = None,

View file

@ -149,7 +149,7 @@ _PLATFORM_SCHEMA_BASE = MQTT_RW_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Humidifiers under the humidifier platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(humidifier.DOMAIN), warn_for_legacy_schema(humidifier.DOMAIN),

View file

@ -72,7 +72,7 @@ DISCOVERY_SCHEMA = vol.All(
validate_mqtt_light_discovery, validate_mqtt_light_discovery,
) )
# Configuring MQTT Lights under the light platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(light.DOMAIN), warn_for_legacy_schema(light.DOMAIN),

View file

@ -224,7 +224,7 @@ _PLATFORM_SCHEMA_BASE = (
.extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema) .extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema)
) )
# The use of PLATFORM_SCHEMA is deprecated in HA Core 2022.6 # The use of PLATFORM_SCHEMA was deprecated in HA Core 2022.6
PLATFORM_SCHEMA_BASIC = vol.All( PLATFORM_SCHEMA_BASIC = vol.All(
cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema), cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema),
) )

View file

@ -158,7 +158,7 @@ _PLATFORM_SCHEMA_BASE = (
.extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema) .extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema)
) )
# Configuring MQTT Lights under the light platform key is deprecated in HA Core 2022.6 # Configuring MQTT Lights under the light platform key was deprecated in HA Core 2022.6
PLATFORM_SCHEMA_JSON = vol.All( PLATFORM_SCHEMA_JSON = vol.All(
cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema), cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema),
valid_color_configuration, valid_color_configuration,

View file

@ -112,7 +112,7 @@ _PLATFORM_SCHEMA_BASE = (
.extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema) .extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema)
) )
# Configuring MQTT Lights under the light platform key is deprecated in HA Core 2022.6 # Configuring MQTT Lights under the light platform key was deprecated in HA Core 2022.6
PLATFORM_SCHEMA_TEMPLATE = vol.All( PLATFORM_SCHEMA_TEMPLATE = vol.All(
cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema), cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema),
) )

View file

@ -70,7 +70,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Locks under the lock platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(lock.DOMAIN), warn_for_legacy_schema(lock.DOMAIN),

View file

@ -107,7 +107,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
validate_config, validate_config,
) )
# Configuring MQTT Number under the number platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(number.DOMAIN), warn_for_legacy_schema(number.DOMAIN),

View file

@ -45,7 +45,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend(
} }
).extend(MQTT_AVAILABILITY_SCHEMA.schema) ).extend(MQTT_AVAILABILITY_SCHEMA.schema)
# Configuring MQTT Scenes under the scene platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(scene.DOMAIN), warn_for_legacy_schema(scene.DOMAIN),

View file

@ -67,7 +67,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
}, },
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Select under the select platform key is deprecated in HA Core 2022.6 # Configuring MQTT Select under the select platform key was deprecated in HA Core 2022.6
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(select.DOMAIN), warn_for_legacy_schema(select.DOMAIN),
) )

View file

@ -114,7 +114,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
validate_options, validate_options,
) )
# Configuring MQTT Sensors under the sensor platform key is deprecated in HA Core 2022.6 # Configuring MQTT Sensors under the sensor platform key was deprecated in HA Core 2022.6
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(sensor.DOMAIN), warn_for_legacy_schema(sensor.DOMAIN),
) )

View file

@ -97,7 +97,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
}, },
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Sirens under the siren platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(siren.DOMAIN), warn_for_legacy_schema(siren.DOMAIN),

View file

@ -66,7 +66,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
} }
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema) ).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
# Configuring MQTT Switches under the switch platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(switch.DOMAIN), warn_for_legacy_schema(switch.DOMAIN),

View file

@ -34,7 +34,7 @@ def validate_mqtt_vacuum_discovery(config_value: ConfigType) -> ConfigType:
return config return config
# Configuring MQTT Vacuums under the vacuum platform key is deprecated in HA Core 2022.6 # Configuring MQTT Vacuums under the vacuum platform key was deprecated in HA Core 2022.6
def validate_mqtt_vacuum(config_value: ConfigType) -> ConfigType: def validate_mqtt_vacuum(config_value: ConfigType) -> ConfigType:
"""Validate MQTT vacuum schema (deprecated).""" """Validate MQTT vacuum schema (deprecated)."""
schemas = {LEGACY: PLATFORM_SCHEMA_LEGACY, STATE: PLATFORM_SCHEMA_STATE} schemas = {LEGACY: PLATFORM_SCHEMA_LEGACY, STATE: PLATFORM_SCHEMA_STATE}
@ -56,7 +56,7 @@ DISCOVERY_SCHEMA = vol.All(
MQTT_VACUUM_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA), validate_mqtt_vacuum_discovery MQTT_VACUUM_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA), validate_mqtt_vacuum_discovery
) )
# Configuring MQTT Vacuums under the vacuum platform key is deprecated in HA Core 2022.6 # 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 # Setup for the legacy YAML format was removed in HA Core 2022.12
PLATFORM_SCHEMA = vol.All( PLATFORM_SCHEMA = vol.All(
warn_for_legacy_schema(vacuum.DOMAIN), warn_for_legacy_schema(vacuum.DOMAIN),

View file

@ -160,7 +160,7 @@ PLATFORM_SCHEMA_LEGACY_MODERN = (
.extend(MQTT_VACUUM_SCHEMA.schema) .extend(MQTT_VACUUM_SCHEMA.schema)
) )
# Configuring MQTT Vacuums under the vacuum platform key is deprecated in HA Core 2022.6 # Configuring MQTT Vacuums under the vacuum platform key was deprecated in HA Core 2022.6
PLATFORM_SCHEMA_LEGACY = vol.All( PLATFORM_SCHEMA_LEGACY = vol.All(
cv.PLATFORM_SCHEMA.extend(PLATFORM_SCHEMA_LEGACY_MODERN.schema), cv.PLATFORM_SCHEMA.extend(PLATFORM_SCHEMA_LEGACY_MODERN.schema),
warn_for_legacy_schema(VACUUM_DOMAIN), warn_for_legacy_schema(VACUUM_DOMAIN),

View file

@ -154,7 +154,7 @@ PLATFORM_SCHEMA_STATE_MODERN = (
.extend(MQTT_VACUUM_SCHEMA.schema) .extend(MQTT_VACUUM_SCHEMA.schema)
) )
# Configuring MQTT Vacuums under the vacuum platform key is deprecated in HA Core 2022.6 # Configuring MQTT Vacuums under the vacuum platform key was deprecated in HA Core 2022.6
PLATFORM_SCHEMA_STATE = vol.All( PLATFORM_SCHEMA_STATE = vol.All(
cv.PLATFORM_SCHEMA.extend(PLATFORM_SCHEMA_STATE_MODERN.schema), cv.PLATFORM_SCHEMA.extend(PLATFORM_SCHEMA_STATE_MODERN.schema),
warn_for_legacy_schema(VACUUM_DOMAIN), warn_for_legacy_schema(VACUUM_DOMAIN),

View file

@ -120,7 +120,6 @@ async def test_preset_none_in_preset_modes(hass, caplog):
assert "Invalid config for [mqtt]: not a valid value" in caplog.text assert "Invalid config for [mqtt]: not a valid value" in caplog.text
# AWAY and HOLD mode topics and templates are deprecated, support will be removed with release 2022.9
@pytest.mark.parametrize( @pytest.mark.parametrize(
"parameter,config_value", "parameter,config_value",
[ [

View file

@ -1238,7 +1238,6 @@ async def test_no_implicit_state_topic_switch(
async_fire_mqtt_message(hass, "homeassistant/switch/bla/config", data) async_fire_mqtt_message(hass, "homeassistant/switch/bla/config", data)
await hass.async_block_till_done() await hass.async_block_till_done()
assert "implicit state_topic is deprecated" not in caplog.text
state = hass.states.get("switch.Test1") state = hass.states.get("switch.Test1")
assert state is not None assert state is not None

View file

@ -2720,8 +2720,8 @@ async def test_subscribe_connection_status(
assert mqtt_connected_calls[1] is False assert mqtt_connected_calls[1] is False
# Test deprecated YAML configuration under the platform key # Test existence of removed YAML configuration under the platform key
# Scheduled to be removed in HA core 2022.12 # This warning and test is to be removed from HA core 2023.6
async def test_one_deprecation_warning_per_platform( async def test_one_deprecation_warning_per_platform(
hass, mqtt_mock_entry_with_yaml_config, caplog hass, mqtt_mock_entry_with_yaml_config, caplog
): ):
@ -2810,8 +2810,6 @@ async def test_publish_or_subscribe_without_valid_config_entry(hass, caplog):
@patch("homeassistant.components.mqtt.PLATFORMS", [Platform.LIGHT]) @patch("homeassistant.components.mqtt.PLATFORMS", [Platform.LIGHT])
async def test_reload_entry_with_new_config(hass, tmp_path): async def test_reload_entry_with_new_config(hass, tmp_path):
"""Test reloading the config entry with a new yaml config.""" """Test reloading the config entry with a new yaml config."""
# Test deprecated YAML configuration under the platform key
# Scheduled to be removed in HA core 2022.12
config_old = { config_old = {
"mqtt": {"light": [{"name": "test_old1", "command_topic": "test-topic_old"}]} "mqtt": {"light": [{"name": "test_old1", "command_topic": "test-topic_old"}]}
} }

View file

@ -2216,11 +2216,12 @@ async def test_discovery_removal_light(hass, mqtt_mock_entry_no_yaml_config, cap
) )
# Test deprecated YAML configuration under the platform key async def test_discovery_ignores_extra_keys(
# Scheduled to be removed in HA core 2022.12 hass, mqtt_mock_entry_no_yaml_config, caplog
async def test_discovery_deprecated(hass, mqtt_mock_entry_no_yaml_config, caplog): ):
"""Test discovery of mqtt light with deprecated platform option.""" """Test discovery ignores extra keys that are not blocked."""
await mqtt_mock_entry_no_yaml_config() await mqtt_mock_entry_no_yaml_config()
# inserted `platform` key should be ignored
data = ( data = (
'{ "name": "Beer",' ' "platform": "mqtt",' ' "command_topic": "test_topic"}' '{ "name": "Beer",' ' "platform": "mqtt",' ' "command_topic": "test_topic"}'
) )