22 lines
633 B
Python
22 lines
633 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Sequence
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from app.dependencies import get_ha_reader
|
|
from app.ha.models import HaEntitySummary
|
|
from app.ha.reader import HaReader
|
|
|
|
router = APIRouter(prefix="/v1", tags=["entities"])
|
|
|
|
|
|
@router.get(
|
|
"/entities",
|
|
summary="Home-Assistant-Entities auflisten",
|
|
description="Gibt eine kompakte Zusammenfassung aller erreichbaren HA-Entitäten zurück.",
|
|
response_model=list[HaEntitySummary],
|
|
)
|
|
def list_entities(reader: HaReader = Depends(get_ha_reader)) -> Sequence[HaEntitySummary]:
|
|
return reader.read_entities()
|