32 lines
886 B
Python
32 lines
886 B
Python
"""Constants for the HA Probe integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from typing import TYPE_CHECKING
|
|
|
|
from homeassistant.const import Platform
|
|
|
|
if TYPE_CHECKING:
|
|
from .sensor import HaProbeSensor
|
|
|
|
DOMAIN = "ha_probe"
|
|
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
|
|
|
CONF_WEBHOOK_ID = "webhook_id"
|
|
|
|
|
|
def signal_entities(entry_id: str) -> str:
|
|
"""Return the dispatcher signal used to deliver a webhook payload's entities."""
|
|
return f"{DOMAIN}_{entry_id}_entities"
|
|
|
|
|
|
@dataclass
|
|
class HaProbeRuntimeData:
|
|
"""Runtime state for a configured probe webhook, kept on ConfigEntry.runtime_data."""
|
|
|
|
webhook_url: str = ""
|
|
devices: dict[str, str] = field(default_factory=dict)
|
|
device_meta: dict[str, dict[str, str]] = field(default_factory=dict)
|
|
entities: dict[str, "HaProbeSensor"] = field(default_factory=dict)
|