feat: add device config settings UI with optional server sync
- Add app_device_config.py module for managing device configuration (owner_name, car_model, avatar_path, device_name) - Add sync_enabled flag to control whether Pi syncs config from server - When sync is enabled, device config fields are read-only (server is source of truth) - When sync is disabled, user can edit device config via Settings page - Add /api/device-config endpoint (GET to retrieve, POST to update) - Add Device identity section to settings.html with form fields for all config values - Update settings.js to load/save device config with sync toggle - Gracefully handles both config file (at startup) and database (live updates via settings UI) - All 63 tests passing Phase 25.5: Offline-first device config with eventual consistency. Config loads from JSON at startup (no network needed), can be edited via settings if not syncing, and will sync from server on next connectivity when Phase 25.5a server endpoints are implemented. Co-authored-by: Copilot <[email protected]>
This commit is contained in:
+2
-1
@@ -3,7 +3,8 @@ import os
|
||||
|
||||
class Car:
|
||||
def __init__(self):
|
||||
# Load from config/device.json if available, else use defaults
|
||||
# Load from config/device.json at startup
|
||||
# Database values are updated via Settings UI, but Car object reflects startup state
|
||||
config = self._load_config()
|
||||
self.model = config.get("car_model", "Yaris 2013")
|
||||
self.device_name = config.get("device_name", "Yaris OBD")
|
||||
|
||||
Reference in New Issue
Block a user