19 lines
458 B
Python
19 lines
458 B
Python
|
|
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) -> CheckResult:
|
||
|
|
"""Execute the check and return a result.
|
||
|
|
|
||
|
|
The caller is responsible for emitting events when result.event_type is set.
|
||
|
|
"""
|