Suppress MQTT discovery updates without changes (#38568)
This commit is contained in:
parent
896bdbff8f
commit
4ed1f8023b
18 changed files with 266 additions and 31 deletions
|
@ -20,6 +20,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,
|
||||
|
@ -34,6 +35,7 @@ from .test_common import (
|
|||
help_test_update_with_json_attrs_not_dict,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
from tests.common import async_fire_mqtt_message
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
|
@ -382,6 +384,21 @@ async def test_discovery_update_lock(hass, mqtt_mock, caplog):
|
|||
await help_test_discovery_update(hass, mqtt_mock, caplog, LOCK_DOMAIN, data1, data2)
|
||||
|
||||
|
||||
async def test_discovery_update_unchanged_lock(hass, mqtt_mock, caplog):
|
||||
"""Test update of discovered lock."""
|
||||
data1 = (
|
||||
'{ "name": "Beer",'
|
||||
' "state_topic": "test_topic",'
|
||||
' "command_topic": "command_topic" }'
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.mqtt.lock.MqttLock.discovery_update"
|
||||
) as discovery_update:
|
||||
await help_test_discovery_update_unchanged(
|
||||
hass, mqtt_mock, caplog, LOCK_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."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue