mirror of
https://github.com/home-assistant/core.git
synced 2025-11-05 08:59:57 +00:00
Migrate HomeKit Controller to use stable identifiers (#80064)
This commit is contained in:
@@ -3,8 +3,9 @@ from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||
from aiohomekit.model.services import ServicesTypes
|
||||
|
||||
from homeassistant.components.humidifier import DOMAIN, MODE_AUTO, MODE_NORMAL
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_test_component
|
||||
from .common import get_next_aid, setup_test_component
|
||||
|
||||
|
||||
def create_humidifier_service(accessory):
|
||||
@@ -436,3 +437,20 @@ async def test_dehumidifier_target_humidity_modes(hass, utcnow):
|
||||
)
|
||||
assert state.attributes["mode"] == "normal"
|
||||
assert state.attributes["humidity"] == 73
|
||||
|
||||
|
||||
async def test_migrate_entity_ids(hass, utcnow):
|
||||
"""Test that we can migrate humidifier entity ids."""
|
||||
aid = get_next_aid()
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
humidifier_entry = entity_registry.async_get_or_create(
|
||||
"humidifier",
|
||||
"homekit_controller",
|
||||
f"homekit-00:00:00:00:00:00-{aid}-8",
|
||||
)
|
||||
await setup_test_component(hass, create_humidifier_service)
|
||||
assert (
|
||||
entity_registry.async_get(humidifier_entry.entity_id).unique_id
|
||||
== f"00:00:00:00:00:00_{aid}_8"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user