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

View File

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