MVP: add dashboard and Home Assistant add-on
Some checks failed
quality / test (3.11) (push) Has been cancelled
quality / test (3.13) (push) Has been cancelled

This commit is contained in:
2026-06-13 21:12:02 +02:00
parent 2f7f49b8a0
commit 5764b27bac
9 changed files with 237 additions and 4 deletions

View File

@@ -1,8 +1,11 @@
from contextlib import asynccontextmanager
from collections.abc import AsyncIterator
from pathlib import Path
from typing import cast
from fastapi import FastAPI
from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
from app.api.v1.entities import router as entities_router
from app.api.v1.automations import router as automations_router
@@ -41,7 +44,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
app = FastAPI(
title="SillyHome Next API",
description="Lokales Smart-Home-Intelligenzsystem für Home Assistant.",
version="0.2.0",
version="0.3.0",
lifespan=lifespan,
)
app.state.settings = load_settings()
@@ -50,6 +53,9 @@ app.include_router(entities_router)
app.include_router(automations_router)
init_ml_routes(app, model_store=app.state.settings.model_store)
STATIC_DIR = Path(__file__).with_name("static")
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
@app.get("/health")
def health() -> dict[str, str]:
@@ -57,5 +63,5 @@ def health() -> dict[str, str]:
@app.get("/")
def root() -> dict[str, str]:
return {"service": "sillyhome-next", "docs": "/docs"}
def root() -> FileResponse:
return FileResponse(STATIC_DIR / "index.html")