Skip to main content

Device Status Change Trigger

The Device Status Change trigger fires an automation rule when a device transitions between the online and offline states. Use it to alert on unexpected equipment outages, trigger recovery actions, or log connectivity events to an external system.


How It Works

VWire tracks each device's connectivity state in real time via the MQTT broker heartbeat and the device's last-seen timestamp. When a device connects or disconnects, the platform emits a status change event — and any rule watching that device with this trigger type is evaluated.

Device disconnects from MQTT (or heartbeat times out)


Status: online → offline (transition detected)


Rules watching this device for "Offline" or "Any change" fire


Conditions checked → Actions run
Transition-based

The trigger fires on the state change — not on the state itself. If a device stays offline for 6 hours, the trigger fires once (when it goes offline), not continuously. This prevents action spam during prolonged outages.


When to Use This Trigger

Use CaseExample
Outage alertGateway goes offline → push alarm to on-call engineer
Recovery notificationDevice comes back online → send "✅ Device restored" notification
External loggingDevice status changes → POST to incident management webhook
Watchdog relayCritical sensor goes offline → trigger a hardware reset relay
SLA trackingLog every offline event to an external system via email/webhook

Step-by-Step Setup

Step 1 — Basics

Name the rule clearly (e.g. "Gateway Offline Alert"). Select the Project the device belongs to.


Step 2 — Trigger

Select Device Status Change from the trigger type list.

FieldDescription
DeviceThe device to watch. Only devices in the selected project are shown.
When device goesOffline, Online, or Any change

Fire when options explained:

OptionFires when
OfflineDevice disconnects or heartbeat times out
OnlineDevice connects and is recognised as active
Any changeEither direction (online → offline or offline → online)

Step 3 — Conditions (optional)

Conditions for status-change rules typically check other pin values rather than the status itself, since the status is already encoded in the trigger. Examples:

  • Fire the "offline" alert only if pin V5 (a "critical system" flag) = 1
  • Skip alerts during maintenance windows by using the Active Time Window option instead

If you add no conditions, the rule fires on every matching status transition.


Step 4 — Actions

ActionTypical use for status rules
Send NotificationPush notification to mobile app (e.g. "DeviceX is offline")
Send AlarmLooping alarm push — ideal for critical infrastructure outages
Call WebhookPOST to PagerDuty, Slack, or any REST endpoint
Send EmailEmail the team (Pro+ plan required)
Set Pin ValueWrite to another device — e.g. trigger a watchdog or indicator LED

Use the {{VW-XXXXX:status}} template variable to embed the new status in a message:

Alert: {{VW-KNZWRK:status}} — check your device immediately.

Renders as:

Alert: offline — check your device immediately.

Step 5 — Options

OptionRecommendation
CooldownUsually set to 60300 s. Prevents repeated alerts if a device bounces (rapidly connecting/disconnecting).
Active Time WindowSet to business hours if you only want alerts during working hours. Off-hours outages are silently skipped but the device remains flagged offline.
Active DaysUncheck non-operational days (e.g. weekends for office equipment).
TimezoneSet to your local zone when using time windows.

Template Variables

In notification, alarm, and email message bodies:

VariableValue
{{VW-XXXXX:status}}online or offline — the new state after the transition

The Device ID is the VW-XXXXXX identifier shown on the device detail page under Device Credentials.

Example notification message:

⚠️ Device {{VW-KNZWRK:status}}: your server room gateway has lost connectivity.
Please investigate immediately.

Worked Examples

Example 1 — Industrial Gateway Offline Alarm

Scenario: A factory gateway goes offline outside business hours and an on-call alarm must be triggered.

FieldValue
NameFactory Gateway Offline
ProjectFactory Floor
Trigger typeDevice Status Change
DeviceFactoryGateway01
When device goesOffline
Action 1Send Alarm — "Factory gateway is offline — investigate immediately" / Priority: Critical
Cooldown600 s (10 min — prevents alarm spam during unstable connection)
Active Time WindowNone (alert 24/7)

Example 2 — Device Recovery Notification

Scenario: Notify the team via webhook (Slack) when any monitored device comes back online after an outage.

FieldValue
NameDevice Reconnected — Slack
ProjectProduction
Trigger typeDevice Status Change
Device(each critical device gets its own rule)
When device goesOnline
ActionCall Webhook — POST to Slack incoming webhook URL
Cooldown60 s

Webhook body (customised via the rule's webhook payload) can include the device name and new status.


Troubleshooting

Rule fires immediately with "online" on server restart

This is expected if the device reconnects after a server reboot — the reconnection is a genuine online transition. Use a Cooldown and the Active Time Window to reduce noise during maintenance windows.

Rule doesn't fire when device disconnects

  • Check the device's heartbeat / connection status on the device card. If it still shows as online, the broker may not have detected the drop yet. The heartbeat timeout defaults to ~60 seconds after the last MQTT PINGREQ.
  • Confirm the rule is enabled (green toggle) and watches the correct device.
  • Check Logs on the rule card for suppressed executions or errors.

Getting duplicate offline alerts

  • A cooldown prevents rapid re-firing. Set Cooldown (Step 5) to at least 300 seconds.
  • If the device is actively bouncing (unstable power/network), address the hardware issue — frequent disconnects will eventually exhaust the cooldown and re-fire.

Template variable {{VW-XXXXX:status}} shows raw placeholder

  • Verify the Device ID matches the Device Credentials on the device detail page.
  • Ensure you're using :status (lowercase) as the pin key — it is a reserved key for status rules only.

Summary

PropertyValue
Fires whenDevice transitions between online ↔ offline
Fires repeatedlyNo — transition-based only (one fire per direction change)
Template variable{{VW-XXXXX:status}}online or offline
Spam preventionCooldown (Step 5) + Active Time Window
Available plansFree, Pro, Pro Plus, Enterprise