Alerts & API
Real-time updates, everywhere you are
PlantHub uses Server-Sent Events to stream dashboard updates in real time and AWS SNS to deliver push notifications to Android, iOS, and web browsers — with full control over severity, quiet hours, and which events trigger pings.
Alert types
DEVICE_OFFLINE/DEVICE_ONLINE— fires when MQTT LWT or the 60-second health check detects a state change.RULE_TRIGGERED— a threshold rule fired (and either acted or was suppressed).SENSOR_ERROR— sensor reported impossible values or stopped reporting.AI_DECISION— the AI took an action; the full reasoning is attached.SYSTEM— backend-side issues (rare; e.g. weather provider rate-limited).
Severity tiers
- CRITICAL — devices offline, sensor errors during dry conditions, frost imminent. Push notifications fire regardless of quiet hours.
- WARNING — thresholds breached, high temp warnings, low battery. Push notifications respect quiet hours.
- INFO — routine actions, status changes. Shown in the dashboard; push only if opted in.
Server-Sent Events (live dashboard)
Real-time dashboard updates flow over SSE on tenant-scoped channels:/alerts/{tenantId}, /devices/{tenantId},/sensors/{tenantId}/{nodeId}, and /stats. EventSource can't set Authorization headers, so the backend issues short-lived (30-second) single-use tickets that the client appends to the SSE URL. Connections include a 30-second heartbeat and a 15-minute idle timeout, with a cap of 10 concurrent connections per key.
Push notifications via AWS SNS
PlantHub uses Amazon SNS to fan out push messages across providers:
- FCM — Android devices (PWA or native wrapper).
- APNs — iOS devices.
- Web Push — desktop and mobile browsers that support the Push API.
Register a device with POST /api/v1/notifications/devices, then configure preferences (which alert types you want, quiet hours, and severity floor) at PATCH /api/v1/notifications/preferences. A test endpoint exists at POST /api/v1/notifications/test.
Dedup & storm protection
Repeated alerts of the same type for the same device within a short window are coalesced via a composite database index, so a flaky moisture sensor won't fire 50 pushes in a minute. The dashboard surfaces unacknowledged alerts only once; bulk-acknowledge is available with a single API call.