Skip to main content
Glama
hekmon8

Home Assistant MCP Server

by hekmon8

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
NameRequiredDescriptionDefault
automation_idYesThe automation ID to trigger (e.g., automation.morning_routine)

Implementation Reference

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

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/hekmon8/Homeassistant-server-mcp'

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