device state setting fix 7
This commit is contained in:
@@ -365,6 +365,17 @@ async def publish_mqtt(topic: str, payload: dict[str, Any]) -> None:
|
|||||||
await client.publish(topic, message, qos=1)
|
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}")
|
@app.get("/devices/{device_id}")
|
||||||
async def get_device(device_id: str) -> DeviceInfo:
|
async def get_device(device_id: str) -> DeviceInfo:
|
||||||
logger.debug(f"Fetching info for device {device_id}")
|
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", {})
|
features=device.get("features", {})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/devices")
|
@app.get("/devices")
|
||||||
async def get_devices() -> list[DeviceInfo]:
|
async def get_devices() -> list[DeviceInfo]:
|
||||||
"""Get list of available devices.
|
"""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")
|
@app.get("/layout")
|
||||||
async def get_layout() -> dict[str, Any]:
|
async def get_layout() -> dict[str, Any]:
|
||||||
|
|||||||
Reference in New Issue
Block a user