n8n-nodes-smarthomebrain
v0.2.1
Published
n8n node for SmartHomeBrain smart home platform
Downloads
1,265
Readme
n8n-nodes-smarthomebrain
n8n community nodes for the SmartHomeBrain smart home platform.
Nodes
SmartHomeBrain Trigger
Subscribes to the device-manager WebSocket and fires your workflow when a device changes state or a button is pressed. Filters by device, device type, and area, then narrows with a Trigger On mode:
| Trigger On | Fires when | Adaptive fields | |---|---|---| | Any Change (default) | Any capability change or button press matching the filters above | — (matches previous node behavior) | | Specific Capability Field | One field of one capability meets a condition | Capability and Field dropdowns only list what the selected device actually declares; Condition adapts to the field's type — booleans get Changed / Becomes True / Becomes False, numbers get Changed / Crosses Above / Crosses Below / Changes By At Least (with a Threshold), closed-vocabulary strings (lock state, thermostat mode, presence event) get Changed / Equals (with a Value dropdown) | | Button Press | A specific button + gesture fires | Button and Action dropdowns only list the buttons/gestures the selected device's profile declares |
"Specific Capability Field" and "Button Press" require picking one exact Device above (not "Any Device") — that's what makes the dropdowns adaptive. "Crosses Above"/"Crosses Below" are edge-triggered (fire once per crossing, not on every reading already past the threshold).
Output fields:
| Field | Type | Description |
|---|---|---|
| id / deviceId | string | System device ID |
| slug | string | Human-friendly slug, e.g. hallway-motion |
| deviceName | string | Friendly name |
| deviceType | string | e.g. motion, switch, light |
| areaId / areaName | string | null | Area ID / display name |
| capabilities | array | Full current capability state, e.g. [{ kind: 'OccupancySensing', occupancy: true }] |
| events | array | undefined | Button press(es) that matched, for Button Press mode / Any Change with a remote |
| availability | string | online / offline / unknown |
| timestamp | string | ISO 8601 timestamp |
SmartHomeBrain
Action node with four operations:
| Operation | What it does |
|---|---|
| Send Command | POSTs a command. Target picks who receives it: • Single Device — resolves a device slug → ID, same as before. • Multiple Devices — hand-pick any set of devices from a checklist; the same command is sent to each. Each targeted device gets its own output item (deviceId/slug included), and a device that fails doesn't discard results already collected from the others — with Continue On Fail off, the first failure still aborts the run, but successes already emitted are kept. Capability narrows to what's actually usable: for a single device, its live reported state → matched code profile → device-type default. For multiple devices, the intersection across every selected device, so only commands guaranteed to work for all of them show up. |
| Get Device State | Returns the current merged state of all devices |
| List Devices | Returns all adopted devices (one item per device) |
| List Areas | Returns all synced areas |
Installation
In n8n → Settings → Community Nodes → Install → enter:
n8n-nodes-smarthomebrainOr via CLI inside the n8n container:
npm install n8n-nodes-smarthomebrainRestart n8n after installing.
Credential setup
- In n8n → Credentials → New → search
SmartHomeBrain API - Fill in:
- Host URL: the address of your device-manager, e.g.
http://192.168.10.30:3001 - API Key: paste a key from the dashboard → Settings → API Keys
- Host URL: the address of your device-manager, e.g.
- Click Test — you should see
SmartHomeBrain is reachable and healthy
Creating your first API key
On first visit to the SmartHomeBrain dashboard, the setup wizard runs automatically. If you already have access:
- Open the dashboard → API Keys (key icon in sidebar)
- Click Generate New Key → give it a name (e.g.
n8n) - Copy the full key (
shb_…) — it's shown only once - Paste it into the n8n credential
Example workflow
[SmartHomeBrain Trigger] [SmartHomeBrain]
Device: hallway-motion → Operation: Send Command
Trigger On: Specific Capability Device: living-room-light
Capability: OccupancySensing Capability: OnOff
Field: Occupancy Command: on
Condition: Becomes TrueWith "Becomes True" the trigger only fires on the false→true edge, so no IF node is needed to gate it — wire the trigger straight into the command.
Development
# Type-check
pnpm typecheck
# Tests
pnpm test
# Build
pnpm build
# Publish
npm publish