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
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 Case | Example |
|---|---|
| Threshold alert | Temperature pin V1 > 80 → send push notification |
| Relay control | Soil moisture A0 < 30 → turn on irrigation (D1 = 1) |
| Data-driven webhook | Vibration pin V3 changes → POST to external system |
| State tracking | Motion sensor D0 receives 1 → log and notify |
| Multi-pin correlation | Pressure 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.
| Field | Description |
|---|---|
| Device | The device to watch. Only devices in the selected project are shown. |
| Pin | Which pin to monitor. Any virtual (V0–V255), digital (D0–D15), or analog (A0–A7) pin. |
Once both are selected the trigger is configured. The rule will fire on the next data point for that device + pin.
Step 3 — Conditions (recommended for threshold rules)
Without conditions, the rule fires on every single data point. Add a condition to filter:
Example: only fire when V1 exceeds 80
| Field | Value |
|---|---|
| Device | (same sensor device) |
| Pin | V1 |
| Operator | > |
| Value | 80 |
Available operators:
| Operator | 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 ≥ 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
| Action | Example use |
|---|---|
| Send Notification | Push alert to mobile app with current reading |
| Send Alarm | Looping alarm sound until dismissed |
| Set Pin Value | Turn relay on (D0 = 1) when threshold exceeded |
| Toggle Pin | Flip relay state |
| Delay | Wait N seconds between actions |
| Call Webhook | POST data to an external system |
| Send Email | Email 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
| Option | Recommendation |
|---|---|
| Cooldown | Set to at least your device's publish interval to avoid repeated alerts on every reading |
| Active Time Window | Optional — restrict alerts to business hours (e.g. 08:00–22:00) |
| Active Days | Optional — uncheck weekends to skip off-days |
| Timezone | Set 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:
| Placeholder | Renders 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 |
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
- Arduino / ESP8266 / ESP32
- Python / Raspberry Pi
- REST API
#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
}
import vwire
import time
client = vwire.Client("VW-KNZWRK", "your-auth-token")
while True:
temp = read_temperature() # your sensor read function
client.virtual_write(1, temp) # triggers any rule watching V1
time.sleep(5)
# PUT a value to V1 — triggers any rule watching this pin
curl -X PUT https://api.vwire.io/api/v1/devices/VW-KNZWRK/pins/V1 \
-H "Authorization: Bearer your-auth-token" \
-H "Content-Type: application/json" \
-d '{"value": "87.4"}'
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.
| Field | Value |
|---|---|
| Name | Server Room High Temp |
| Project | Server Room |
| Trigger type | Device Pin Data Change |
| Device | RoomSensor01 |
| Pin | V1 |
| Condition | V1 > 30 |
| Action 1 | Send Alarm — "Server room at {{VW-KNZWRK:V1}}°C — relay disabled" |
| Action 2 | Set Pin — RoomSensor01 / D0 = 0 |
| Cooldown | 300 s (5 minutes — prevent re-firing every 30s while temp stays high) |
| Active Days | All 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.
300seconds 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 of1, use=withON. - 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 (
V1vsv1— case-sensitive). - The variable is only substituted for devices involved in the trigger or conditions of this rule.
Summary
| Property | Value |
|---|---|
| Fires when | A new data point arrives for the selected device + pin |
| Fires on unchanged values | Yes — every data point, regardless of value change |
| Supported pin types | Virtual (V0–V255), Digital (D0–D15), Analog (A0–A7) |
| Filter by value | Use Step 3 Conditions (>, <, =, between, Δ≥) |
| Spam prevention | Cooldown in Step 5 Options |
| Available plans | Free, Pro, Pro Plus, Enterprise |