Fix change of entity_id for discovered MQTT entities (#33444)

This commit is contained in:
Erik Montnemery 2020-03-30 23:26:59 +02:00 committed by GitHub
parent 531207e005
commit 9508c51403
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 246 additions and 61 deletions

View file

@ -101,7 +101,7 @@ from homeassistant.const import (
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
from .common import (
from .test_common import (
help_test_availability_without_topic,
help_test_custom_availability_payload,
help_test_default_availability_payload,
@ -113,7 +113,8 @@ from .common import (
help_test_entity_device_info_update,
help_test_entity_device_info_with_connection,
help_test_entity_device_info_with_identifier,
help_test_entity_id_update,
help_test_entity_id_update_discovery_update,
help_test_entity_id_update_subscriptions,
help_test_setting_attribute_via_mqtt_json_message,
help_test_setting_attribute_with_template,
help_test_unique_id,
@ -1121,6 +1122,15 @@ async def test_entity_device_info_remove(hass, mqtt_mock):
)
async def test_entity_id_update(hass, mqtt_mock):
async def test_entity_id_update_subscriptions(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update(hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG)
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
)
async def test_entity_id_update_discovery_update(hass, mqtt_mock):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
)