fibaro_set_color
Change the color of RGB lights and color-changing devices by specifying red, green, and blue values to customize lighting in your smart home.
Instructions
Set RGB color for RGB lights and color-changing devices. Use this when user mentions colors, color names, or wants to change light color. Keywords: color, red, green, blue, yellow, purple, pink, orange, cyan, magenta, white, RGB, màu.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Device ID | |
| red | Yes | Red color value (0-255) | |
| green | Yes | Green color value (0-255) | |
| blue | Yes | Blue color value (0-255) | |
| white | No | White color value (0-255), optional |
Implementation Reference
- src/index.ts:486-504 (handler)MCP tool handler for 'fibaro_set_color' that validates connection, extracts RGB parameters, calls FibaroClient.setColor, and returns success message.case 'fibaro_set_color': { if (!this.fibaroClient) { throw new Error('Not connected to Fibaro HC3. Please check your configuration and restart the MCP server.'); } const deviceId = args?.id as number; const red = args?.red as number; const green = args?.green as number; const blue = args?.blue as number; const white = args?.white as number || 0; await this.fibaroClient.setColor(deviceId, red, green, blue, white); return { content: [ { type: 'text', text: `Successfully set color for device ${deviceId} to RGB(${red},${green},${blue},${white})`, }, ], }; }
- src/index.ts:234-271 (registration)Registration of the 'fibaro_set_color' tool in the ListTools response, including name, description, and input schema definition.{ name: 'fibaro_set_color', description: 'Set RGB color for RGB lights and color-changing devices. Use this when user mentions colors, color names, or wants to change light color. Keywords: color, red, green, blue, yellow, purple, pink, orange, cyan, magenta, white, RGB, màu.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Device ID', }, red: { type: 'number', description: 'Red color value (0-255)', minimum: 0, maximum: 255, }, green: { type: 'number', description: 'Green color value (0-255)', minimum: 0, maximum: 255, }, blue: { type: 'number', description: 'Blue color value (0-255)', minimum: 0, maximum: 255, }, white: { type: 'number', description: 'White color value (0-255), optional', minimum: 0, maximum: 255, }, }, required: ['id', 'red', 'green', 'blue'], }, },
- src/fibaro-client.ts:154-162 (helper)FibaroClient helper method that performs the actual API call to set RGB color on a Fibaro device.async setColor(id: number, red: number, green: number, blue: number, white: number = 0): Promise<void> { try { await this.client.post(`/api/devices/${id}/action/setColor`, { args: [red, green, blue, white] }); } catch (error) { throw new Error(`Failed to set color for device ${id} to RGB(${red},${green},${blue},${white}): ${error}`); } }