mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Allow MQTT device based auto discovery (#118757)
* Allow MQTT device based auto discovery * Fix merge error * Remove unused import * Fix discovery device based topics * Fix cannot delete twice * Improve cleanup test * Follow up comment * Typo Co-authored-by: Erik Montnemery <erik@montnemery.com> * Explain more * Use tuple * Default a device payload to have priority over a platform based payload * Add unique_id to sensor test data * Set migration flag to mark a discovery topic for migration * Correct type hint * Make unique_id required for components in device based discovery payload * Remove CONF_MIGRATE_DISCOVERY from platform schema * Unload discovered MQTT item to allow migration * Follow up comments from code review * ruff * Subscribe to platform discovery wildcards first * Use normal dict * Use dict to persist wildcard subscription order * Remove missed unused parameter * Add a comment to explain we use a dict to preserve the subscription order * Add wildcard subscription order test * Remove discovery flag from test * Improve discovery migration origin logging * Assert initial wildcard discovery topics subscription order and after reconnect * Improve log messages --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
@ -1197,7 +1197,6 @@ async def test_mqtt_ws_get_device_debug_info(
|
||||
}
|
||||
data_sensor = json.dumps(config_sensor)
|
||||
data_trigger = json.dumps(config_trigger)
|
||||
config_sensor["platform"] = config_trigger["platform"] = mqtt.DOMAIN
|
||||
|
||||
async_fire_mqtt_message(hass, "homeassistant/sensor/bla/config", data_sensor)
|
||||
async_fire_mqtt_message(
|
||||
@ -1254,7 +1253,6 @@ async def test_mqtt_ws_get_device_debug_info_binary(
|
||||
"unique_id": "unique",
|
||||
}
|
||||
data = json.dumps(config)
|
||||
config["platform"] = mqtt.DOMAIN
|
||||
|
||||
async_fire_mqtt_message(hass, "homeassistant/camera/bla/config", data)
|
||||
await hass.async_block_till_done()
|
||||
|
Reference in New Issue
Block a user