home / skills / openclaw / skills / homeassistant-n8n-agent

homeassistant-n8n-agent skill

/skills/enchantedmotorcycle/homeassistant-n8n-agent

This skill bridges OpenClaw with your n8n instance to automate Home Assistant workflows and IoT tasks.

npx playbooks add skill openclaw/skills --skill homeassistant-n8n-agent

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
2.3 KB
---
name: homeassistant-n8n-agent
description: Bridge OpenClaw with your n8n instance for Home Assistant automation.
homepage: https://n8n.io/
metadata: {"clawdis":{"emoji":"🤖","requires":{"bins":["curl"]}}}
---

# Home‑Assistant – n8n Agent Skill
This skill bridges OpenClaw with your n8n instance for Home Assistant automation.

# How it works
Uses curl to trigger a n8n workflow for all things related to IoT.  All requests should be a POST formatted as follows: curl -X POST http://localhost:5678/webhook/05f3f217-08b9-42de-a84a-e13f135bde73 -H "Content-Type: application/json" -d '{"chatInput": "USERS QUESTION/REQUEST", "requestType": "DETERMINED REQUEST TYPE", "sessionId":"openclaw"}'

# Steps
Determine the nature of a user's prompt.

1. Is the inquiry about a current device state or multiple states?  If so, `requestType` is `state`
2. Is the inquiry asking for an IoT device state to be changed?  If so, `requestType` is `action`
3. Is the inquiry asking about IoT data from the past?  If so, `requestType` is `historical`
4. Is the inquiry asking about calendar or schedule information?  If so, `requestType` is `calendar`

## Quick Reference

### Action
```bash
curl -X POST http://localhost:5678/webhook/05f3f217-08b9-42de-a84a-e13f135bde73 -H "Content-Type: application/json" -d '{"chatInput": "turn off the office light", "requestType": "action", "sessionId":"openclaw"}'

curl -X POST http://localhost:5678/webhook/05f3f217-08b9-42de-a84a-e13f135bde73 -H "Content-Type: application/json" -d '{"chatInput": "change the downstairs thermostat to 72", "requestType": "action", "sessionId":"openclaw"}'
```

### Historical
```bash
curl -X POST http://localhost:5678/webhook/05f3f217-08b9-42de-a84a-e13f135bde73 -H "Content-Type: application/json" -d '{"chatInput": "when was the front door last opened?", "requestType": "historical", "sessionId":"openclaw"}'
```

### State
```bash
curl -X POST http://localhost:5678/webhook/05f3f217-08b9-42de-a84a-e13f135bde73 -H "Content-Type: application/json" -d '{"chatInput": "is the air conditioner running?", "requestType": "state, "sessionId":"openclaw"}'
```

### Calendar
```bash
curl -X POST http://localhost:5678/webhook/05f3f217-08b9-42de-a84a-e13f135bde73 -H "Content-Type: application/json" -d '{"chatInput": "when is my next meeting?", "requestType": "calendar, "sessionId":"openclaw"}'
```

Overview

This skill bridges OpenClaw with your n8n instance to enable Home Assistant automation workflows. It sends structured POST requests to an n8n webhook so natural language prompts become actionable IoT events. Designed for simple integration, it supports state checks, device actions, historical queries, and calendar lookups.

How this skill works

The agent formats user prompts into a JSON POST and forwards them to a configurable n8n webhook URL using curl. Each request includes chatInput, a requestType (action, state, historical, or calendar), and a sessionId for context. n8n workflows receive the payload and map it to Home Assistant automations, sensors, or data queries.

When to use it

  • Trigger device changes from natural language (lights, thermostats, locks).
  • Check current device or sensor states without logging into Home Assistant.
  • Ask about past IoT events or sensor history.
  • Query calendar or schedule items that your Home Assistant integrates with.
  • Bridge conversational agents to n8n workflows for custom automation logic.

Best practices

  • Run the n8n webhook behind a secure network or reverse proxy; avoid exposing it publicly.
  • Standardize requestType mapping in your n8n workflows to ensure consistent behavior.
  • Include a sessionId to correlate multi-step interactions or logs.
  • Validate and sanitize chatInput on the n8n side before invoking Home Assistant services.
  • Log incoming webhook payloads for troubleshooting and auditability.

Example use cases

  • "Turn off the office light" routed as requestType: action to run a lighting workflow.
  • "Is the air conditioner running?" sent as requestType: state to query current sensor data.
  • "When was the front door last opened?" sent as requestType: historical to fetch event logs.
  • "Change the downstairs thermostat to 72" triggers a thermostat adjustment workflow.
  • "When is my next meeting?" sent as requestType: calendar to surface schedule data in Home Assistant.

FAQ

Do I need to run n8n locally?

No. n8n can run locally, on a server, or in the cloud. The webhook URL must be reachable by the agent, and you should secure the endpoint.

How do I pick the correct requestType?

Classify the prompt by intent: use action for state changes, state for current conditions, historical for past data, and calendar for schedule queries.