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