197 files
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
from typing import Any, Protocol
|
||||
from typing import Any, NamedTuple, Protocol
|
||||
|
||||
from custom_components.powercalc.power_profile.power_profile import DeviceType, DiscoveryBy
|
||||
|
||||
|
||||
class Loader(Protocol):
|
||||
async def initialize(self) -> None:
|
||||
"""Initialize the loader."""
|
||||
class ModelMetadata(NamedTuple):
|
||||
"""Discovery relevant model properties, available from the library index without loading the profile."""
|
||||
|
||||
def get_discovery_ignored_domains(self) -> set[str]:
|
||||
"""Get integration domains excluded from discovery."""
|
||||
device_type: DeviceType
|
||||
discovery_by: DiscoveryBy
|
||||
|
||||
|
||||
class Loader(Protocol):
|
||||
async def initialize(self, prefer_cached: bool = False) -> None:
|
||||
"""Initialize the loader.
|
||||
|
||||
Pass `prefer_cached` to load from local storage when available, keeping remote
|
||||
downloads off the caller's critical path.
|
||||
"""
|
||||
|
||||
def get_discovery_low_priority_domains(self) -> set[str]:
|
||||
"""Get integration domains that are the least preferred source for discovery."""
|
||||
|
||||
async def get_manufacturer_listing(
|
||||
self,
|
||||
@@ -36,3 +47,6 @@ class Loader(Protocol):
|
||||
|
||||
async def find_model_migration(self, manufacturer: str, model: str) -> str | None:
|
||||
"""Return the canonical model id for a legacy profile id using library metadata."""
|
||||
|
||||
async def get_model_metadata(self, manufacturer: str, model: str) -> ModelMetadata | None:
|
||||
"""Return discovery metadata for a model, or None when this loader does not know the model."""
|
||||
|
||||
Reference in New Issue
Block a user