Skip to main content
Glama

fibaro_control_rgb_light

Control RGB lights with one command, including on/off, color, and brightness settings. Simplifies management of smart lighting through the Fibaro HC3 MCP Server.

Instructions

Complete control for RGB lights: turn on/off, set color, and brightness in one command. Use this when user wants to control multiple aspects of an RGB light at once (e.g., "turn on light 5 red color at 50% brightness").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesTurn light on or off
brightnessNoBrightness level (0-100), optional
color_nameNoColor name (e.g., "red", "green", "blue", "xanh lá", "tím")
idYesDevice ID

Implementation Reference

  • The main execution handler for the fibaro_control_rgb_light tool. Handles turning the light on/off, setting color from name using getColorRGB helper, and adjusting brightness, composing results from multiple client calls.
    case 'fibaro_control_rgb_light': { 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 action = args?.action as string; const colorName = args?.color_name as string; const brightness = args?.brightness as number; const results = []; // First, turn on/off the light if (action === 'on') { await this.fibaroClient.turnOnDevice(deviceId); results.push(`Turned on device ${deviceId}`); } else if (action === 'off') { await this.fibaroClient.turnOffDevice(deviceId); results.push(`Turned off device ${deviceId}`); } // Set color if specified if (colorName && action === 'on') { const rgb = getColorRGB(colorName); await this.fibaroClient.setColor(deviceId, rgb.r, rgb.g, rgb.b, 0); results.push(`Set color to ${colorName} RGB(${rgb.r},${rgb.g},${rgb.b})`); } // Set brightness if specified if (brightness !== undefined && action === 'on') { await this.fibaroClient.setBrightness(deviceId, brightness); results.push(`Set brightness to ${brightness}%`); } return { content: [ { type: 'text', text: `Device ${deviceId}: ${results.join(', ')}`, }, ], }; }
  • src/index.ts:272-300 (registration)
    Tool registration in the listTools response, including name, description, and input schema definition.
    { name: 'fibaro_control_rgb_light', description: 'Complete control for RGB lights: turn on/off, set color, and brightness in one command. Use this when user wants to control multiple aspects of an RGB light at once (e.g., "turn on light 5 red color at 50% brightness").', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Device ID', }, action: { type: 'string', enum: ['on', 'off'], description: 'Turn light on or off', }, color_name: { type: 'string', description: 'Color name (e.g., "red", "green", "blue", "xanh lá", "tím")', }, brightness: { type: 'number', description: 'Brightness level (0-100), optional', minimum: 0, maximum: 100, }, }, required: ['id', 'action'], }, },
  • Input schema for validating parameters: id (required), action (on/off required), color_name (optional), brightness (optional).
    { name: 'fibaro_control_rgb_light', description: 'Complete control for RGB lights: turn on/off, set color, and brightness in one command. Use this when user wants to control multiple aspects of an RGB light at once (e.g., "turn on light 5 red color at 50% brightness").', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Device ID', }, action: { type: 'string', enum: ['on', 'off'], description: 'Turn light on or off', }, color_name: { type: 'string', description: 'Color name (e.g., "red", "green", "blue", "xanh lá", "tím")', }, brightness: { type: 'number', description: 'Brightness level (0-100), optional', minimum: 0, maximum: 100, }, }, required: ['id', 'action'], }, },
  • Helper function that maps color names (English and Vietnamese) to RGB values, used exclusively in the fibaro_control_rgb_light handler.
    function getColorRGB(colorName: string): { r: number; g: number; b: number } { const colors: { [key: string]: { r: number; g: number; b: number } } = { 'red': { r: 255, g: 0, b: 0 }, 'green': { r: 0, g: 255, b: 0 }, 'blue': { r: 0, g: 0, b: 255 }, 'yellow': { r: 255, g: 255, b: 0 }, 'purple': { r: 128, g: 0, b: 128 }, 'pink': { r: 255, g: 192, b: 203 }, 'orange': { r: 255, g: 165, b: 0 }, 'cyan': { r: 0, g: 255, b: 255 }, 'magenta': { r: 255, g: 0, b: 255 }, 'white': { r: 255, g: 255, b: 255 }, 'black': { r: 0, g: 0, b: 0 }, 'lime': { r: 50, g: 205, b: 50 }, 'violet': { r: 238, g: 130, b: 238 }, // Vietnamese color names 'đỏ': { r: 255, g: 0, b: 0 }, 'xanh lá': { r: 0, g: 255, b: 0 }, 'xanh dương': { r: 0, g: 0, b: 255 }, 'vàng': { r: 255, g: 255, b: 0 }, 'tím': { r: 128, g: 0, b: 128 }, 'hồng': { r: 255, g: 192, b: 203 }, 'cam': { r: 255, g: 165, b: 0 }, 'trắng': { r: 255, g: 255, b: 255 }, 'đen': { r: 0, g: 0, b: 0 } }; const normalizedName = colorName.toLowerCase().trim(); return colors[normalizedName] || { r: 255, g: 255, b: 255 }; // default to white }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kaeljune/fibaro-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server