trigger_automation
Execute Home Assistant automations by specifying the automation ID to control devices and routines in your smart home.
Instructions
Trigger a Home Assistant automation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| automation_id | Yes | The automation ID to trigger (e.g., automation.morning_routine) |
Implementation Reference
- src/index.ts:183-200 (handler)The main execution logic for the 'trigger_automation' tool. Validates input, calls Home Assistant API to trigger the specified automation, and returns success response.private async triggerAutomation(args: any) { if (!args.automation_id) { throw new McpError(ErrorCode.InvalidParams, 'automation_id is required'); } const response = await this.haClient.post('/api/services/automation/trigger', { entity_id: args.automation_id, }); return { content: [ { type: 'text', text: `Successfully triggered ${args.automation_id}`, }, ], }; }
- src/index.ts:92-101 (schema)JSON Schema defining the input parameters for the tool: requires 'automation_id' as a string.inputSchema: { type: 'object', properties: { automation_id: { type: 'string', description: 'The automation ID to trigger (e.g., automation.morning_routine)', }, }, required: ['automation_id'], },
- src/index.ts:89-102 (registration)Registration of the tool in the 'list_tools' response, including name, description, and schema.{ name: 'trigger_automation', description: 'Trigger a Home Assistant automation', inputSchema: { type: 'object', properties: { automation_id: { type: 'string', description: 'The automation ID to trigger (e.g., automation.morning_routine)', }, }, required: ['automation_id'], }, },
- src/index.ts:126-127 (registration)Dispatch/route in the 'call_tool' request handler that maps tool name to the handler function.case 'trigger_automation': return await this.triggerAutomation(request.params.arguments);