feat: Implement Odoo Config-Push System (Phase 3.2)
Completes PUSH architecture - Odoo automatically pushes config to Bridge
NEW FEATURES:
- Model Hooks in mqtt.device (create/write/unlink)
- Automatically push config after device create/update/delete
- Smart detection: only relevant fields trigger push
- Non-blocking: UI works even if bridge is offline
- Config Builder (_build_bridge_config)
- Collects all active mqtt.device records
- Converts to Bridge-compatible JSON format
- Topic pattern transformation (/#→/status/pm1:0)
- Session config extraction from strategy_config JSON
- Returns BridgeConfig schema with timestamp + version
- HTTP Client with Retry Logic (_push_bridge_config)
- POST to bridge_url/config with JSON payload
- 3 retries with exponential backoff (1s, 2s, 4s)
- Timeout: 10 seconds per request
- Error handling: 4xx no retry, 5xx retry
- Returns success/message dict for UI notifications
- System Parameter for Bridge URL
- Configurable via ir.config_parameter
- Key: open_workshop_mqtt.bridge_url
- Default: http://iot-bridge:8080
- Stored in data/system_parameters.xml
- Manual Push Button in UI
- '🔄 Push Config to Bridge' button in device list header
- Calls action_push_config_to_bridge()
- Shows success/error notification toast
- Allows manual sync when needed
NEW FILES:
- data/system_parameters.xml - Bridge URL param
- tests/test_config_push_integration.py - Python integration test
MODIFIED FILES:
- models/mqtt_device.py - +250 lines (hooks, builder, client)
- views/mqtt_device_views.xml - Manual push button
- __manifest__.py - requests dependency, data file
ARCHITECTURE CHANGE:
Before: Bridge pulls config from Odoo via GET /api/config
After: Odoo pushes config to Bridge via POST /config
- Triggered automatically on device changes (create/write/unlink)
- Manual trigger via UI button
- Bridge receives validated config via FastAPI endpoint
TESTING:
✅ Model hooks fire on create/write/unlink
✅ Config builder generates valid JSON
✅ HTTP client successfully pushes to bridge
✅ Retry logic works (tested with bridge down→up)
✅ Manual button displays notifications
✅ Bridge receives and applies config
✅ Device add/update/remove reflected in bridge
NEXT STEP:
Phase 3.3 - Remove legacy get_config() from bridge (no longer needed)