Get an alert when an ESP32 goes offline
An ESP32 in the field fails quietly: the WiFi password changed, the power supply sags, a crash loop. The question is how soon you hear about it, and from whom: from a message on your phone, or from the customer.
Three ways to notice
- A heartbeat to a monitor. The device calls a URL every few minutes; a service such as a cron monitor alerts when the calls stop. Simple, but the device needs TLS for each call, a missed call is all you learn, and the reason (reset, crash, no WiFi) stays on the device.
- MQTT with a last will. The broker publishes the device's last-will message when its connection drops, and something subscribed to it sends the alert. It reacts fast, but you run the broker, the subscriber and the alerting, and a flaky WiFi connection produces a stream of offline and online messages.
- A connection that is always open. A device that keeps one connection to a server is offline the moment that connection is gone for longer than a grace period. That is how Pinscope does it, and the same connection carries the reason when the device comes back: the reset reason and, after a crash, the decoded backtrace.
The grace period matters more than the method
Routers restart, phones roam, and a device that reconnects within a minute has not really been offline. Alert on every drop and the alerts get ignored within a week. Wait too long and the customer calls first. Five to fifteen minutes suits most products; a device on mobile data or a battery that sleeps may need longer.
The same goes for crashes: a device in a crash loop should alert once, not every few seconds.
With Pinscope
Each project has an Alerts tab:
- Offline: when a device has not been connected for the minutes you set (10 by default). It is said again at most once an hour for a device that keeps dropping, and "back online" when it returns.
- Crash: when a device reports a crash after it restarts, with the reason and the task; decoded to function and line when the ELF of that build is uploaded. A crash loop alerts once per ten minutes.
- Where: by email, by notification on your phone or computer, and by a webhook to your own system.
The webhook receives JSON like this:
{
"event": "offline",
"at": "2026-11-23T08:14:02.512Z",
"title": "pump-07 is offline",
"detail": "It has not been connected for 10 minutes.",
"project": { "id": 12, "name": "Irrigation" },
"device": { "id": 41, "name": "pump-07", "hardwareId": "a4cf12...", "url": "https://pump-07.pinscope.dev" }
}
From there it goes wherever you want it: Slack or Teams, a ticket, an SMS gateway.
Nothing in the firmware is needed for this beyond the Pinscope component itself: the connection it already keeps is the heartbeat. The field support checklist covers what else to have in place before the first device ships.
Try it
Three devices are free, and no card is needed. Create an account, or read the five-minute guide first.
More
- Remote access to an ESP32 without TLS: what it measured and what it costs
- Reaching an ESP32 web server from outside its network
- Updating ESP32 firmware over the internet, with rollback
- Guru Meditation Error: decoding the backtrace, and crashes from the field
- Remote logging: ESP_LOG without a serial cable
- Heap and stack monitoring in the field
- An ESP32 behind CGNAT, 4G or Starlink
- TLS memory usage on the ESP32, and how to reduce it
- Sharing an ESP32 sensor page with anyone, without port forwarding
- ArduinoOTA over the internet, with a rollback
- ESP32 remote access compared: port forwarding, ngrok, Cloudflare Tunnel, Tailscale
- esp_http_server slow? The 250 ms delay and the fix
- Before the first ESP32 ships: a field support checklist
- ESP32 exception decoder: a Guru Meditation backtrace to lines, in the browser