This commit is contained in:
Home Assistant Version Control
2026-08-07 16:23:20 +00:00
parent 305e1b2545
commit baabdf0c0e
58 changed files with 678 additions and 109 deletions
@@ -15,6 +15,10 @@ class CompositeLoader(Loader):
for loader in self.loaders:
await loader.initialize()
def get_discovery_ignored_domains(self) -> set[str]:
"""Get all integration domains excluded by the combined libraries."""
return {domain for loader in self.loaders for domain in loader.get_discovery_ignored_domains()}
async def get_manufacturer_listing(
self,
device_types: set[DeviceType] | None,
@@ -25,6 +25,10 @@ class LocalLoader(Loader):
if not self._is_custom_directory:
await self._hass.async_add_executor_job(self._load_custom_library)
def get_discovery_ignored_domains(self) -> set[str]:
"""Local profile directories do not provide global library metadata."""
return set()
async def get_manufacturer_listing(
self,
device_types: set[DeviceType] | None,
@@ -7,6 +7,9 @@ class Loader(Protocol):
async def initialize(self) -> None:
"""Initialize the loader."""
def get_discovery_ignored_domains(self) -> set[str]:
"""Get integration domains excluded from discovery."""
async def get_manufacturer_listing(
self,
device_types: set[DeviceType] | None,
@@ -16,7 +16,12 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.storage import STORAGE_DIR
from homeassistant.loader import async_get_integration
from custom_components.powercalc.const import API_URL, BUILT_IN_LIBRARY_DIR, DOMAIN
from custom_components.powercalc.const import (
API_URL,
BUILT_IN_LIBRARY_DIR,
DOMAIN,
LIBRARY_DISCOVERY_IGNORED_DOMAINS,
)
from custom_components.powercalc.helpers import async_cache, clear_async_cache
from custom_components.powercalc.power_profile.error import LibraryLoadingError, ProfileDownloadError
from custom_components.powercalc.power_profile.loader.protocol import Loader
@@ -80,6 +85,10 @@ class RemoteLoader(Loader):
for manufacturer in manufacturers:
self._index_manufacturer(manufacturer, powercalc_version)
def get_discovery_ignored_domains(self) -> set[str]:
"""Get integration domains excluded from discovery by library metadata."""
return set(self.library_contents.get(LIBRARY_DISCOVERY_IGNORED_DOMAINS, []))
def _index_manufacturer(self, manufacturer: LibraryManufacturer, powercalc_version: AwesomeVersion) -> None:
"""Register a manufacturer, its aliases and all of its supported models in the lookup tables."""
manufacturer_name = str(manufacturer.get("dir_name"))