Skip to main content
Glama
kaeljune

Fibaro HC3 MCP Server

by kaeljune

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
NameRequiredDescriptionDefault
idYesDevice ID
redYesRed color value (0-255)
greenYesGreen color value (0-255)
blueYesBlue color value (0-255)
whiteNoWhite color value (0-255), optional

Implementation Reference

  • 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'],
      },
    },
  • 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}`);
      }
    }

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