Skip to main content

Device Pin Data Change Trigger

The Device Pin Data Change trigger fires an automation rule every time a specific pin on a specific device receives a new value. It is the most common trigger type — ideal for threshold alerts, data-driven relay control, and any reaction to real-time sensor readings.


How It Works

Every time a data point arrives for the chosen device + pin combination — whether from the device's firmware over MQTT, from the dashboard UI, or from the REST/external API — the trigger fires and the rule is evaluated.

Device publishes V1 = 87.4


Trigger fires


Conditions checked (e.g. V1 > 80?)

├─ PASS → Actions run (notification, pin set, webhook…)
└─ FAIL → Rule exits silently
Every Data Point

The trigger fires on every incoming data point, even if the value has not changed. If your device sends 10 identical readings per second, the trigger fires 10 times per second.

Use a Cooldown (Step 5) to prevent action spam, and use Conditions (Step 3) to filter by value range rather than relying on the trigger to filter itself.


When to Use This Trigger

Use CaseExample
Threshold alertTemperature pin V1 > 80 → send push notification
Relay controlSoil moisture A0 < 30 → turn on irrigation (D1 = 1)
Data-driven webhookVibration pin V3 changes → POST to external system
State trackingMotion sensor D0 receives 1 → log and notify
Multi-pin correlationPressure V2 spikes AND temperature V1 > threshold (via Conditions)

Step-by-Step Setup

Step 1 — Basics

Give the rule a clear name (e.g. "High Temp Alert") and optionally a description. Select the Project that owns the device.


Step 2 — Trigger

Select Device Pin Data Change from the trigger type list.

FieldDescription
DeviceThe device to watch. Only devices in the selected project are shown.
PinWhich pin to monitor. Any virtual (V0V255), digital (D0D15), or analog (A0A7) pin.

Once both are selected the trigger is configured. The rule will fire on the next data point for that device + pin.


Without conditions, the rule fires on every single data point. Add a condition to filter:

Example: only fire when V1 exceeds 80

FieldValue
Device(same sensor device)
PinV1
Operator>
Value80

Available operators:

OperatorMeaning
>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 ≥ threshold

The Δ ≥ (delta) operator is especially useful here — fire only when the reading jumps by at least N rather than crossing a static threshold. Useful for vibration, pressure spikes, and rate-of-change alerts.


Step 4 — Actions

ActionExample use
Send NotificationPush alert to mobile app with current reading
Send AlarmLooping alarm sound until dismissed
Set Pin ValueTurn relay on (D0 = 1) when threshold exceeded
Toggle PinFlip relay state
DelayWait N seconds between actions
Call WebhookPOST data to an external system
Send EmailEmail alert (Pro+)

Use Template Variables in message bodies to embed the live pin value:

Temperature alert! Sensor reading: {{VW-KNZWRK:V1}}°C

Step 5 — Options

OptionRecommendation
CooldownSet to at least your device's publish interval to avoid repeated alerts on every reading
Active Time WindowOptional — restrict alerts to business hours (e.g. 08:0022:00)
Active DaysOptional — uncheck weekends to skip off-days
TimezoneSet to your local timezone when using time window or active days

Template Variables

In notification, alarm, and email message bodies you can reference pin values using:

{{<Device ID>:<pin>}}

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

Examples:

PlaceholderRenders as
{{VW-KNZWRK:V1}}Current value of V1 (the trigger pin)
{{VW-KNZWRK:V2}}Value of V2 (if used in a condition)
{{VW-KNZWRK:D0}}Value of D0
Geofence variables

If you are using the GPS Geofence trigger, two additional variables are available: {{geofence_event}} and {{distance_m}}. See the GPS Geofence Trigger guide.


Firmware Examples

#include <VwireIOT.h>

VwireIOT vwire;

void setup() {
vwire.begin("VW-KNZWRK", "your-auth-token");
}

void loop() {
// Read a temperature sensor (DS18B20, DHT22, etc.)
float temp = readTemperature(); // your sensor read function

// Push to virtual pin V1 — triggers any rule watching this pin
vwire.virtualWrite(1, temp);

delay(5000); // publish every 5 s
}

Worked Example — High Temperature Alert with Relay Cutoff

Scenario: A server room temperature sensor publishes to V1 every 30 seconds. When it exceeds 30 °C, send an alarm push and cut power to non-essential loads by setting relay D0 to 0.

FieldValue
NameServer Room High Temp
ProjectServer Room
Trigger typeDevice Pin Data Change
DeviceRoomSensor01
PinV1
ConditionV1 > 30
Action 1Send Alarm — "Server room at {{VW-KNZWRK:V1}}°C — relay disabled"
Action 2Set Pin — RoomSensor01 / D0 = 0
Cooldown300 s (5 minutes — prevent re-firing every 30s while temp stays high)
Active DaysAll days

Troubleshooting

Rule never fires

  • Confirm the device is online and actively publishing data. Check Device → Pin History to verify data is arriving.
  • Confirm the trigger's Device and Pin match exactly what the firmware is writing.
  • Check that the rule is enabled (green toggle on the rule card).
  • If using a cooldown, the rule may be suppressed. Check Logs on the rule card — a suppressed execution is not logged.

Rule fires too often

  • Add a Cooldown in Step 5 (e.g. 300 seconds for a 5-minute minimum gap).
  • Add a Condition with a threshold so the rule only runs when the value is actually interesting.

Condition never passes even though value seems correct

  • Conditions compare values as numbers when both sides parse as numbers. If your device sends a string like "ON" instead of 1, use = with ON.
  • The condition reads the current cached pin value from Redis, not the historical average. A rapid spike that comes and goes in < 1 second may be missed.

Template variable shows raw {{...}}

  • Double-check the Device ID (VW-XXXXXX) against the Device Credentials section on the device detail page.
  • Confirm the pin name matches exactly (V1 vs v1 — case-sensitive).
  • The variable is only substituted for devices involved in the trigger or conditions of this rule.

Summary

PropertyValue
Fires whenA new data point arrives for the selected device + pin
Fires on unchanged valuesYes — every data point, regardless of value change
Supported pin typesVirtual (V0V255), Digital (D0D15), Analog (A0A7)
Filter by valueUse Step 3 Conditions (>, <, =, between, Δ≥)
Spam preventionCooldown in Step 5 Options
Available plansFree, Pro, Pro Plus, Enterprise