Overview
The relay node controls relay modules for switching high-power loads such as
lights, fans, pumps, and appliances. It supports both latching (on/off) and pulse mode for momentary activation,
making it ideal for home automation, industrial control, and IoT switching applications.
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| pin | number | Yes | 0 | Relay control GPIO pin (BCM numbering) |
| initialState | boolean | No | false | Initial relay state on deploy (false = OFF) |
| activeLow | boolean | No | false | Invert logic for active-low relay modules |
| pulseMode | boolean | No | false | Enable pulse mode for momentary activation |
| pulseDuration | number | No | 100 | Pulse duration in milliseconds |
Inputs
Controls the relay state or triggers a pulse.
true Activate relay (ON) false Deactivate relay (OFF) "pulse" Momentary pulse activation Outputs
Outputs current relay state with metadata.
{
"state": true,
"pin": 17,
"pulseMode": false,
"timestamp": 1709251200000
} Wiring / Connection Diagram
Relay Module to Raspberry Pi
Raspberry Pi Relay Module
+-----------+ +-------------+
| | | |
| GPIO 17 |----[Signal]---| IN |
| | | |
| 5V |----[Power]----| VCC | Load (Lamp, Fan, etc.)
| | | | +--------+
| GND |----[Ground]---| GND COM |-------| AC/DC |
| | | NO |-------| Device |
+-----------+ | NC | +--------+
+-------------+
|
Note: NO = Normally Open (closes on activate) [Mains/
NC = Normally Closed (opens on activate) Power] Safety: High-voltage relay wiring should only be done by qualified personnel. Always disconnect mains power before wiring. Use appropriate fuses and enclosures.
Example Use Cases
Scheduled Light Control
Turn a light on at sunset and off at sunrise using a schedule node.
[
{
"id": "sunset-schedule",
"type": "schedule",
"cron": "0 18 * * *",
"payload": true
},
{
"id": "light-relay",
"type": "relay",
"pin": 17,
"activeLow": true,
"initialState": false
}
] Temperature-Based Fan Control
Activate a cooling fan when temperature exceeds threshold.
[
{
"id": "temp-sensor",
"type": "dht22",
"pin": 4,
"interval": 5000
},
{
"id": "temp-check",
"type": "switch",
"property": "payload.temperature",
"rules": [
{ "t": "gt", "v": "30" },
{ "t": "lte", "v": "25" }
]
},
{
"id": "fan-relay",
"type": "relay",
"pin": 27,
"activeLow": false
}
] Garage Door Pulse Trigger
Use pulse mode to momentarily trigger a garage door opener.
[
{
"id": "dash-button",
"type": "button",
"label": "Open Garage",
"payload": "pulse"
},
{
"id": "garage-relay",
"type": "relay",
"pin": 22,
"pulseMode": true,
"pulseDuration": 500
}
] Common Use Cases
Home Lighting
Switch mains-powered lights on/off remotely
Irrigation Control
Activate water pumps and solenoid valves
Appliance Automation
Control heaters, fans, and AC units
Access Control
Pulse-trigger door locks and gate openers