Suppress MQTT discovery updates without changes (#38568)
This commit is contained in:
1 parent
187f47233c
commit
5bdeb46c12
18 files changed
+266
-31
No files matched your search
@@ -15,6 +15,7 @@ from .test_common import (
|
||||
help_test_discovery_removal,
|
||||
help_test_discovery_update,
|
||||
help_test_discovery_update_attr,
|
||||
help_test_discovery_update_unchanged,
|
||||
help_test_entity_debug_info_message,
|
||||
help_test_entity_device_info_remove,
|
||||
help_test_entity_device_info_update,
|
||||
@@ -320,6 +321,21 @@ async def test_discovery_update_switch(hass, mqtt_mock, caplog):
|
||||
)
|
||||
|
||||
|
||||
async def test_discovery_update_unchanged_switch(hass, mqtt_mock, caplog):
|
||||
"""Test update of discovered switch."""
|
||||
data1 = (
|
||||
'{ "name": "Beer",'
|
||||
' "state_topic": "test_topic",'
|
||||
' "command_topic": "test_topic" }'
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.mqtt.switch.MqttSwitch.discovery_update"
|
||||
) as discovery_update:
|
||||
await help_test_discovery_update_unchanged(
|
||||
hass, mqtt_mock, caplog, switch.DOMAIN, data1, discovery_update
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.no_fail_on_log_exception
|
||||
async def test_discovery_broken(hass, mqtt_mock, caplog):
|
||||
"""Test handling of bad discovery message."""
|
||||
|
||||
Reference in new issue
Block a user