Clean up or correct from removed deprecation for MQTT platform (#82684)
Clean up or correct from removed deprecation
This commit is contained in:
parent
34757fa539
commit
4335b0db25
27 changed files with 31 additions and 35 deletions
|
@ -112,7 +112,7 @@ 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 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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(alarm.DOMAIN),
|
||||
|
|
|
@ -69,7 +69,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RO_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(binary_sensor.DOMAIN),
|
||||
|
|
|
@ -46,7 +46,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(button.DOMAIN),
|
||||
|
|
|
@ -56,7 +56,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
|
|||
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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(camera.DOMAIN),
|
||||
|
|
|
@ -307,7 +307,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
|
|||
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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(climate.DOMAIN),
|
||||
|
|
|
@ -204,7 +204,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
|
|||
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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(cover.DOMAIN),
|
||||
|
|
|
@ -59,7 +59,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RO_SCHEMA.extend(
|
|||
|
||||
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
|
||||
PLATFORM_SCHEMA = vol.All(warn_for_legacy_schema(device_tracker.DOMAIN))
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ _PLATFORM_SCHEMA_BASE = MQTT_RW_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
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
|
||||
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(
|
||||
self,
|
||||
percentage: int | None = None,
|
||||
|
|
|
@ -149,7 +149,7 @@ _PLATFORM_SCHEMA_BASE = MQTT_RW_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(humidifier.DOMAIN),
|
||||
|
|
|
@ -72,7 +72,7 @@ DISCOVERY_SCHEMA = vol.All(
|
|||
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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(light.DOMAIN),
|
||||
|
|
|
@ -224,7 +224,7 @@ _PLATFORM_SCHEMA_BASE = (
|
|||
.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(
|
||||
cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema),
|
||||
)
|
||||
|
|
|
@ -158,7 +158,7 @@ _PLATFORM_SCHEMA_BASE = (
|
|||
.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(
|
||||
cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema),
|
||||
valid_color_configuration,
|
||||
|
|
|
@ -112,7 +112,7 @@ _PLATFORM_SCHEMA_BASE = (
|
|||
.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(
|
||||
cv.PLATFORM_SCHEMA.extend(_PLATFORM_SCHEMA_BASE.schema),
|
||||
)
|
||||
|
|
|
@ -70,7 +70,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(lock.DOMAIN),
|
||||
|
|
|
@ -107,7 +107,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
|
|||
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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(number.DOMAIN),
|
||||
|
|
|
@ -45,7 +45,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_BASE_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(scene.DOMAIN),
|
||||
|
|
|
@ -67,7 +67,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
|
|||
},
|
||||
).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(
|
||||
warn_for_legacy_schema(select.DOMAIN),
|
||||
)
|
||||
|
|
|
@ -114,7 +114,7 @@ PLATFORM_SCHEMA_MODERN = vol.All(
|
|||
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(
|
||||
warn_for_legacy_schema(sensor.DOMAIN),
|
||||
)
|
||||
|
|
|
@ -97,7 +97,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
|
|||
},
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(siren.DOMAIN),
|
||||
|
|
|
@ -66,7 +66,7 @@ PLATFORM_SCHEMA_MODERN = MQTT_RW_SCHEMA.extend(
|
|||
}
|
||||
).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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(switch.DOMAIN),
|
||||
|
|
|
@ -34,7 +34,7 @@ def validate_mqtt_vacuum_discovery(config_value: ConfigType) -> ConfigType:
|
|||
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:
|
||||
"""Validate MQTT vacuum schema (deprecated)."""
|
||||
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
|
||||
)
|
||||
|
||||
# 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
|
||||
PLATFORM_SCHEMA = vol.All(
|
||||
warn_for_legacy_schema(vacuum.DOMAIN),
|
||||
|
|
|
@ -160,7 +160,7 @@ PLATFORM_SCHEMA_LEGACY_MODERN = (
|
|||
.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(
|
||||
cv.PLATFORM_SCHEMA.extend(PLATFORM_SCHEMA_LEGACY_MODERN.schema),
|
||||
warn_for_legacy_schema(VACUUM_DOMAIN),
|
||||
|
|
|
@ -154,7 +154,7 @@ PLATFORM_SCHEMA_STATE_MODERN = (
|
|||
.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(
|
||||
cv.PLATFORM_SCHEMA.extend(PLATFORM_SCHEMA_STATE_MODERN.schema),
|
||||
warn_for_legacy_schema(VACUUM_DOMAIN),
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
# AWAY and HOLD mode topics and templates are deprecated, support will be removed with release 2022.9
|
||||
@pytest.mark.parametrize(
|
||||
"parameter,config_value",
|
||||
[
|
||||
|
|
|
@ -1238,7 +1238,6 @@ async def test_no_implicit_state_topic_switch(
|
|||
|
||||
async_fire_mqtt_message(hass, "homeassistant/switch/bla/config", data)
|
||||
await hass.async_block_till_done()
|
||||
assert "implicit state_topic is deprecated" not in caplog.text
|
||||
|
||||
state = hass.states.get("switch.Test1")
|
||||
assert state is not None
|
||||
|
|
|
@ -2720,8 +2720,8 @@ async def test_subscribe_connection_status(
|
|||
assert mqtt_connected_calls[1] is False
|
||||
|
||||
|
||||
# Test deprecated YAML configuration under the platform key
|
||||
# Scheduled to be removed in HA core 2022.12
|
||||
# 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, 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])
|
||||
async def test_reload_entry_with_new_config(hass, tmp_path):
|
||||
"""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 = {
|
||||
"mqtt": {"light": [{"name": "test_old1", "command_topic": "test-topic_old"}]}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
# Scheduled to be removed in HA core 2022.12
|
||||
async def test_discovery_deprecated(hass, mqtt_mock_entry_no_yaml_config, caplog):
|
||||
"""Test discovery of mqtt light with deprecated platform option."""
|
||||
async def test_discovery_ignores_extra_keys(
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog
|
||||
):
|
||||
"""Test discovery ignores extra keys that are not blocked."""
|
||||
await mqtt_mock_entry_no_yaml_config()
|
||||
# inserted `platform` key should be ignored
|
||||
data = (
|
||||
'{ "name": "Beer",' ' "platform": "mqtt",' ' "command_topic": "test_topic"}'
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue