1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

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
17 changed files with 246 additions and 61 deletions

View File

@@ -3,7 +3,7 @@ from homeassistant.components import fan
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_OFF, STATE_ON
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,
@@ -15,7 +15,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,
@@ -496,6 +497,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, fan.DOMAIN, DEFAULT_CONFIG)
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, fan.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, fan.DOMAIN, DEFAULT_CONFIG
)