-
Notifications
You must be signed in to change notification settings - Fork 0
Web UI and API
The webui directory contains a small Preact application built with Vite. The
production build is packed into a deterministic RWFS image and linked into the
F411 application, so the UI and firmware are updated together.
After flashing, open the device's IP address. It serves /, /app.js, and
/rewair.css from internal flash. There is no separate UI flash step.
Build the production bundle directly with:
cd webui
npm ci
npm run buildThe normal scripts/build_local_bridge.zsh workflow runs this automatically.
To preview UI changes against a live device without flashing:
cd webui
npm ci
npm run devOpen the printed localhost URL with the device address in the query string:
http://localhost:5173/?device=192.168.1.242
Cross-origin development requires firmware built with REWAIR_API_CORS_DEV
enabled in wiced/apps/rewair/local_bridge/web_api.h. That define also enables
the debug SPI-flash route and should be disabled for a production build that
does not need either feature.
The same Vite bundle can be hosted on an HTTPS origin and connected through Web Bluetooth. The repository's Pages workflow publishes it at https://naorunaoru.github.io/rewair/ when configured to deploy with GitHub Actions. Bluetooth access is currently read-only pending authenticated sessions; see Bluetooth Transport.
POST endpoints accept JSON labeled as either application/json or
text/plain, allowing browser requests to remain CORS-simple.
| Route | Method | Purpose |
|---|---|---|
/api/capabilities |
GET | API version and enabled operations |
/api/status |
GET | Live score, sensors, Wi-Fi, time, and settings |
/api/scan |
GET | Start/read a nearby Wi-Fi scan |
/api/networks |
GET | List saved networks |
/api/events |
GET | Server-sent status updates |
/api/join |
POST | Save and join a Wi-Fi network |
/api/forget |
POST | Remove a saved network |
/api/priority |
POST | Reorder saved-network priority |
/api/settings |
POST | Update device name, units, timezone, or display mode |
/api/mqtt |
GET/POST | Read or update MQTT settings; passwords are never returned |
/api/time |
POST | Set wall-clock time |
/api/disp |
POST | Set the F103 display mode |
/api/update |
POST | Perform chunked F411 firmware OTA |
/api/reset |
POST | Clear saved networks/settings and reboot into setup mode |
/api/debug/sflash |
GET | Development-only raw SPI-flash readback |
The status, capabilities, scan, and network operations also use the shared API core over BLE. Detailed OTA behavior is in the Firmware Updates.