homelab-codex-ws/services/ha-diag-agent/src/ha_diag/checks/base.py

21 lines
584 B
Python
Raw Normal View History

from __future__ import annotations
from abc import ABC, abstractmethod
from ..models import CheckResult
class Check(ABC):
"""Base class for all HA diagnostic checks."""
name: str # unique slug used in /trigger/<name> and check_history
@abstractmethod
async def run(self) -> list[CheckResult]:
"""Execute the check and return results.
Empty list means the check passed cleanly.
Each CheckResult with event_type set causes an event to be emitted.
The caller (runner in main.py) handles emission and history recording.
"""