2026-05-29 12:26:34 +02:00
|
|
|
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
|
2026-05-29 13:41:55 +02:00
|
|
|
async def run(self) -> list[CheckResult]:
|
|
|
|
|
"""Execute the check and return results.
|
2026-05-29 12:26:34 +02:00
|
|
|
|
2026-05-29 13:41:55 +02:00
|
|
|
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.
|
2026-05-29 12:26:34 +02:00
|
|
|
"""
|