|
|
4c03959437
|
feat(mqtt): Implement M0-M3 - MQTT IoT Bridge with Session Detection
- M0: MQTT Client with TLS/SSL support
- Connection to mqtt.majufilo.eu:8883
- Topic subscription with wildcards
- JSON payload parsing
- M1: Shelly PM Mini G3 Integration
- Status message parser (shaperorigin/status/pm1:0)
- Custom MQTT topic prefix support
- Power, voltage, current, frequency extraction
- Device mapping via topic_prefix
- M2: Event Normalization
- Event Schema v1 with UUID-based event IDs
- ISO 8601 UTC timestamps
- Machine/Device info mapping
- Metrics normalization (power_w, voltage_v, current_a, frequency_hz)
- Filter None values
- M3: Session Detection Engine
- State machine: IDLE → STARTING → RUNNING → STOPPING → IDLE
- Power-based threshold detection (configurable per machine)
- Debounce logic (separate for start/stop)
- Session events with duration calculation
- Persistent storage (JSONL for events, JSON for sessions)
- Odoo-ready data format for future migration
Data Storage:
- events.jsonl: JSON Lines format (one event per line)
- sessions.json: Session records with start/end/duration
- Ready for migration to open_workshop.session model
Multi-device ready: Add devices via config.yaml with unique topic_prefix
|
2026-01-22 19:59:17 +01:00 |
|