Migrate HomeKit Controller to use stable identifiers (#80064)
This commit is contained in:
parent
e3a3f93441
commit
f23b1750e8
66 changed files with 781 additions and 234 deletions
|
@ -2,7 +2,9 @@
|
|||
from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||
from aiohomekit.model.services import ServicesTypes
|
||||
|
||||
from .common import Helper, setup_test_component
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import Helper, get_next_aid, setup_test_component
|
||||
|
||||
|
||||
def create_switch_with_setup_button(accessory):
|
||||
|
@ -89,3 +91,19 @@ async def test_ecobee_clear_hold_press_button(hass):
|
|||
CharacteristicsTypes.VENDOR_ECOBEE_CLEAR_HOLD: True,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
async def test_migrate_unique_id(hass, utcnow):
|
||||
"""Test a we can migrate a button unique id."""
|
||||
entity_registry = er.async_get(hass)
|
||||
aid = get_next_aid()
|
||||
button_entry = entity_registry.async_get_or_create(
|
||||
"button",
|
||||
"homekit_controller",
|
||||
f"homekit-0001-aid:{aid}-sid:1-cid:2",
|
||||
)
|
||||
await setup_test_component(hass, create_switch_with_ecobee_clear_hold_button)
|
||||
assert (
|
||||
entity_registry.async_get(button_entry.entity_id).unique_id
|
||||
== f"00:00:00:00:00:00_{aid}_1_2"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue