set_color_brightness
Set the color and brightness of an RGB light using hue (0-360) and brightness (0-100) values. Optionally enable white mode or specify device by index or name.
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:969-987 (handler)The main handler function for the set_color_brightness MCP tool. Sets color hue and brightness for an RGB light by calling the Domoticz 'setcolbrightnessvalue' 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:973-983 (schema)Input schema/parameters for set_color_brightness: hue (int 0-360), brightness (int 0-100), optional idx/name for device lookup, and optional iswhite flag.
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) - src/domoticz_mcp/server.py:969-970 (registration)Registration of the tool via the @mcp.tool() decorator on the FastMCP instance, making it available as an MCP tool named 'set_color_brightness'.
@mcp.tool() async def set_color_brightness(hue: int, brightness: int, idx: int | None = None, name: str | None = None, iswhite: bool = False) -> str: