Cleanup remains of legacy validation MQTT light (#87467)

pull/87634/head
Jan Bouwhuis 2023-02-07 14:52:40 +01:00 committed by GitHub
parent 4d73de6295
commit 4aa61b0d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 32 deletions

View File

@ -16,26 +16,23 @@ from ..mixins import async_setup_entry_helper, warn_for_legacy_schema
from .schema import CONF_SCHEMA, MQTT_LIGHT_SCHEMA_SCHEMA
from .schema_basic import (
DISCOVERY_SCHEMA_BASIC,
PLATFORM_SCHEMA_BASIC,
PLATFORM_SCHEMA_MODERN_BASIC,
async_setup_entity_basic,
)
from .schema_json import (
DISCOVERY_SCHEMA_JSON,
PLATFORM_SCHEMA_JSON,
PLATFORM_SCHEMA_MODERN_JSON,
async_setup_entity_json,
)
from .schema_template import (
DISCOVERY_SCHEMA_TEMPLATE,
PLATFORM_SCHEMA_MODERN_TEMPLATE,
PLATFORM_SCHEMA_TEMPLATE,
async_setup_entity_template,
)
def validate_mqtt_light_discovery(config_value: dict[str, Any]) -> ConfigType:
"""Validate MQTT light schema for."""
"""Validate MQTT light schema for discovery."""
schemas = {
"basic": DISCOVERY_SCHEMA_BASIC,
"json": DISCOVERY_SCHEMA_JSON,
@ -45,19 +42,8 @@ def validate_mqtt_light_discovery(config_value: dict[str, Any]) -> ConfigType:
return config
def validate_mqtt_light(config_value: dict[str, Any]) -> ConfigType:
"""Validate MQTT light schema."""
schemas = {
"basic": PLATFORM_SCHEMA_BASIC,
"json": PLATFORM_SCHEMA_JSON,
"template": PLATFORM_SCHEMA_TEMPLATE,
}
config: ConfigType = schemas[config_value[CONF_SCHEMA]](config_value)
return config
def validate_mqtt_light_modern(config_value: dict[str, Any]) -> ConfigType:
"""Validate MQTT light schema."""
"""Validate MQTT light schema for setup from configuration.yaml."""
schemas = {
"basic": PLATFORM_SCHEMA_MODERN_BASIC,
"json": PLATFORM_SCHEMA_MODERN_JSON,

View File

@ -227,11 +227,6 @@ _PLATFORM_SCHEMA_BASE = (
.extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema)
)
# 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),
)
DISCOVERY_SCHEMA_BASIC = vol.All(
# CONF_WHITE_VALUE_* is no longer supported, support was removed in 2022.9
cv.removed(CONF_WHITE_VALUE_COMMAND_TOPIC),

View File

@ -156,12 +156,6 @@ _PLATFORM_SCHEMA_BASE = (
.extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema)
)
# 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,
)
DISCOVERY_SCHEMA_JSON = vol.All(
# CONF_WHITE_VALUE is no longer supported, support was removed in 2022.9
cv.removed(CONF_WHITE_VALUE),

View File

@ -110,11 +110,6 @@ _PLATFORM_SCHEMA_BASE = (
.extend(MQTT_LIGHT_SCHEMA_SCHEMA.schema)
)
# 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),
)
DISCOVERY_SCHEMA_TEMPLATE = vol.All(
# CONF_WHITE_VALUE_TEMPLATE is no longer supported, support was removed in 2022.9
cv.removed(CONF_WHITE_VALUE_TEMPLATE),