mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
Migrate HomeKit Controller to use stable identifiers (#80064)
This commit is contained in:
@@ -5,8 +5,9 @@ from aiohomekit.model.services import ServicesTypes
|
||||
from aiohomekit.testing import FAKE_CAMERA_IMAGE
|
||||
|
||||
from homeassistant.components import camera
|
||||
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_camera(accessory):
|
||||
@@ -14,6 +15,22 @@ def create_camera(accessory):
|
||||
accessory.add_service(ServicesTypes.CAMERA_RTP_STREAM_MANAGEMENT)
|
||||
|
||||
|
||||
async def test_migrate_unique_ids(hass, utcnow):
|
||||
"""Test migrating entity unique ids."""
|
||||
entity_registry = er.async_get(hass)
|
||||
aid = get_next_aid()
|
||||
camera = entity_registry.async_get_or_create(
|
||||
"camera",
|
||||
"homekit_controller",
|
||||
f"homekit-0001-aid:{aid}",
|
||||
)
|
||||
await setup_test_component(hass, create_camera)
|
||||
assert (
|
||||
entity_registry.async_get(camera.entity_id).unique_id
|
||||
== f"00:00:00:00:00:00_{aid}"
|
||||
)
|
||||
|
||||
|
||||
async def test_read_state(hass, utcnow):
|
||||
"""Test reading the state of a HomeKit camera."""
|
||||
helper = await setup_test_component(hass, create_camera)
|
||||
|
||||
Reference in New Issue
Block a user