Fix delay adding entities in HKC (#75273)

This commit is contained in:
J. Nick Koston 2022-07-15 18:21:09 +02:00 committed by GitHub
parent 97fd669924
commit 2106c9f247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View file

@ -145,12 +145,12 @@ class HKDevice:
char for char in self.pollable_characteristics if char[0] != accessory_id
]
def add_watchable_characteristics(
async def add_watchable_characteristics(
self, characteristics: list[tuple[int, int]]
) -> None:
"""Add (aid, iid) pairs that we need to poll."""
self.watchable_characteristics.extend(characteristics)
self.hass.async_create_task(self.pairing.subscribe(characteristics))
await self.pairing.subscribe(characteristics)
def remove_watchable_characteristics(self, accessory_id: int) -> None:
"""Remove all pollable characteristics by accessory id."""