Automation Rules
Automation rules let you define what should happen automatically when something changes in your IoT system β without writing any server-side code.
A rule follows the structure:
WHEN [trigger]
IF [conditions] β optional
THEN [actions]
For example:
- When the temperature sensor on
V1goes above80β Then send a push notification - When a device goes offline β Then call a webhook
- When it's 07:00 every weekday β Then set a relay on
D0to1
Navigating to Automationsβ
In the dashboard, click Automations (β‘) in the left sidebar. The page shows all your rules with their current status, last triggered time, and a summary of the WHEN/IF/THEN logic. Click New Rule to open the five-step wizard.
The Five-Step Wizardβ
Step 1 β Basicsβ
| Field | Description |
|---|---|
| Name | A short, descriptive label shown on the card. Required. |
| Description | Optional longer description for your own reference. |
| Project | Associate the rule with a project. Required. The rule only fires from events within that project's devices. |
Step 2 β Triggerβ
The trigger defines what event causes the rule to be evaluated. Choose one:
Device Pin Data Changeβ
Fires every time a specific pin on a specific device receives a new value β whether the value comes from the device firmware, the dashboard, or the API.
| Field | Description |
|---|---|
| Device | Which device to watch |
| Pin | Which pin (e.g. V1, D0, A2) |
The trigger fires on every data point, even if the value hasn't changed. Use conditions (Step 3) to filter by value range if you only want to fire when a threshold is crossed.
See the Device Pin Data Change Trigger guide for step-by-step setup, threshold operators, firmware code samples, and troubleshooting.
Device Status Changeβ
Fires when a device transitions between online and offline.
| Field | Description |
|---|---|
| Device | Which device to watch |
| When device goes | Online, Offline, or Any change |
This fires on transitions β it will not fire repeatedly just because the device stays offline.
See the Device Status Change Trigger guide for step-by-step setup, the {{status}} template variable, worked examples, and troubleshooting.
GPS Geofenceβ
Fires when a tracked device crosses a circular geographic boundary β either entering or exiting a zone you define on a map. Works with the mobile app, hardware GPS devices, and any device that publishes a lat,lng location string to a pin.
| Field | Description |
|---|---|
| Device | The device whose location pin to watch |
| Location Pin | The pin receiving GPS data in lat,lng CSV format |
| Fire when | Enters the zone, Exits the zone, or Either |
| Zone centre | Click anywhere on the map to place the centre point |
| Radius | 50 m β 50 km (slider or manual input) |
The rule only fires on boundary transitions β not on every location update. If a device is already inside the zone and sends 100 GPS pings while staying inside, the rule fires zero additional times.
See the GPS Geofence Trigger guide for step-by-step setup, hardware GPS code samples, template variables ({{geofence_event}}, {{distance_m}}), Map Widget overlay details, and troubleshooting.
Scheduleβ
Fires on a repeating time pattern, independent of any device data.
| Field | Description |
|---|---|
| Interval (minutes) | Run every N minutes (e.g. 5, 60, 1440) |
| Cron expression | Optional. Overrides the interval when provided. Standard 5-field cron β e.g. 0 7 * * 1-5 for 07:00 MonβFri |
VWire uses the standard 5-field cron format: minute hour day month weekday.
Example: */30 * * * * = every 30 minutes, 0 8 * * * = every day at 08:00.
Leave the cron field empty to use the minutes interval instead.
See the Schedule Trigger guide for cron expression examples, timezone setup, worked irrigation and webhook examples, and troubleshooting.
Step 3 β Conditions (optional)β
Conditions let you filter when the trigger actually fires. Without conditions, every trigger event causes the rule to run.
You can add multiple conditions. If you have more than one, choose the logic:
- AND β all conditions must be true at the same time
- OR β any single condition being true is enough
Each condition checks:
| Field | Options |
|---|---|
| Device | Any device you own |
| Pin | Any pin on that device |
| Operator | >, β₯, <, β€, =, β , between, Ξ β₯ |
| Value | The comparison value (string or number) |
| Max value | Only for between β the upper bound |
When a rule evaluates conditions, it reads the current cached pin value from Redis (the most recent value received). The value is always compared as a number if both sides parse as numbers.
Operator reference:
| Symbol | Meaning |
|---|---|
> | Greater than |
β₯ | Greater than or equal |
< | Less than |
β€ | Less than or equal |
= | Exactly equal |
β | Not equal |
between | Value is between min and max (inclusive) |
Ξ β₯ | Absolute change from previous value is at least this amount |
Step 4 β Actionsβ
Actions define what happens when the trigger fires (and all conditions pass). You can have multiple actions β they execute in order, top to bottom. Use a Delay action to pause between them.
Set Pin Valueβ
Writes a specific value to a pin on any device. The value is published via MQTT so the physical device receives it immediately.
| Field | Description |
|---|---|
| Device | Target device |
| Pin | Target pin |
| Value | The string value to write (e.g. 1, 0, 25.5) |
Toggle Pinβ
Reads the current value of a pin and flips it: if it was 1 it becomes 0, and vice versa.
| Field | Description |
|---|---|
| Device | Target device |
| Pin | Target pin |
Set Pin and Toggle Pin are blocked if the target pin is locked by a Keypad widget β the action will be skipped (not fail).
Send Notificationβ
Creates an in-app notification in the bell menu and sends a push notification to any registered mobile app sessions.
| Field | Description |
|---|---|
| Message | The notification body. Supports template variables (see Template Variables). Max 500 characters. |
Send Alarmβ
Sends a persistent, high-priority push notification to the mobile app. The alarm keeps ringing with looping sound and vibration until the user taps STOP or SNOOZE 5M. Also creates an in-app notification record.
| Field | Options |
|---|---|
| Message | Alarm body text. Supports template variables. Max 500 characters. |
| Alarm Sound | Default Alarm, Urgent Alarm, Critical Alarm |
| Priority | 1 β Low / Info, 2 β Medium / Warning, 3 β Critical (overrides Do Not Disturb) |
| Volume | 0β100% device volume when the alarm fires |
Alarms require the VWire mobile app to be installed and notification permissions granted. Push delivery is handled via FCM and is best-effort β network conditions, app kill states, and OS battery optimisation may affect delivery. The in-app notification is always recorded regardless.
On the Free plan, the persistent FCM alarm push (looping sound, dismissible screen) is not delivered. The in-app notification record is still created. Upgrade to Pro or above to receive full alarm push delivery.
Call Webhookβ
Makes an outbound HTTP request to any URL when the rule fires.
| Field | Options |
|---|---|
| Method | POST, GET, PUT, PATCH |
| URL | The full HTTPS endpoint URL |
The default POST body is a JSON object:
{
"ruleId": "...",
"ruleName": "My Rule",
"triggerData": { "deviceId:pin": "value", ... }
}
Webhook calls are made from the VWire server. The target URL must be publicly reachable. Timeouts or network errors will cause the rule execution to be marked as failed and increment the error counter.
Send Emailβ
Sends an email to a specified address when the rule fires.
| Field | Description |
|---|---|
| Recipient email | Any valid email address |
| Message / body | The email body text. Supports template variables. |
The Send Email action requires a Pro plan or above. On the Free plan, this action is silently skipped β no email is sent and no error is raised. Upgrade to Pro or above to enable email delivery from automation rules.
Delayβ
Pauses execution for a number of seconds before proceeding to the next action. Useful for sequencing β for example, set a relay to 1, wait 5 seconds, then set it back to 0.
| Field | Range |
|---|---|
| Wait (seconds) | 1 β 300 |
Step 5 β Optionsβ
Fine-tune when and how often the rule can fire.
Cooldownβ
The minimum number of seconds that must pass between two consecutive executions of this rule. Prevents the rule from firing repeatedly on rapid data changes.
0= no cooldown (fires every time the trigger + conditions pass)- Recommended: set to at least the expected data interval of your sensor
Timezoneβ
The timezone used for interpreting the active time window below. Defaults to UTC. Use a standard IANA timezone name (e.g. Europe/London, America/New_York, Asia/Karachi).
Active Time Windowβ
Restrict the rule to only fire between two clock times. Both fields use 24-hour format (HH:MM).
- Leave both empty to allow firing at any time of day
- Example:
08:00to22:00means the rule can only fire in the morning through evening
Active Daysβ
Checkboxes for each day of the week. Uncheck a day to prevent the rule from firing on that day.
- Leave all checked (default) to allow firing any day
Template Variablesβ
In notification messages, alarm messages, and email bodies, you can embed the live value of any pin using the {{VW-XXXXX:pin}} syntax.
Syntaxβ
{{<Device ID>:<pin>}}
What is the Device ID?β
The Device ID is the user-facing identifier shown on the device detail page in the dashboard β the same ID printed on your device packaging in VW-XXXXXX format.
How to find it: Open the device's detail page in the dashboard. The Device ID is shown in the Device Credentials section, with a copy button next to it.
Device Credentials
ββββββββββββββββββββββββββββββ
Device ID VW-KNZWRK [Copy]
Auth Token β’β’β’β’β’β’β’β’ [Copy]
Available variablesβ
When a rule fires, the following are available for substitution:
| Key | Value |
|---|---|
{{VW-XXXXX:V1}} | Current value of virtual pin V1 on that device |
{{VW-XXXXX:D0}} | Current value of digital pin D0 |
{{VW-XXXXX:A2}} | Current value of analog pin A2 |
{{VW-XXXXX:status}} | online or offline (device status rules only) |
The snapshot includes the trigger pin value and the value of every condition pin evaluated during that execution. Pins from other devices not involved in the trigger/conditions are not available.
Exampleβ
Temperature alert! Sensor is reading {{VW-KNZWRK:V1}}Β°C β check your system.
Rendered when the rule fires with V1 = 87.4:
Temperature alert! Sensor is reading 87.4Β°C β check your system.
If you use a {{VW-XXXXX:pin}} variable and the Device ID or pin doesn't match anything in the snapshot, the placeholder is left as-is in the message β you'll see the raw {{...}} text, which tells you the variable is wrong.
Managing Rulesβ
Enable / Disableβ
Each rule card has a toggle switch. A disabled rule is never evaluated, even when its trigger fires. The rule remains saved and can be re-enabled at any time.
Manual Runβ
Click the Run button on a rule card to execute the rule's actions immediately β without evaluating the trigger or conditions. The rule runs using an empty trigger snapshot (no pin values substituted in messages unless you're using static text).
The Run button is disabled when:
- The rule is disabled
- The rule is in
ERRORstatus (fix the underlying issue first)
Execution Logsβ
Click Logs on any rule card to expand the last 10 executions. Each log entry shows:
| Column | Description |
|---|---|
| Time | When the execution ran |
| Result | OK (success) or Failed |
| Duration | How long all actions took to complete |
| Details | Error message if the execution failed |
Status Indicatorsβ
| Icon | Status | Meaning |
|---|---|---|
| β Green checkmark | ACTIVE | Rule is enabled and healthy |
| π Amber clock | PAUSED | Rule has been manually disabled |
| β Red X | ERROR | The last execution failed. After 5 consecutive errors the rule is automatically paused. Fix the error and re-enable it. |
Plan Limitsβ
| Plan | Max Rules | Webhooks | Email Actions | Alarm Push |
|---|---|---|---|---|
| Free | 3 | β | β | β |
| Pro | 25 | β | β | β |
| Pro Plus | 100 | β | β | β |
| Enterprise | Unlimited | β | β | β |
When you reach the rule limit for your plan, the New Rule button will return an error and you must delete an existing rule or upgrade your plan before creating more.
Visit Settings β Subscription in the dashboard to view available plans and upgrade.
Execution Guarantees & Limitationsβ
- Non-blocking: Rule evaluation runs asynchronously and does not block device data ingestion or the dashboard.
- Cooldown is enforced via Redis. If the server restarts, cooldowns may be reset early.
- One execution at a time per rule: If a rule is already executing (due to a Delay action), a second simultaneous trigger is not queued β it is skipped.
- Condition values are cached: Conditions read pin values from the Redis snapshot cache, which is updated on every data point. If a device has never sent data for a pin, that condition will evaluate as
null. - Actions execute in order and stop on error: If any action throws (e.g. a webhook times out), remaining actions in the same rule execution are skipped, and the execution is marked as failed.
- Schedule rules fire via the job queue. If the server is under heavy load, a scheduled execution may fire a few seconds late but will not be skipped.
- Template variable substitution is limited to the current trigger snapshot. You cannot reference arbitrary pins from devices not involved in the current rule evaluation.
- Push notifications require an active FCM token. If the user has no registered mobile device, push delivery is silently skipped β the in-app notification is still created.
- Webhooks must be HTTPS and publicly reachable. HTTP-only or private network URLs will fail.
Common Patternsβ
Temperature threshold alertβ
WHEN device_A V1 changes
IF device_A V1 > 80
THEN Send Notification "Temp is {{device_A_id:V1}}Β°C β above threshold"
Cooldown: 300s
Sequence: relay on, pause, relay offβ
WHEN (schedule, every 60 min)
THEN Set Pin device_B D0 = 1
Delay 10 seconds
Set Pin device_B D0 = 0
Device offline webhook alertβ
WHEN device_C goes offline
THEN Call Webhook POST https://hooks.example.com/iot-alert
Morning routine with time windowβ
WHEN (schedule, cron: 0 7 * * 1-5) β 07:00 MonβFri
THEN Set Pin device_D V5 = "wake"
Send Notification "Good morning β routine started"