feat: initial myprimal MQTT bridge service

Dynamic MySolem/MyIndygo IoT bridge with MQTT, Home Assistant
autodiscovery, and Homebridge EasyMQTT compatibility.

- Device discovery via MySolem API on startup (all modules/inputs/outputs)
- Configurable poll engine (fast/normal/slow buckets, per-input overrides)
- MQTT retained state publishing + HA autodiscovery payloads
- Unified manual command routing (linesControl vs sendManualModuleCommand)
- Runtime config via MQTT $config/set, persisted to config.json
- Expression override system (API-provided > hardcoded > passthrough)
- Minimal REST API: /health, /state, /control, /rediscover
- Docker deployment (Dockerfile + docker-compose.yml)
- 38 unit tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 01:05:24 +02:00
commit 941abd98d5
48 changed files with 12118 additions and 0 deletions
+121
View File
@@ -0,0 +1,121 @@
# LRPC — Pool Controller (LRPC-F1DA27)
**Module ID**: `6481bcea8782b78554c02bed`
**Serial**: `150302F1DA270001`
**Type**: `lr-pc`
---
## Pool configuration
| Field | Value |
|---|---|
| Pool ID | `5de53c1c7ed4c45c2cfe0688` |
| Volume | 25 m³ |
| Shape | rectangular 6 × 3 m, depth 1.4 m |
| Filter | glass filter |
| Treatment | stabilised chlorine tablets |
| Chlorine regulation | manual |
| pH regulation | automatic |
| Installation | outdoor, no heating, no cover |
Endpoint:
```
GET /maintenance-logs-data?moduleId=6481bcea8782b78554c02bed
```
Returns 25+ pool alerts, maintenance history, and `messages[0].pool` with full config.
---
## Sensors / Inputs
| Input ID | Metric | Unit | Type code |
|---|---|---|---|
| `6481bcea8782b78554c02bef` | Water temperature | °C | 133 |
> Sensor telemetry endpoint: `GET /remote/input/getComputedSensorData?inputId=...`
> Live readings (temp, pH, ORP, pressure) are in `maintenance-logs-data` under `pool.status`.
---
## Outputs
| Output ID | Name | Index |
|---|---|---|
| `6481bcea8782b78554c02bf1` | Station 1 (filtration pump) | 0 |
| `6481bcea8782b78554c02bf2` | Station 2 | 1 |
| `6481bcea8782b78554c02bf3` | Station 3 | 2 |
---
## Filtration programs
### Program 0 — Filtration (type 4, index 0)
ID: `6481bcea8782b78554c02bf4`
Runs every day (weekDays: 127).
| Window | Time range | Duration |
|---|---|---|
| Morning | 05:0006:00 | 1h |
| Midday | 12:0014:00 | 2h |
| Evening | 22:0023:00 | 1h |
| **Total/day** | | **4h** |
Special features:
- **Micro-filtration** (frost mode): triggers every 480 min for 10 min when temp < 5°C
- **Temperature-adaptive schedules**: 2 schedules active (96 days + 31 days/year), each with 12 thresholds that adjust run windows based on pool temperature
### Program 1 — Auxiliary/cyclic (type 2, index 1)
ID: `6481bcea8782b78554c02bf5`
Active window: 21:3022:30 (1h slot), cycle duration 5 min.
Likely electrolyser or secondary pump.
### Program 2 — Unused (index 2)
ID: `6481bcea8782b78554c02bf6`
No active windows configured.
---
## Reading filtration schedule
```
GET /programs/modules?moduleIds=6481bcea8782b78554c02bed
```
Window times are in **minutes from midnight**. Duration (`on`) is in **seconds**.
```python
def mins_to_time(m): return f"{m//60:02d}:{m%60:02d}"
def secs_to_human(s): h,m = divmod(s,3600); return f"{h}h{m//60:02d}m"
for prog in data['programs']:
for w in prog['windows']:
if w['runningDays'] > 0:
print(f"{mins_to_time(w['start'])}{mins_to_time(w['end'])} {secs_to_human(w['on'])}")
```
---
## Alerts & maintenance history
```
GET /maintenance-logs-data?moduleId=6481bcea8782b78554c02bed
```
Returns `{ code, messages: [...] }`. Each message has:
- `poolAlertType`: `backwashReminder`, `backwashDone`, `poolLevelSensorCleaningReminder`, …
- `priority`: `low` / `medium` / `high`
- `state`: `read` / `unread`
- `timestamp`: ISO 8601
- `pool`: full pool config object (only on messages that have pool context)
---
## Notes
- `remote/module/configuration` and `remote/module/informations` return `module_not_reachable` — the LRPC communicates via LoRa relay, not direct HTTP
- `output/events` returns empty — past filtration run history is not stored server-side per event; the program schedule is the source of truth
- The LRPC temperature input (type 133, unit 2) is distinct from the LRPS pool sensor temperature; both track pool water temp but from different probes