set_color_brightness
Set hue (0-360) and brightness (0-100) for RGB lights, with optional white mode on supported hardware.
Instructions
Set color and brightness for an RGB light.
Args: hue: Color hue (0-360). brightness: Brightness level (0-100). idx: Device index. name: Device name. iswhite: Set to True for white mode (on supported hardware).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hue | Yes | ||
| brightness | Yes | ||
| idx | No | ||
| name | No | ||
| iswhite | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:920-939 (handler)The handler function for the 'set_color_brightness' tool. It sets color (hue 0-360) and brightness (0-100) for an RGB light device via Domoticz API.
@mcp.tool() async def set_color_brightness(hue: int, brightness: int, idx: int | None = None, name: str | None = None, iswhite: bool = False) -> str: """Set color and brightness for an RGB light. Args: hue: Color hue (0-360). brightness: Brightness level (0-100). idx: Device index. name: Device name. iswhite: Set to True for white mode (on supported hardware). """ if idx is None and name is None: return '{"status": "error", "message": "Must provide either idx or name"}' async with create_client() as client: resolved_idx = await _resolve_device_idx(client, idx, name) if resolved_idx is None: return '{"status": "error", "message": "Device not found"}' response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=setcolbrightnessvalue&idx={resolved_idx}&hue={hue}&brightness={brightness}&iswhite={str(iswhite).lower()}") return response.text - src/domoticz_mcp/server.py:921-930 (schema)The docstring serves as the schema definition for the tool, describing the parameters: hue (int 0-360), brightness (int 0-100), idx (optional int), name (optional str), iswhite (optional bool).
@mcp.tool() async def set_color_brightness(hue: int, brightness: int, idx: int | None = None, name: str | None = None, iswhite: bool = False) -> str: """Set color and brightness for an RGB light. Args: hue: Color hue (0-360). brightness: Brightness level (0-100). idx: Device index. name: Device name. iswhite: Set to True for white mode (on supported hardware). - src/domoticz_mcp/server.py:920-922 (registration)The tool is registered via the @mcp.tool() decorator on the async function, which registers it with the FastMCP instance.
@mcp.tool() async def set_color_brightness(hue: int, brightness: int, idx: int | None = None, name: str | None = None, iswhite: bool = False) -> str: