diff --git a/FEATURES.md b/FEATURES.md index 18818d6..268d144 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -18,18 +18,19 @@ dedicated PLAN.md phase (or fold it into the relevant existing work) and mark it ## Summary -| ID | Status | Created | Title | Phase | -|----|--------|---------|-------|-------| -| FEAT-01 | `IDEA` | 2026-08-10 | Parallel/concurrent chunked dashcam uploads | Phase 27 | -| FEAT-02 | `IDEA` | 2026-08-10 | QR / claim-code device pairing flow | Phase 27 | -| FEAT-03 | `SHIPPED` | 2026-08-10 | Manual start odometer fallback | Phase 27 | -| FEAT-04 | `IDEA` | 2026-08-11 | Replace SIM868 2G with 4G LTE modem | Phase 27 | -| FEAT-05 | `SHIPPED` | 2026-08-11 | DTC history synced to remote server | Phase 27 | -| FEAT-06 | `SHIPPED` | 2026-08-11 | Trip ID column in history table | Phase 26 | -| FEAT-07 | `SHIPPED` | 2026-08-11 | Phone-hotspot auto-connect docs | Phase 22 | -| FEAT-08 | `SHIPPED` | 2026-08-11 | Predictable IP on phone hotspot | Phase 22 | -| FEAT-09 | `WONTFIX` | 2026-08-11 | mDNS (yaris.local) on phone hotspot | — | -| FEAT-10 | `IDEA` | 2026-08-12 | Home Assistant integration | unassigned | +| ID | Status | Title | Phase | +|----|--------|-------|-------| +| FEAT-01 | `IDEA` | Parallel/concurrent chunked dashcam uploads | Phase 27 | +| FEAT-02 | `IDEA` | QR / claim-code device pairing flow | Phase 27 | +| FEAT-03 | `SHIPPED` | Manual start odometer fallback | Phase 27 | +| FEAT-04 | `IDEA` | Replace SIM868 2G with 4G LTE modem | Phase 27 | +| FEAT-05 | `SHIPPED` | DTC history synced to remote server | Phase 27 | +| FEAT-06 | `SHIPPED` | Trip ID column in history table | Phase 26 | +| FEAT-07 | `SHIPPED` | Phone-hotspot auto-connect docs | Phase 22 | +| FEAT-08 | `SHIPPED` | Predictable IP on phone hotspot | Phase 22 | +| FEAT-09 | `WONTFIX` | mDNS (yaris.local) on phone hotspot | — | +| FEAT-10 | `IDEA` | Home Assistant integration | unassigned | +| FEAT-11 | `SHIPPED` | Hotspot SSID/password settings + 5GHz WiFi role swap | Phase 27 | --- @@ -184,3 +185,26 @@ dedicated PLAN.md phase (or fold it into the relevant existing work) and mark it app.py startup unless the user explicitly configures it. +### FEAT-11 — Hotspot SSID/password settings + 5GHz WiFi role swap +- **Status**: `SHIPPED` 2026-08-12 +- **Area**: `app.py`, `templates/settings.html`, `static/js/settings.js`, + `deploy/yaris-hotspot.sudoers`, `deploy/yaris_uplink.py`, `deploy/install_netwatch.sh`, + `modules/app_network.py` +- **Phase**: Phase 27 +- **What**: Two related changes: + 1. **Hotspot settings UI** — the Pi Settings page "In-car access" card now has SSID + + password fields (password write-only). `GET /api/hotspot` reads the current SSID via + nmcli; `POST /api/hotspot` updates SSID/password and restarts the AP immediately. + Backed by `deploy/yaris-hotspot.sudoers` (privileged nmcli on the `Hotspot-local` + profile). + 2. **WiFi role swap** — the fast TP-Link T3U (wlan1) now hosts the in-car AP on **5GHz** + ("vroom vroom yaris de course" at 10.42.0.1) for fast phone access (Android dev, video + browsing); the weak onboard BCM43438 (wlan0) carries the internet uplink (home WiFi + "BuzzBis" + phone hotspot, static IP 192.168.50.220). This was done because the AP on + the onboard radio was too slow for interactive Android work. Tradeoff: away-from-home + uploads now run over the weak radio (accepted — background task). A single radio cannot + be AP + client at once, so the phone-hotspot uplink must stay on wlan0. +- **Files**: `yaris_uplink.py` (PRIMARY=wlan0, AP_INTERFACE=wlan1, AP_CONNECTION=Hotspot-local), + `app_network.py` (uplink on wlan0, AP on wlan1), `install_netwatch.sh` (rebinds profiles). + + diff --git a/PLAN.md b/PLAN.md index df4c9db..5a0f787 100644 --- a/PLAN.md +++ b/PLAN.md @@ -12,9 +12,14 @@ pick up the project without needing prior chat history. - **Board**: Raspberry Pi 3 Model B Rev 1.2, 906MB RAM. Confirmed too weak to run an AI coding agent — all agent-assisted dev work happens on a separate local machine; the Pi is only used for hardware bring-up/testing/deployment via SSH (`yaris@`). -- **WiFi**: Dual-radio setup — **TP-Link Archer T3U (RTL8812BU)** USB dongle as `wlan1` for - Internet uplink (home WiFi, phone hotspot), onboard BCM43438 as `wlan0` running a permanent - AP ("yaris 911" at 10.42.0.1, password "yaris911!"). Both radios active simultaneously. +- **WiFi**: Dual-radio setup — **TP-Link Archer T3U (RTL8812BU)** USB dongle as `wlan1` and the + onboard BCM43438 as `wlan0`. **2026-08-12 role swap**: the fast T3U now hosts the in-car AP + ("vroom vroom yaris de course" on 5GHz at 10.42.0.1) for fast phone access (Android dev, video + browsing); the weak onboard radio carries the internet uplink (home WiFi "BuzzBis" + + phone hotspot, static IP 192.168.50.220, gw 192.168.50.1). Both radios active simultaneously. + Tradeoff: away-from-home uploads (dashcam/trip sync) now run over the weak onboard radio — a + background task, accepted by owner. A single radio cannot be AP + client at once, so the + phone-hotspot uplink cannot also live on wlan1 while it hosts the AP. - **GPS/GSM**: Waveshare **SIM868 GSM/GPRS/GNSS/Bluetooth HAT**. GNSS provides live GPS fixes (confirmed working, ~7 satellites, ~80s cold-start TTFF). GSM/GPRS cellular is **not in use** (no SIM card available); a Huawei **E3372h-153 4G LTE modem** has been purchased as a future @@ -66,13 +71,16 @@ pick up the project without needing prior chat history. OSM tile usage policy. Bounding box is a required CLI arg (the user's own driving area, not committed here), zoom 8-15 by default (~14k tiles for a city-plus-suburbs-sized area, well under MapTiler's 100k/month free quota). -2. **WiFi hotspot mode**: **Dual-radio** — the TP-Link Archer T3U (wlan1) handles all internet - uplink traffic (home WiFi, phone hotspot), while the onboard WiFi (wlan0) runs a permanent - AP ("yaris 911" at 10.42.0.1) that is never taken down by the uplink manager. The hotspot - is *only* for local web-UI viewing on a phone/laptop while driving — it is not part of the - upload path. Remote-server uploads happen independently via home WiFi (when in range), - phone hotspot (Phase 22), or cellular fallback (decision #5). Phone-hotspot auto-connects - on wlan1 within ~60s of appearing, falls back to home-wifi when it disappears. +2. **WiFi hotspot mode**: **Dual-radio** — the fast TP-Link Archer T3U (wlan1) hosts the + in-car AP ("vroom vroom yaris de course" on 5GHz at 10.42.0.1), while the onboard BCM43438 + (wlan0) carries all internet uplink traffic (home WiFi, phone hotspot) and is never taken + down by the uplink manager. The hotspot is *only* for local web-UI/Android access while + driving — it is not part of the upload path. Remote-server uploads happen independently via + home WiFi (when in range), phone hotspot (Phase 22, now on wlan0), or cellular fallback + (decision #5). Phone-hotspot auto-connects on wlan0 within ~60s of appearing, falls back to + home-wifi when it disappears. **2026-08-12 swap** from the previous arrangement (uplink on + wlan1, AP on wlan0) to put the fast radio on the AP for interactive phone work; the weak + radio's uplink slowness is accepted because away-from-home upload is a background task. 3. **Local/remote persistence**: Keep SQLite locally (reliable local write path per trip). The original plan paired this with MongoDB Atlas for remote sync (`modules/app_db.py`, fixed in Phase 7) — **superseded by decision #4/Phase 9**: the actual remote store is the self-hosted @@ -81,7 +89,7 @@ pick up the project without needing prior chat history. 4. **Remote server**: Self-hosted — a custom server/API (e.g. on a home server or VPS) receives itinerary and dashcam uploads, rather than 3rd-party managed cloud services. 5. **Remote upload uplink**: Three paths, tried in order: (1) WiFi/Ethernet via `requests`, - (2) phone hotspot via wlan1 when configured and in range (Phase 22), (3) SIM868 GSM/GPRS + (2) phone hotspot via wlan0 when configured and in range (Phase 22), (3) SIM868 GSM/GPRS cellular fallback (AT-command HTTP client, tracking batches only — no dashcam video). Cellular is **untested** (no SIM card). A Huawei E3372h-153 4G LTE modem has been purchased to replace the 2G-only SIM868 cellular path once a SIM is available (FEAT-04). diff --git a/deploy/readme.md b/deploy/readme.md index f36480e..900b789 100644 --- a/deploy/readme.md +++ b/deploy/readme.md @@ -20,8 +20,8 @@ cd /home/yaris/app/yaris-obd # REQUIRED before netwatch install: # Create/update NetworkManager profiles named exactly: -# - home-wifi (client WiFi) -# - Hotspot (local AP, shared at 10.42.0.1/24) +# - home-wifi (client WiFi → wlan0, the internet uplink) +# - Hotspot-local (local AP, shared at 10.42.0.1/24, on wlan1) # See section 4 below for exact nmcli commands. bash deploy/install_service.sh @@ -42,9 +42,10 @@ curl -I http://127.0.0.1/ ## TP-Link Archer T3U (RTL8812BU) driver -This project expects the T3U USB adapter as `wlan1` for hotspot/uplink logic. -On a fresh Pi, install the RTL8812BU DKMS driver before configuring WiFi -profiles: +This project expects the T3U USB adapter as `wlan1` for the in-car AP (5GHz) +and the onboard radio as `wlan0` for the internet uplink (home WiFi + phone +hotspot). On a fresh Pi, install the RTL8812BU DKMS driver before configuring +WiFi profiles: ```bash sudo apt-get update @@ -107,8 +108,8 @@ cd /home/yaris/app/yaris-obd `deploy/install_netwatch.sh` expects two profiles to already exist: -- `home-wifi` (normal client connection) -- `Hotspot` (local AP for phones/laptops in the car) +- `home-wifi` (normal client connection → wlan0, the internet uplink) +- `Hotspot-local` (local 5GHz AP on wlan1 for phones/laptops in the car) ### 4a) Home WiFi profile (edit SSID/password) @@ -116,7 +117,7 @@ cd /home/yaris/app/yaris-obd sudo nmcli connection add \ type wifi \ con-name home-wifi \ - ifname wlan1 \ + ifname wlan0 \ ssid "" \ wifi-sec.key-mgmt wpa-psk \ wifi-sec.psk "" \ @@ -127,10 +128,10 @@ sudo nmcli connection add \ ### 4b) Local hotspot profile (edit password) ```bash -sudo nmcli connection add type wifi con-name Hotspot ifname wlan1 ssid yaris-obd -sudo nmcli connection modify Hotspot \ +sudo nmcli connection add type wifi con-name Hotspot-local ifname wlan1 ssid yaris-obd +sudo nmcli connection modify Hotspot-local \ 802-11-wireless.mode ap \ - 802-11-wireless.band bg \ + 802-11-wireless.band a \ wifi-sec.key-mgmt wpa-psk \ wifi-sec.psk "" \ ipv4.method shared \ diff --git a/readme.md b/readme.md index 73caed3..183e187 100644 --- a/readme.md +++ b/readme.md @@ -36,8 +36,8 @@ Dashboard — mobile (390 px) and desktop (1280 px): Automatic reconnects with clear adapter/ECU diagnostics. DTC codes persist across reboots. - **Real GPS tracking** — Waveshare SIM868 GNSS HAT with GPIO PWRKEY auto-power-on. Live position plotted on an offline Leaflet map (pre-cached tiles, no internet needed). -- **WiFi hotspot** — auto-switches between home WiFi and a self-hosted AP for in-car phone access - at `http://yaris.local` (no port number). Phone hotspot uplink supported for on-the-road sync. +- **WiFi hotspot** — fast 5GHz in-car AP on the T3U (wlan1), internet uplink (home WiFi + + phone hotspot) on the onboard radio (wlan0). SSID/password configurable from the Settings page. - **Dashcam workflow** — auto-detects any USB dashcam, mounts read-only, browses files before importing. Import one, selected, or all files. Delete individual or all files directly from the dashcam. Verified against real 28GB/87-file hardware. @@ -74,7 +74,8 @@ Dashboard — mobile (390 px) and desktop (1280 px): | Raspberry Pi 3 Model B Rev 1.2 | Web UI host, logger, uploader, and WiFi hotspot | | Waveshare SIM868 HAT | GNSS (GPS) + optional GSM/GPRS uplink, unused Bluetooth | | USB OBD-II adapter | PL2303-based, ELM327-compatible (originally Bluetooth, switched to USB) | -| TP-Link Archer T3U (RTL8812BU) | USB WiFi dongle — AC1300 dual-band, replaces onboard wlan0 for hotspot + uplink | +| TP-Link Archer T3U (RTL8812BU) | USB WiFi dongle — AC1300 dual-band. Hosts the 5GHz in-car AP (wlan1) since 2026-08-12 | +| Onboard BCM43438 (wlan0) | Internet uplink (home WiFi + phone hotspot) since 2026-08-12 | | USB dashcam | Any brand — detected as generic USB mass storage | | 2013 Toyota Yaris | The patient |