be consistant

This commit is contained in:
J. Nick Koston
2023-02-15 14:51:27 -06:00
parent d80938a56c
commit 57a8a83cd2
2 changed files with 13 additions and 9 deletions

View File

@@ -35,7 +35,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.network import NoURLAvailableError, get_url
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import (
HomeKitModel,
HomeKitDiscoveredIntegration,
async_get_homekit,
async_get_zeroconf,
bind_hass,
@@ -347,7 +347,7 @@ class ZeroconfDiscovery:
hass: HomeAssistant,
zeroconf: HaZeroconf,
zeroconf_types: dict[str, list[dict[str, str | dict[str, str]]]],
homekit_models: dict[str, HomeKitModel],
homekit_models: dict[str, HomeKitDiscoveredIntegration],
ipv6: bool,
) -> None:
"""Init discovery."""
@@ -514,8 +514,8 @@ class ZeroconfDiscovery:
def async_get_homekit_discovery_domain(
homekit_models: dict[str, HomeKitModel], props: dict[str, Any]
) -> HomeKitModel | None:
homekit_models: dict[str, HomeKitDiscoveredIntegration], props: dict[str, Any]
) -> HomeKitDiscoveredIntegration | None:
"""Handle a HomeKit discovery.
Return the domain to forward the discovery data to

View File

@@ -120,7 +120,7 @@ class USBMatcher(USBMatcherRequired, USBMatcherOptional):
@dataclass
class HomeKitModel:
class HomeKitDiscoveredIntegration:
"""HomeKit model."""
domain: str
@@ -419,10 +419,12 @@ async def async_get_usb(hass: HomeAssistant) -> list[USBMatcher]:
return usb
async def async_get_homekit(hass: HomeAssistant) -> dict[str, HomeKitModel]:
async def async_get_homekit(
hass: HomeAssistant,
) -> dict[str, HomeKitDiscoveredIntegration]:
"""Return cached list of homekit models."""
homekit: dict[str, HomeKitModel] = {
model: HomeKitModel(details["domain"], details["iot_class"])
homekit: dict[str, HomeKitDiscoveredIntegration] = {
model: HomeKitDiscoveredIntegration(details["domain"], details["iot_class"])
for model, details in HOMEKIT.items()
}
@@ -435,7 +437,9 @@ async def async_get_homekit(hass: HomeAssistant) -> dict[str, HomeKitModel]:
):
continue
for model in integration.homekit["models"]:
homekit[model] = HomeKitModel(integration.domain, integration.iot_class)
homekit[model] = HomeKitDiscoveredIntegration(
integration.domain, integration.iot_class
)
return homekit