Skip to main content

Alerts & Notifications

Vwire supports two ways to send notifications:

  1. Device-initiated — your firmware calls notify(), alarm(), or email() directly from the device
  2. Rule-based — the server fires a notification when a pin value crosses a configured threshold

When a notification is sent, it is delivered through up to three channels simultaneously:

ChannelDescription
Bell notificationPersistent in-app notification. Stored and visible in the notification bell. Requires user dismissal.
App push notificationDelivered to the Vwire Android app and mobile PWA. Appears as a system notification.
EmailSent to the account's registered email address.

Notification features require a PRO plan or higher.


Device-initiated notifications

Your device can push notifications directly from firmware using three methods.

Vwire.notify(message) — Push notification

Sends a lightweight notification. Delivered as an app push notification and appears in the notification bell.

#include <Vwire.h>

void setup() {
Vwire.config(AUTH_TOKEN);
Vwire.setDeviceId(DEVICE_ID);
Vwire.begin(WIFI_SSID, WIFI_PASSWORD);
}

void loop() {
Vwire.run();

float temp = readTemperature();
Vwire.virtualSend(V0, temp);

if (temp > 85.0) {
Vwire.notify("⚠️ Temperature exceeded 85°C!");
}
}

Vwire.alarm(message) — Persistent alarm

Delivers a persistent alarm that requires explicit acknowledgment in the app. Plays an alert sound and vibrates the device. Use for critical conditions that need immediate attention.

// Simple alarm
Vwire.alarm("🚨 CRITICAL: Water leak detected!");

// Alarm with custom sound
Vwire.alarm("🚨 CRITICAL: Water leak detected!", "alarm");

// Alarm with custom sound and priority (1–3, 3 = highest)
Vwire.alarm("🚨 CRITICAL: Water leak detected!", "alarm", 3);

Vwire.email(subject, body) — Email notification

Sends an email to the account's registered address. Use for reports, logs, or situations where in-app delivery alone is not enough.

Vwire.email(
"Daily Status Report",
"All sensors are nominal. Temperature: 23°C. Humidity: 55%."
);

Python equivalent

# Push notification
device.notify("⚠️ Temperature exceeded 85°C!")

# Persistent alarm
device.alarm("🚨 Critical: Pressure sensor failure!")

# Email
device.email(
subject="Daily Report",
body="All systems nominal at 09:00 AM."
)

Throttling

To prevent notification spam, Vwire applies automatic throttling:

RuleBehaviour
Boot quiet windowNo notifications for 3 s after a device connects
Hard capMax 60 notifications per device per minute

Build your own cooldown logic in firmware to avoid hitting the cap:

unsigned long lastNotify = 0;
const unsigned long NOTIFY_INTERVAL = 60000; // 1 minute

void loop() {
Vwire.run();

float temp = readTemperature();
if (temp > 85.0 && millis() - lastNotify > NOTIFY_INTERVAL) {
lastNotify = millis();
Vwire.notify("High temperature: " + String(temp) + "°C");
}
}

Rule-based notifications (dashboard)

In addition to device-initiated notifications, you can configure server-side rules that fire automatically when a condition is met — no firmware changes required.

Create a rule

  1. Go to Project → Notifications → + Add Rule
  2. Configure:
    • Trigger: Choose device + pin, condition, and threshold
    • Channels: Select bell / push / email
    • Message: Optionally customize the text (use {value} as a placeholder)
  3. Click Save

Trigger types

TriggerConditionExample
Pin value>, <, >=, <=, ==, !=Temperature > 85 °C
Device statusGoes online / goes offlineDevice went offline
No dataNo update for N minutesNo reading for 30 min

Example rule

Device:    Greenhouse Sensor
Pin: V0 (temperature)
Condition: greater than
Threshold: 85
Message: "⚠️ Greenhouse temperature is {value} °C"
Channels: Bell + Push + Email

Notification history

All delivered notifications are stored and visible in the dashboard. View under Project → Notifications → History or via the API:

GET /api/v1/notifications?deviceId={id}&limit=50
Authorization: Bearer <token>

List notifications

GET /api/v1/notifications
Authorization: Bearer <token>

Query parameters:

ParamDescription
deviceIdFilter by device
typethreshold | device_status | no_data
unreadtrue → only unread
limitMax results (default: 20)

Mark as read

PATCH /api/v1/notifications/{notificationId}/read

Mark all as read:

PATCH /api/v1/notifications/read-all