Overview
The trigger node creates timed message patterns. When
triggered, it can immediately send an initial payload, wait for a configurable delay, then send
a second payload. It supports three modes: send-then-wait, wait-then-send, and resettable timer.
This makes it ideal for timeout patterns, watchdog timers, debouncing, and state-based automation.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| op | string | "send-wait" | Operating mode: send-then-wait, wait-then-send, or resettable |
| initialPayload | any | 1 | Payload sent immediately on trigger |
| secondPayload | any | 0 | Payload sent after the delay period |
| delay | number | 250 | Delay duration in milliseconds |
| duration | number | 0 | Duration unit multiplier (ms, s, min, hr) |
| extend | boolean | false | Extend the delay timer on each new message |
| reset | boolean | false | Allow msg.reset to cancel the timer |
Trigger Modes
Send Then Wait
Send initial payload immediately, then send second payload after delay.
// t=0: Send "ON" (1)
// t=5s: Send "OFF" (0)
// Great for: lights, alarms Wait Then Send
Wait for the delay period, then send a single payload. Debouncing pattern.
// t=0: Start timer (no output)
// t=5s: Send payload
// Great for: debounce, cooldown Resettable
Timer resets on each trigger. Only fires if no message arrives within the delay.
// Each msg resets the timer
// Only fires after silence
// Great for: watchdog, inactivity Example: Motion Sensor Light Timer
Turn on a light immediately when motion is detected, then turn it off after 5 minutes of inactivity.
// Trigger node configuration
{
"op": "send-wait",
"initialPayload": 1, // Send ON immediately
"secondPayload": 0, // Send OFF after delay
"delay": 300000, // 5 minutes (300,000 ms)
"extend": true, // Reset timer on new motion
"reset": true // Allow manual reset
}
// Flow: [Motion Sensor] -> [Trigger] -> [Light Control]
//
// Timeline:
// 10:00:00 - Motion detected -> Light ON, timer starts (5 min)
// 10:02:30 - Motion detected -> Timer extends to 10:07:30
// 10:04:00 - Motion detected -> Timer extends to 10:09:00
// 10:09:00 - No more motion -> Light OFF
//
// Output at 10:00:00: { "payload": 1 } (ON)
// Output at 10:09:00: { "payload": 0 } (OFF) Example: Watchdog Timer
Alert when a sensor stops sending data for more than 60 seconds.
// Trigger node configuration (resettable watchdog)
{
"op": "wait-send",
"secondPayload": {
"alert": "Sensor offline",
"severity": "warning"
},
"delay": 60000, // 60 seconds timeout
"extend": true, // Each heartbeat resets timer
"reset": false
}
// Flow: [Sensor MQTT] -> [Trigger] -> [Alert Handler]
//
// Normal operation:
// - Sensor sends data every 10 seconds
// - Each message resets the 60-second timer
// - Trigger never fires
//
// Sensor failure:
// - Last message at t=0
// - No messages for 60 seconds
// - Trigger fires at t=60s with alert payload
// - Alert Handler sends email / dashboard notification Common Use Cases
Timed Automation
Turn devices on then off after a delay (lights, fans, irrigation systems).
Watchdog Monitoring
Detect when a device or service stops responding within expected intervals.
Debounce Input
Suppress rapid repeated messages and only act after a quiet period.
Heartbeat Generation
Generate periodic status messages as long as the system is running.