Triggers a flow manually or at regular intervals. Can inject timestamps, strings, numbers, JSON objects, or context values.
Overview
The inject node is one of the most commonly used nodes in EdgeFlow. It allows you to:
- Manually trigger a flow by clicking the button on the node
- Automatically inject messages at regular intervals
- Schedule injections using cron expressions
- Inject on flow deployment (useful for initialization)
- Toggle mode: alternate payload between true/false on each tick (perfect for blinking LEDs)
This node is essential for testing and debugging flows, as well as creating time-based automations.
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | - | - | Display name for this node in the editor. |
payload | any | - | timestamp | The payload to inject. Can be a timestamp, string, number, boolean, JSON, or flow/global context. |
payloadType | string | - | date | The type of payload: date, str, num, bool, json, flow, global. |
topic | string | - | - | The msg.topic value to set on the outgoing message. |
intervalType | string | - | seconds | Unit for repeat interval: seconds, minutes, hours, days, or months. |
intervalValue | number | - | - | Numeric value for the repeat interval. |
repeat | boolean | - | false | Enable automatic repeated injection at the configured interval. |
toggle | boolean | - | false | Toggle mode: alternates payload.value between true and false on each interval tick. Perfect for blinking LEDs. |
crontab | string | - | - | Cron expression for scheduled injection (e.g., "0 * * * *" for every hour). |
once | boolean | - | false | Whether to inject once when the flow is deployed. |
onceDelay | number | - | 0.1 | Delay in seconds before the first injection after deploy. |
Outputs
The inject node has a single output that sends a message with the configured payload:
Output Message Format
{`{
"payload": ,
"topic": "",
"_msgid": ""
}`}
When the payload type is set to timestamp, the payload will be the current time in
milliseconds since January 1, 1970 (Unix epoch).
Toggle Mode
When toggle is enabled, the inject node automatically alternates payload.value
between true and false on each interval tick. This eliminates the need
for a Function node when you just need to blink an LED or toggle a relay.
Toggle Mode Output
{ "value": true } { "value": false } { "value": true } Any extra payload fields you configure are preserved alongside the toggling value.
Examples
Basic Timestamp Injection
This simple flow injects a timestamp and displays it in the debug panel. Click the inject button to trigger the flow.
Timestamp to Debug
Injects the current timestamp and displays it in the debug panel.
View Flow JSON
[
{
"id": "inject1",
"type": "inject",
"name": "Timestamp",
"payload": "",
"payloadType": "date",
"repeat": "",
"wires": [["debug1"]]
},
{
"id": "debug1",
"type": "debug",
"name": "Output",
"active": true
}
] JSON Payload
Inject a JSON object containing sensor configuration data.
JSON Configuration
Injects a JSON object with sensor settings.
View Flow JSON
[
{
"id": "inject2",
"type": "inject",
"name": "Sensor Config",
"payload": "{\"sensor\":\"dht22\",\"pin\":4,\"interval\":5000}",
"payloadType": "json",
"topic": "config",
"wires": [["debug2"]]
},
{
"id": "debug2",
"type": "debug",
"name": "Output"
}
] Blink LED (Toggle Mode)
Use toggle mode to blink an LED every second — no Function node needed. The inject node alternates between true and false automatically.
Blink LED Every 1s
Inject with toggle mode drives gpio-out to blink an LED on pin 17.
View Flow JSON
[
{
"id": "toggle1",
"type": "inject",
"name": "Toggle 1s",
"intervalType": "seconds",
"intervalValue": 1,
"repeat": true,
"toggle": true,
"payload": { "value": true },
"wires": [["led1"]]
},
{
"id": "led1",
"type": "gpio-out",
"name": "LED Pin 17",
"pin": 17
}
] Scheduled Injection
Automatically inject every 30 seconds to poll a sensor or check a status.
30-Second Timer
Injects automatically every 30 seconds.
View Flow JSON
[
{
"id": "inject3",
"type": "inject",
"name": "Every 30s",
"payload": "poll",
"payloadType": "str",
"repeat": "30",
"wires": [["function1"]]
},
{
"id": "function1",
"type": "function",
"name": "Process",
"func": "msg.timestamp = Date.now();\nreturn msg;"
}
] Troubleshooting
Inject button doesn't work
Make sure the flow is deployed. Changes to nodes are not active until you click the Deploy button.
Cron expression not triggering
Verify your cron expression is valid. EdgeFlow uses standard 5-field cron format:
minute hour day-of-month month day-of-week Example: */5 * * * * triggers every 5 minutes.
JSON payload shows as string
Make sure you've set the payload type to JSON (not string). The dropdown next to the payload field lets you select the type.