This commit is contained in:
2026-02-21 16:55:10 +01:00
commit 1b8bf79d46
49 changed files with 4347 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
from fastapi import APIRouter, Depends
from sqlmodel import Session, func, select
from app.database import get_session
from app.ha_client import ha_client
from app.models import EntityCache
from app.scan_state import scan_state
router = APIRouter()
@router.get("/health")
async def health(session: Session = Depends(get_session)):
connected, message = await ha_client.check_connection()
count = session.exec(select(func.count()).select_from(EntityCache)).one()
return {
"status": "ok",
"ha_connected": connected,
"ha_message": message,
"entity_count": count,
**scan_state.to_dict(),
}