From 57a8a83cd2caf717bb526dd28639773848c3435c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 15 Feb 2023 14:51:27 -0600 Subject: [PATCH] be consistant --- homeassistant/components/zeroconf/__init__.py | 8 ++++---- homeassistant/loader.py | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/zeroconf/__init__.py b/homeassistant/components/zeroconf/__init__.py index 5d9f8c2efff..6ecf44282ea 100644 --- a/homeassistant/components/zeroconf/__init__.py +++ b/homeassistant/components/zeroconf/__init__.py @@ -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 diff --git a/homeassistant/loader.py b/homeassistant/loader.py index c01f4d07522..f06ae086c76 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -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