Only compute homekit_controller accessory_info when entity is added or config changes (#102145)
This commit is contained in:
parent
e6895b5738
commit
d8e541a284
6 changed files with 642 additions and 33 deletions
|
@ -8,6 +8,7 @@ import os
|
|||
from typing import Any, Final
|
||||
from unittest import mock
|
||||
|
||||
from aiohomekit.controller.abstract import AbstractPairing
|
||||
from aiohomekit.hkjson import loads as hkloads
|
||||
from aiohomekit.model import (
|
||||
Accessories,
|
||||
|
@ -180,7 +181,7 @@ async def time_changed(hass, seconds):
|
|||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def setup_accessories_from_file(hass, path):
|
||||
async def setup_accessories_from_file(hass: HomeAssistant, path: str) -> Accessories:
|
||||
"""Load an collection of accessory defs from JSON data."""
|
||||
accessories_fixture = await hass.async_add_executor_job(
|
||||
load_fixture, os.path.join("homekit_controller", path)
|
||||
|
@ -242,11 +243,11 @@ async def setup_test_accessories_with_controller(
|
|||
return config_entry, pairing
|
||||
|
||||
|
||||
async def device_config_changed(hass, accessories):
|
||||
async def device_config_changed(hass: HomeAssistant, accessories: Accessories):
|
||||
"""Discover new devices added to Home Assistant at runtime."""
|
||||
# Update the accessories our FakePairing knows about
|
||||
controller = hass.data[CONTROLLER]
|
||||
pairing = controller.pairings["00:00:00:00:00:00"]
|
||||
pairing: AbstractPairing = controller.pairings["00:00:00:00:00:00"]
|
||||
|
||||
accessories_obj = Accessories()
|
||||
for accessory in accessories:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue