|
|
c55b0e59d2
|
feat(odoo): IoT Bridge Phase 2 - Odoo REST API
Phase 2.1 - Models:
- ows.iot.event Model für Event-Logging
- event_uid (unique constraint) für Duplikat-Prävention
- event_type (session_started/updated/stopped/timeout/heartbeat)
- payload_json mit auto-extraction (power_w, state)
- Auto-Linking zu mqtt.device und mqtt.session
- Processing-Status tracking
- mqtt.device erweitert mit device_id (External ID für API)
- Existing mqtt.session bereits perfekt strukturiert
Phase 2.2 - REST API Controller:
- GET /ows/iot/config
- Returns aktive Devices mit session_config als JSON
- Public auth (später API-Key optional)
- POST /ows/iot/event
- JSON-RPC Format (Odoo type='json')
- Schema-Validation (required: event_uid, event_type, device_id, timestamp)
- Duplikat-Check: 409 Conflict für idempotency
- Auto-Processing: Session create/update/complete
- Response codes: 201/409/400/500
Phase 2.3 - Bridge OdooClient:
- Echte REST API Implementation
- get_config(): GET /ows/iot/config
- send_event(): POST /ows/iot/event (JSON-RPC)
- Duplicate handling (409 = success)
- HTTP Session mit requests library
- config.py: OdooConfig mit base_url, database, username, api_key
- main.py: Conditional OdooClient/MockOdooClient based on use_mock
Testing Guide:
- PHASE2_TESTING.md mit kompletter Anleitung
- Manuelle API Tests (curl examples)
- Integration Test Steps (Odoo + Mosquitto + Bridge)
- Success Criteria Checklist
Bereit für Phase 2.4 Integration Testing!
|
2026-02-05 16:43:26 +01:00 |
|
|
|
b6a0f0462d
|
feat: MQTT integration - auto-start, session detection, UI fixes
- Auto-start connections after Odoo restart via _register_hook()
- Start/Stop buttons with invalidate_recordset() and reload action
- Session detection with ShellyParser (RPC, telemetry, status)
- Fixed imports: datetime, ShellyParser
- Parser matches prototype with device_id, timestamp extraction
- Sessions created/ended based on power > 0 threshold
|
2026-01-24 23:40:03 +01:00 |
|