From 65babb5faa19ecf68347020393530e588323e1af Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Mon, 29 Jun 2026 01:14:32 +0200 Subject: [PATCH] Update README: uploadfs, factory reset table, HTTP API, logo, reset button --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6307f1e..27c11e0 100644 --- a/README.md +++ b/README.md @@ -26,33 +26,67 @@ If your dial's contact is normally closed instead, change the interrupt trigger ## Building and flashing ```bash -# Build (S3 DevKit) -pio run -e esp32-s3-devkitc-1 +# Build +pio run -e esp32dev -# Flash -pio run -e esp32-s3-devkitc-1 --target upload +# Flash firmware +pio run -e esp32dev --target upload -# Serial monitor (115200 baud) +# Upload filesystem image (logo, etc.) — only needed when data/ changes +pio run -e esp32dev --target uploadfs + +# Serial monitor (115 200 baud) pio device monitor ``` +> **Note:** close the serial monitor before uploading — it holds the serial port exclusively. + +Board targets: `esp32dev`, `esp32-s3-devkitc-1` + ## First-time Wi-Fi setup On first boot the device opens an access point named **Rotary-Dial**. Connect with any phone or laptop; a captive portal will appear. 1. Enter your Wi-Fi credentials. -2. Optionally set the **Device hostname** (default: `rotary-dial`). +2. Optionally set the **Device hostname** (default: `rotary-dial`, max 63 characters). 3. Save. The device joins your network and restarts. Reachable at `http://rotary-dial.local` or the IP shown in the serial monitor. ### Factory reset -Power-cycle or press EN **5 times in quick succession** (before boot completes). All settings are cleared and the device restarts into the Wi-Fi portal. +Power-cycle (or press EN) rapidly before the 3-second boot window expires. The reset counter accumulates across rapid reboots: + +| Cycles | Effect | +|--------|--------| +| 5 – 9 | Clears hostname, auth, and MQTT config; restarts into normal Wi-Fi | +| 10+ | Clears all of the above **plus** stored Wi-Fi credentials; restarts into captive portal | + +Serial output shows the accumulated count: + +``` +[BOOT] reset count 3 +[BOOT] reset count 4 +... +[BOOT] reset count 5, triggering factory reset +[BOOT] factory reset triggered (clearWifi=0)! +[BOOT] factory reset complete, restarting... +``` ## Web UI -Browse to the device address to configure hostname, authentication, and MQTT. +Browse to the device address to configure hostname, authentication, and MQTT. The logo in the header is served from `data/logo.png` in the filesystem image. + +Click **Save** to persist settings. Changing the hostname automatically restarts the device. Click **Reset Device** to restart immediately. + +## HTTP API + +| Method | Path | Description | +|--------|------|-------------| +| `GET` | `/` | HTML configuration page | +| `GET` | `/logo.png` | Logo image served from LittleFS | +| `POST` | `/config` | Save configuration; redirects to `/`. Restarts if hostname changed | +| `POST` | `/reset` | Restart the device immediately | ## MQTT @@ -67,7 +101,7 @@ Default prefix: `dial` ### Home Assistant -On MQTT connect the device publishes a discovery payload so HA automatically creates a **sensor** entity (`sensor._dialed_number`) that shows the last dialled number. +On MQTT connect the device publishes a discovery payload so HA automatically creates a **sensor** entity that shows the last dialled number. Example automation: