Enable types from aiohomekit to be used by mypy for homekit_controller (#65433)

This commit is contained in:
Jc2k
2022-02-03 16:18:03 +00:00
committed by GitHub
parent 6c38a6b569
commit 714a952d73
13 changed files with 200 additions and 90 deletions

View File

@@ -1,7 +1,7 @@
"""Provides device automations for homekit devices."""
from __future__ import annotations
from typing import Any
from typing import TYPE_CHECKING, Any
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.characteristics.const import InputEventValues
@@ -20,6 +20,9 @@ from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN, KNOWN_DEVICES, TRIGGERS
if TYPE_CHECKING:
from .connection import HKDevice
TRIGGER_TYPES = {
"doorbell",
"button1",
@@ -225,7 +228,7 @@ async def async_setup_triggers_for_entry(hass: HomeAssistant, config_entry):
conn.add_listener(async_add_service)
def async_fire_triggers(conn, events):
def async_fire_triggers(conn: HKDevice, events: dict[tuple[int, int], Any]):
"""Process events generated by a HomeKit accessory into automation triggers."""
for (aid, iid), ev in events.items():
if aid in conn.devices: