Refactor API Docs CI workflow to correct ESLint command syntax and enhance Python formatting in CI pipelines; update progress tracking documentation
Some checks failed
API Docs (Node.js Express) / test (16) (push) Failing after 5m29s
API Docs (Node.js Express) / test (18) (push) Failing after 5m25s
API Docs (Node.js Express) / test (20) (push) Failing after 1m4s
API Docs (Node.js Express) / build (push) Has been skipped
API Docs (Node.js Express) / security (push) Has been skipped
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 4m52s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 5m1s
LabFusion CI/CD Pipeline / api-docs (push) Failing after 5m12s
LabFusion CI/CD Pipeline / frontend (push) Failing after 6m39s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
Docker Build and Push / build-and-push (push) Failing after 34s
Docker Build and Push / security-scan (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 1m33s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 35s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 5m20s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 5m27s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 5m50s
Docker Build and Push / deploy-staging (push) Has been skipped
Service Adapters (Python FastAPI) / build (push) Has been skipped
Service Adapters (Python FastAPI) / security (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped

This commit is contained in:
glenn schrooyen
2025-09-12 17:44:23 +02:00
parent 60da5ea115
commit 8d1755fd52
13 changed files with 642 additions and 336 deletions

View File

@@ -1,26 +1,30 @@
from fastapi import APIRouter, HTTPException, Path
from models.schemas import HAEntitiesResponse, HAEntity, HAAttributes
from models.schemas import HAAttributes, HAEntitiesResponse, HAEntity
from services.config import SERVICES
router = APIRouter()
@router.get("/home-assistant/entities",
response_model=HAEntitiesResponse,
summary="Get Home Assistant Entities",
description="Retrieve all entities from Home Assistant",
responses={
200: {"description": "Successfully retrieved entities"},
503: {"description": "Home Assistant integration not configured"}
},
tags=["Home Assistant"])
@router.get(
"/home-assistant/entities",
response_model=HAEntitiesResponse,
summary="Get Home Assistant Entities",
description="Retrieve all entities from Home Assistant",
responses={
200: {"description": "Successfully retrieved entities"},
503: {"description": "Home Assistant integration not configured"},
},
tags=["Home Assistant"],
)
async def get_ha_entities():
"""Get Home Assistant entities including sensors, switches, and other devices"""
if not SERVICES["home_assistant"]["enabled"]:
raise HTTPException(
status_code=503,
detail="Home Assistant integration not configured. Please set HOME_ASSISTANT_TOKEN environment variable."
status_code=503,
detail="Home Assistant integration not configured. Please set HOME_ASSISTANT_TOKEN environment variable.",
)
# This would make actual API calls to Home Assistant
# For now, return mock data
return HAEntitiesResponse(
@@ -29,46 +33,46 @@ async def get_ha_entities():
entity_id="sensor.cpu_usage",
state="45.2",
attributes=HAAttributes(
unit_of_measurement="%",
friendly_name="CPU Usage"
)
unit_of_measurement="%", friendly_name="CPU Usage"
),
),
HAEntity(
entity_id="sensor.memory_usage",
state="2.1",
attributes=HAAttributes(
unit_of_measurement="GB",
friendly_name="Memory Usage"
)
)
unit_of_measurement="GB", friendly_name="Memory Usage"
),
),
]
)
@router.get("/home-assistant/entity/{entity_id}",
response_model=HAEntity,
summary="Get Specific HA Entity",
description="Get a specific Home Assistant entity by ID",
responses={
200: {"description": "Successfully retrieved entity"},
404: {"description": "Entity not found"},
503: {"description": "Home Assistant integration not configured"}
},
tags=["Home Assistant"])
@router.get(
"/home-assistant/entity/{entity_id}",
response_model=HAEntity,
summary="Get Specific HA Entity",
description="Get a specific Home Assistant entity by ID",
responses={
200: {"description": "Successfully retrieved entity"},
404: {"description": "Entity not found"},
503: {"description": "Home Assistant integration not configured"},
},
tags=["Home Assistant"],
)
async def get_ha_entity(entity_id: str = Path(..., description="Entity ID")):
"""Get a specific Home Assistant entity by its ID"""
if not SERVICES["home_assistant"]["enabled"]:
raise HTTPException(
status_code=503,
detail="Home Assistant integration not configured. Please set HOME_ASSISTANT_TOKEN environment variable."
status_code=503,
detail="Home Assistant integration not configured. Please set HOME_ASSISTANT_TOKEN environment variable.",
)
# This would make actual API calls to Home Assistant
# For now, return mock data
return HAEntity(
entity_id=entity_id,
state="unknown",
attributes=HAAttributes(
unit_of_measurement="",
friendly_name=f"Entity {entity_id}"
)
unit_of_measurement="", friendly_name=f"Entity {entity_id}"
),
)