implement: Phase 25.5 device config from JSON file

- Create config/device.json with owner_name, car_model, device_name, avatar_path
- Update app_account.py to load owner_name and avatar_path from config
- Update app_car.py to load car_model and device_name from config
- Update base.html template to use avatar_path from config instead of hardcoded
- Add graceful fallback to hardcoded defaults if config file missing
- Document in deploy/readme.md and readme.md how to customize device identity
- Update PLAN.md Phase 25.5 to reflect current implementation and future server sync

Benefits:
- No code edits needed to customize Pi (edit JSON file only)
- Offline-first: all values loaded from local file at startup
- Connection-driven sync planned for Phase 25.5a (sync when internet available, not on timer)
- Server becomes source of truth after Phase 25.5a implementation

All 63 tests passing. Database filename still based on owner_name, with migration warning in docs.

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 16:31:59 -04:00
co-authored by Copilot
parent 69beb07430
commit c65a635906
7 changed files with 164 additions and 53 deletions
+34
View File
@@ -179,6 +179,40 @@ Then test from another device:
- `http://yaris.local`
- if mDNS is not available on that client, try `http://10.42.0.1`
## Customizing device identity
The Pi displays a username, car model, device name, and avatar image. Instead of editing Python code, edit `config/device.json`:
```bash
nano /home/yaris/app/yaris-obd/config/device.json
```
**Example `config/device.json`:**
```json
{
"owner_name": "Your Name",
"car_model": "Toyota Yaris 2013",
"device_name": "My Yaris OBD",
"avatar_path": "img/yaris.png"
}
```
- **`owner_name`**: Displayed in topbar (top-right corner of the web UI)
- **`car_model`**: Displayed in sidebar (left panel, appears next to car icon)
- **`device_name`**: Reserved for server-side display (Phase 25.5 feature, not yet used)
- **`avatar_path`**: Avatar image shown in topbar; must exist in `static/img/` (replace `static/img/yaris.png` with your own image, or point to a different file)
After editing, restart the app:
```bash
sudo systemctl restart yaris-obd.service
```
**Important**: The SQLite database filename is based on the username. If you change `owner_name` and restart, a new database will be created and the old data will be orphaned at `db/sql/quoije_Yaris2013.db`. Either:
- Rename the old database file to match the new username, or
- Delete the old database if you want a fresh start
## 7) Updating later
```bash