Skip to main content

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 V1 goes above 80 β†’ 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 D0 to 1

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​

FieldDescription
NameA short, descriptive label shown on the card. Required.
DescriptionOptional longer description for your own reference.
ProjectAssociate 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.

FieldDescription
DeviceWhich device to watch
PinWhich 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.

Full documentation

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.

FieldDescription
DeviceWhich device to watch
When device goesOnline, Offline, or Any change

This fires on transitions β€” it will not fire repeatedly just because the device stays offline.

Full documentation

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.

FieldDescription
DeviceThe device whose location pin to watch
Location PinThe pin receiving GPS data in lat,lng CSV format
Fire whenEnters the zone, Exits the zone, or Either
Zone centreClick anywhere on the map to place the centre point
Radius50 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.

Full documentation

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.

FieldDescription
Interval (minutes)Run every N minutes (e.g. 5, 60, 1440)
Cron expressionOptional. Overrides the interval when provided. Standard 5-field cron β€” e.g. 0 7 * * 1-5 for 07:00 Mon–Fri
Cron format

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.

Full documentation

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:

FieldOptions
DeviceAny device you own
PinAny pin on that device
Operator>, β‰₯, <, ≀, =, β‰ , between, Ξ” β‰₯
ValueThe comparison value (string or number)
Max valueOnly 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:

SymbolMeaning
>Greater than
β‰₯Greater than or equal
<Less than
≀Less than or equal
=Exactly equal
β‰ Not equal
betweenValue 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.

FieldDescription
DeviceTarget device
PinTarget pin
ValueThe 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.

FieldDescription
DeviceTarget device
PinTarget pin
note

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.

FieldDescription
MessageThe 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.

FieldOptions
MessageAlarm body text. Supports template variables. Max 500 characters.
Alarm SoundDefault Alarm, Urgent Alarm, Critical Alarm
Priority1 β€” Low / Info, 2 β€” Medium / Warning, 3 β€” Critical (overrides Do Not Disturb)
Volume0–100% device volume when the alarm fires
Alarm delivery

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.

Free plan

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.

FieldOptions
MethodPOST, GET, PUT, PATCH
URLThe full HTTPS endpoint URL

The default POST body is a JSON object:

{
"ruleId": "...",
"ruleName": "My Rule",
"triggerData": { "deviceId:pin": "value", ... }
}
caution

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.

FieldDescription
Recipient emailAny valid email address
Message / bodyThe email body text. Supports template variables.
Free plan

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.

FieldRange
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:00 to 22:00 means 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:

KeyValue
{{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.
note

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 ERROR status (fix the underlying issue first)

Execution Logs​

Click Logs on any rule card to expand the last 10 executions. Each log entry shows:

ColumnDescription
TimeWhen the execution ran
ResultOK (success) or Failed
DurationHow long all actions took to complete
DetailsError message if the execution failed

Status Indicators​

IconStatusMeaning
βœ… Green checkmarkACTIVERule is enabled and healthy
πŸ• Amber clockPAUSEDRule has been manually disabled
❌ Red XERRORThe last execution failed. After 5 consecutive errors the rule is automatically paused. Fix the error and re-enable it.

Plan Limits​

PlanMax RulesWebhooksEmail ActionsAlarm Push
Free3βœ…βœ…βœ…
Pro25βœ…βœ…βœ…
Pro Plus100βœ…βœ…βœ…
EnterpriseUnlimitedβœ…βœ…βœ…

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.

Upgrading

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"