mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Improve handling of MQTT light discovery (#19436)
This commit is contained in:
parent
edb7ec78f9
commit
a8797a08c6
@ -41,9 +41,10 @@ CONFIG_ENTRY_COMPONENTS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
DEPRECATED_PLATFORM_TO_SCHEMA = {
|
DEPRECATED_PLATFORM_TO_SCHEMA = {
|
||||||
'mqtt': 'basic',
|
'light': {
|
||||||
'mqtt_json': 'json',
|
'mqtt_json': 'json',
|
||||||
'mqtt_template': 'template',
|
'mqtt_template': 'template',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -207,10 +208,11 @@ async def async_start(hass: HomeAssistantType, discovery_topic, hass_config,
|
|||||||
discovery_hash = (component, discovery_id)
|
discovery_hash = (component, discovery_id)
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
if CONF_PLATFORM in payload:
|
if CONF_PLATFORM in payload and 'schema' not in payload:
|
||||||
platform = payload[CONF_PLATFORM]
|
platform = payload[CONF_PLATFORM]
|
||||||
if platform in DEPRECATED_PLATFORM_TO_SCHEMA:
|
if (component in DEPRECATED_PLATFORM_TO_SCHEMA and
|
||||||
schema = DEPRECATED_PLATFORM_TO_SCHEMA[platform]
|
platform in DEPRECATED_PLATFORM_TO_SCHEMA[component]):
|
||||||
|
schema = DEPRECATED_PLATFORM_TO_SCHEMA[component][platform]
|
||||||
payload['schema'] = schema
|
payload['schema'] = schema
|
||||||
_LOGGER.warning('"platform": "%s" is deprecated, '
|
_LOGGER.warning('"platform": "%s" is deprecated, '
|
||||||
'replace with "schema":"%s"',
|
'replace with "schema":"%s"',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user