Improve homekit_controller typing (#107381)

This commit is contained in:
Marc Mueller 2024-01-06 22:02:30 +01:00 committed by GitHub
parent 427f7a7866
commit 4ea8c174f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View file

@ -641,7 +641,9 @@ class HKDevice:
await self.async_add_new_entities()
@callback
def async_entity_key_removed(self, entity_key: tuple[int, int | None, int | None]):
def async_entity_key_removed(
self, entity_key: tuple[int, int | None, int | None]
) -> None:
"""Handle an entity being removed.
Releases the entity from self.entities so it can be added again.
@ -666,7 +668,7 @@ class HKDevice:
self.char_factories.append(add_entities_cb)
self._add_new_entities_for_char([add_entities_cb])
def _add_new_entities_for_char(self, handlers) -> None:
def _add_new_entities_for_char(self, handlers: list[AddCharacteristicCb]) -> None:
for accessory in self.entity_map.accessories:
for service in accessory.services:
for char in service.characteristics:
@ -768,7 +770,7 @@ class HKDevice:
"""Request an debounced update from the accessory."""
await self._debounced_update.async_call()
async def async_update(self, now=None):
async def async_update(self, now: datetime | None = None) -> None:
"""Poll state of all entities attached to this bridge/accessory."""
if not self.pollable_characteristics:
self.async_update_available_state()