pulse_effect
Create a pulsing color effect on LIFX smart lights by cycling between colors with adjustable timing, brightness, and duration for dynamic lighting.
Instructions
Perform a pulse effect
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | LIFX API token | |
| selector | No | Selector for filtering lights (default: 'all') | |
| color | Yes | Color to pulse | |
| from_color | No | Starting color | |
| period | No | Duration of one cycle in seconds | |
| cycles | No | Number of cycles | |
| persist | No | Persist the final color | |
| power_on | No | Turn on if off | |
| peak | No | Peak brightness (0.0 to 1.0) |
Implementation Reference
- src/index.ts:388-419 (handler)The main handler for the 'pulse_effect' tool. It extracts parameters from the input arguments, constructs the request body, makes a POST request to the LIFX API endpoint `/lights/{selector}/effects/pulse`, and returns a formatted success message with the API response.case "pulse_effect": { const { token, selector = "all", ...effectParams } = args as { token: string; selector?: string; color: string; from_color?: string; period?: number; cycles?: number; persist?: boolean; power_on?: boolean; peak?: number; }; const body = Object.fromEntries( Object.entries(effectParams).filter(([_, value]) => value !== undefined) ); const result = await makeLIFXRequest(`/lights/${selector}/effects/pulse`, { method: "POST", body, token, }); return { content: [ { type: "text", text: `Pulse effect started for selector "${selector}". ${JSON.stringify(result, null, 2)}`, }, ], }; }
- src/index.ts:207-221 (schema)The input schema defining the parameters, types, descriptions, and required fields for the 'pulse_effect' tool.inputSchema: { type: "object", properties: { token: { type: "string", description: "LIFX API token" }, selector: { type: "string", description: "Selector for filtering lights (default: 'all')" }, color: { type: "string", description: "Color to pulse" }, from_color: { type: "string", description: "Starting color" }, period: { type: "number", minimum: 0.1, description: "Duration of one cycle in seconds" }, cycles: { type: "number", minimum: 1, description: "Number of cycles" }, persist: { type: "boolean", description: "Persist the final color" }, power_on: { type: "boolean", description: "Turn on if off" }, peak: { type: "number", minimum: 0, maximum: 1, description: "Peak brightness (0.0 to 1.0)" }, }, required: ["token", "color"], },
- src/index.ts:204-222 (registration)The tool registration object that includes the name, description, and input schema, returned by the ListTools handler.{ name: "pulse_effect", description: "Perform a pulse effect", inputSchema: { type: "object", properties: { token: { type: "string", description: "LIFX API token" }, selector: { type: "string", description: "Selector for filtering lights (default: 'all')" }, color: { type: "string", description: "Color to pulse" }, from_color: { type: "string", description: "Starting color" }, period: { type: "number", minimum: 0.1, description: "Duration of one cycle in seconds" }, cycles: { type: "number", minimum: 1, description: "Number of cycles" }, persist: { type: "boolean", description: "Persist the final color" }, power_on: { type: "boolean", description: "Turn on if off" }, peak: { type: "number", minimum: 0, maximum: 1, description: "Peak brightness (0.0 to 1.0)" }, }, required: ["token", "color"], }, },