ESP32 OTA and battery reporting

Keep ESP32 probe firmware current with LAN OTA while push ingest posts battery and RSSI fields to the ProbeHarbor HTTP API.

Top view of a blue Arduino Uno microcontroller board on a white background
Arduino-compatible boards run the sketch that polls probes and publishes JSON. Photo: Wikimedia Commons contributor. CC0

ProbeHarbor cares about readings over HTTPS, not how you update the MCU. Keep OTA on your LAN; keep ingest pointed at /api/ingest/<key>. Download a pre-filled sketch from Devices after you create a push device.

First flash vs OTA

  • USB first flash, use the Devices callout checklist (ESP32 board package, libraries, Serial 115200). See flashing options for Arduino IDE, PlatformIO, MicroPython, and Espressif’s web esptool.
  • LAN OTA later: once Wi‑Fi works, ArduinoOTA (or ESP-IDF HTTPS OTA) lets you push new firmware without climbing back to the probe with a cable.

ArduinoOTA (LAN)

After WiFi.begin succeeds, start OTA and call handle() in loop. Use a password in production shops. PlatformIO / Arduino IDE “network port” then shows the board.

#include <ArduinoOTA.h>

void setup() {
  // … WiFi connected …
  ArduinoOTA.setHostname("garage-probe");
  ArduinoOTA.setPassword("change-me");
  ArduinoOTA.begin();
}

void loop() {
  ArduinoOTA.handle();
  // … your ingest POST on an interval …
}

OTA and ingest are independent: a failed cloud POST does not block OTA, and an OTA update does not change your ProbeHarbor device key.

Ingest payload with battery and RSSI

Optional top-level fields keep Devices health and low-battery / weak-signal alerts accurate:

{
  "temp1": 42.5,
  "door1": false,
  "battery": 87,
  "rssi": -62
}

The DS18B20 samples already send rssi. Add battery or battery_pct when you have a voltage divider or fuel gauge. Enable health alerts under Dashboard → Alerts.

Wi‑Fi without recompiling

Hardcoded WIFI_SSID / WIFI_PASS is fine for a fixed garage AP. If the network changes often, use the WiFiManager sketch captive portal on first boot; ingest URL still comes from the Devices download or a #define.

Related

FAQ

Can ESP32 devices update firmware while posting to ProbeHarbor?
Yes: run OTA on your LAN for firmware, and keep push ingest posting readings to the cloud API. Battery and RSSI fields are optional in the payload. Download a pre-filled sketch from Dashboard → Devices for the first USB flash.

Do I need to recompile when my Wi‑Fi password changes?
Not if you use the WiFiManager sample (captive portal). Otherwise edit WIFI_SSID / WIFI_PASS and flash again. Ingest URL still comes from Devices.