device state setting fix 7

This commit is contained in:
2025-11-19 10:41:39 +01:00
parent d138d7bf0a
commit 91fdfde280

View File

@@ -365,6 +365,17 @@ async def publish_mqtt(topic: str, payload: dict[str, Any]) -> None:
await client.publish(topic, message, qos=1)
@app.get("/devices/states")
async def get_device_states() -> dict[str, dict[str, Any]]:
"""Get current states of all devices from in-memory cache.
Returns:
dict: Dictionary mapping device_id to state payload
"""
logger.debug("Fetching all device states")
return device_states
@app.get("/devices/{device_id}")
async def get_device(device_id: str) -> DeviceInfo:
logger.debug(f"Fetching info for device {device_id}")
@@ -379,6 +390,7 @@ async def get_device(device_id: str) -> DeviceInfo:
features=device.get("features", {})
)
@app.get("/devices")
async def get_devices() -> list[DeviceInfo]:
"""Get list of available devices.
@@ -399,16 +411,6 @@ async def get_devices() -> list[DeviceInfo]:
]
@app.get("/devices/states")
async def get_device_states() -> dict[str, dict[str, Any]]:
"""Get current states of all devices from in-memory cache.
Returns:
dict: Dictionary mapping device_id to state payload
"""
logger.debug("Fetching all device states")
return device_states
@app.get("/layout")
async def get_layout() -> dict[str, Any]: