excluded 2
All checks were successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/build/7 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/deploy/6 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
All checks were successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/build/7 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/deploy/6 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
This commit is contained in:
@@ -48,11 +48,11 @@ class HeatingControlRequest(BaseModel):
|
||||
target: float # Target temperature
|
||||
|
||||
|
||||
def get_room_devices(room_name: str) -> list[dict[str, Any]]:
|
||||
def get_room_devices(room_id: str) -> list[dict[str, Any]]:
|
||||
"""Get all devices in a specific room from layout.
|
||||
|
||||
Args:
|
||||
room_name: Name of the room
|
||||
room_id: ID of the room
|
||||
|
||||
Returns:
|
||||
List of device dicts with device_id, title, icon, rank, excluded
|
||||
@@ -63,7 +63,7 @@ def get_room_devices(room_name: str) -> list[dict[str, Any]]:
|
||||
layout = load_layout()
|
||||
|
||||
for room in layout.rooms:
|
||||
if room.name == room_name:
|
||||
if room.id == room_id:
|
||||
return [
|
||||
{
|
||||
"device_id": device.device_id,
|
||||
@@ -77,16 +77,16 @@ def get_room_devices(room_name: str) -> list[dict[str, Any]]:
|
||||
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=f"Room '{room_name}' not found"
|
||||
detail=f"Room '{room_id}' not found"
|
||||
)
|
||||
|
||||
|
||||
@router.post("/rooms/{room_name}/lights", status_code=status.HTTP_202_ACCEPTED)
|
||||
async def control_room_lights(room_name: str, request: LightsControlRequest) -> dict[str, Any]:
|
||||
@router.post("/rooms/{room_id}/lights", status_code=status.HTTP_202_ACCEPTED)
|
||||
async def control_room_lights(room_id: str, request: LightsControlRequest) -> dict[str, Any]:
|
||||
"""Control all lights (light and relay devices) in a room.
|
||||
|
||||
Args:
|
||||
room_name: Name of the room
|
||||
room_id: ID of the room
|
||||
request: Light control parameters
|
||||
|
||||
Returns:
|
||||
@@ -95,7 +95,7 @@ async def control_room_lights(room_name: str, request: LightsControlRequest) ->
|
||||
from apps.api.main import load_devices, publish_abstract_set
|
||||
|
||||
# Get all devices in room
|
||||
room_devices = get_room_devices(room_name)
|
||||
room_devices = get_room_devices(room_id)
|
||||
|
||||
# Filter out excluded devices
|
||||
room_device_ids = {d["device_id"] for d in room_devices if not d.get("excluded", False)}
|
||||
@@ -112,7 +112,7 @@ async def control_room_lights(room_name: str, request: LightsControlRequest) ->
|
||||
if not light_devices:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=f"No light devices found in room '{room_name}'"
|
||||
detail=f"No light devices found in room '{room_id}'"
|
||||
)
|
||||
|
||||
# Build payload
|
||||
@@ -141,7 +141,7 @@ async def control_room_lights(room_name: str, request: LightsControlRequest) ->
|
||||
})
|
||||
|
||||
return {
|
||||
"room": room_name,
|
||||
"room": room_id,
|
||||
"command": "lights",
|
||||
"payload": payload,
|
||||
"affected_devices": affected_ids,
|
||||
@@ -151,12 +151,12 @@ async def control_room_lights(room_name: str, request: LightsControlRequest) ->
|
||||
}
|
||||
|
||||
|
||||
@router.post("/rooms/{room_name}/heating", status_code=status.HTTP_202_ACCEPTED)
|
||||
async def control_room_heating(room_name: str, request: HeatingControlRequest) -> dict[str, Any]:
|
||||
@router.post("/rooms/{room_id}/heating", status_code=status.HTTP_202_ACCEPTED)
|
||||
async def control_room_heating(room_id: str, request: HeatingControlRequest) -> dict[str, Any]:
|
||||
"""Control all thermostats in a room.
|
||||
|
||||
Args:
|
||||
room_name: Name of the room
|
||||
room_id: ID of the room
|
||||
request: Heating control parameters
|
||||
|
||||
Returns:
|
||||
@@ -165,7 +165,7 @@ async def control_room_heating(room_name: str, request: HeatingControlRequest) -
|
||||
from apps.api.main import load_devices, publish_abstract_set
|
||||
|
||||
# Get all devices in room
|
||||
room_devices = get_room_devices(room_name)
|
||||
room_devices = get_room_devices(room_id)
|
||||
|
||||
# Filter out excluded devices
|
||||
room_device_ids = {d["device_id"] for d in room_devices if not d.get("excluded", False)}
|
||||
@@ -209,7 +209,7 @@ async def control_room_heating(room_name: str, request: HeatingControlRequest) -
|
||||
})
|
||||
|
||||
return {
|
||||
"room": room_name,
|
||||
"room": room_id,
|
||||
"command": "heating",
|
||||
"payload": payload,
|
||||
"affected_devices": affected_ids,
|
||||
|
||||
Reference in New Issue
Block a user