941abd98d5
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>
140 lines
5.4 KiB
Markdown
140 lines
5.4 KiB
Markdown
# MySolem / MyIndygo API — Overview
|
||
|
||
| Platform | Base URL | Focus |
|
||
|---|---|---|
|
||
| MySOLEM | `https://qualif.mysolem.com` | Irrigation, garden sensors |
|
||
| MyIndygo | `https://qualif.myindygo.com` | Pool control, water chemistry |
|
||
|
||
Both platforms share **the same backend database and API** — same module IDs, input IDs, session cookie. MyIndygo adds pool-specific management endpoints on top.
|
||
See `api-docs/myindygo.md` for MyIndygo-specific docs.
|
||
|
||
**Backend**: Node.js + Sails.js v0.13.8 socket client, MongoDB (all IDs are 24-char hex ObjectIds)
|
||
**Real-time**: Socket.IO v3 / Engine.IO v3 (`EIO=3`), direct WebSocket transport (not long-polling), `wss://qualif.mysolem.com/socket.io/`
|
||
**Proxy**: nginx/1.18.0 (Ubuntu) in front
|
||
|
||
---
|
||
|
||
## Authentication
|
||
|
||
Two separate auth systems exist on the same server:
|
||
|
||
- **Web API** (no path prefix): session cookie (Sails.js), no CSRF required on JSON endpoints
|
||
- **Mobile API** (`/api/` prefix): OAuth2 Bearer token (`grant_type: client_credentials`)
|
||
|
||
See `api-docs/mobile-api.md` for the mobile API auth flow.
|
||
|
||
### Web login flow
|
||
|
||
```bash
|
||
# Step 1: initialize cookie jar
|
||
curl -c cookies.txt https://qualif.mysolem.com/login
|
||
|
||
# Step 2: authenticate
|
||
curl -c cookies.txt -b cookies.txt \
|
||
-X POST \
|
||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||
-d "email=YOUR_EMAIL&password=YOUR_PASSWORD" \
|
||
"https://qualif.mysolem.com/login"
|
||
|
||
# All subsequent calls
|
||
curl -b cookies.txt https://qualif.mysolem.com/features
|
||
```
|
||
|
||
Cookie name: `qualification-mysolem-solem-irrigation-platform.sid`
|
||
Session TTL: ~7 days
|
||
No CSRF token required on JSON endpoints.
|
||
|
||
### Python example
|
||
|
||
```python
|
||
import requests
|
||
|
||
BASE = "https://qualif.mysolem.com"
|
||
s = requests.Session()
|
||
|
||
s.get(f"{BASE}/login") # init cookie
|
||
s.post(f"{BASE}/login", data={
|
||
"email": "...",
|
||
"password": "...",
|
||
}) # 302 → / on success
|
||
|
||
# Now s carries the session cookie automatically
|
||
sites = s.get(f"{BASE}/canopy-sites", params={"userId": USER_ID}).json()
|
||
```
|
||
|
||
---
|
||
|
||
## Key IDs (test account)
|
||
|
||
| Resource | Name | ID | Serial Number |
|
||
|---|---|---|---|
|
||
| User (MySOLEM) | Arnaud Nelissen | `5de53bca7ed4c45c2cfe067f` | — |
|
||
| User (MyIndygo) | Arnaud Nelissen (API account) | `6a21c3db5ebe0fa5f7885460` | — |
|
||
| Site | Domicile | `62b30d26ecbceb08607592c1` | — |
|
||
| Gateway module | LRMB10-070532 | `60ca4276ad69dac1558f7c61` | `1000000705320001` |
|
||
| Sensor station module | LRMS-0721DC | `60ca42adad69dac1558f7c64` | `7400040721DC0001` |
|
||
| Agricultural valve module | LR6AG-070917 | `626984f038ec558c598bb6d5` | `6606010709170001` |
|
||
| Pool analyser module | LRPS-0565C0 | `6480da07c2c0896da120ecca` | `9400030565C00001` |
|
||
| Pool ctrl module | LRPC-F1DA27 | `6481bcea8782b78554c02bed` | `150302F1DA270001` |
|
||
| IP ECO module | LR2IPECO-0C9282 | `6516ca57b7c098e6807cb332` | `3802020C92820001` |
|
||
| Filter pressure sensor | LRPR-0D6800 | `6a17218be0b88ea3e925524f` | `1D00010D68000001` |
|
||
| Pool level switch | POOL-LVL-0E953B | `6a174dd1e0b88ea3e925531c` | `0300020E953B0001` |
|
||
| Level ctrl module | LRLEVEL-0D2ED9 | `6a1c4b153d6c33ab843edc13` | `3A01020D2ED90001` |
|
||
| Input: Soil moisture (Plumbago) | — | `60ca42adad69dac1558f7c66` |
|
||
| Input: Sensor 2 | — | `60ca42adad69dac1558f7c67` |
|
||
| Input: Sensor 3 | — | `60ca42adad69dac1558f7c69` |
|
||
| Input: Rain sensor (AG) | — | `626984f038ec558c598bb6d7` |
|
||
| Input: Pool temperature (LRPS) | — | `6480da07c2c0896da120eccc` |
|
||
| Input: Pool pH (LRPS) | — | `6480da07c2c0896da120eccd` |
|
||
| Input: Pool ORP/Redox (LRPS) | — | `6480da07c2c0896da120ecce` |
|
||
| Input: Rain sensor (LRAG) | — | `626984f038ec558c598bb6d7` |
|
||
| Input: Moisture — Plumbago (LRMS) | — | `60ca42adad69dac1558f7c66` |
|
||
| Input: Moisture — Pelouse (LRMS) | — | `60ca42adad69dac1558f7c67` |
|
||
| Input: Temperature (LRMS) | — | `60ca42adad69dac1558f7c69` |
|
||
| Input: Flow meter (LRIPECO) | — | `6516ca57b7c098e6807cb334` |
|
||
| Input: Filter pressure (LRPR) | — | `6a17218be0b88ea3e9255251` |
|
||
| Input: Pool level switch (POOL-LVL) | — | `6a174dd1e0b88ea3e925531e` |
|
||
| Input: Pool level switch aux (POOL-LVL) | — | `6a174dd1e0b88ea3e925531f` |
|
||
| Input: Fill volume (LRLEVEL) | — | `6a1c4b153d6c33ab843edc15` |
|
||
| Input: Fill valve state (LRLEVEL) | — | `6a1c4b153d6c33ab843edc16` |
|
||
| Output: Station 1 (AG) | Station 1 | `626984f038ec558c598bb6d8` |
|
||
| Output: Station 2 (AG) | Station 2 | `626984f038ec558c598bb6d9` |
|
||
|
||
---
|
||
|
||
## Module types
|
||
|
||
| Type string | Description |
|
||
|---|---|
|
||
| `lr-mb-10` | LoRa relay / gateway |
|
||
| `lr-ms` | LoRa sensor station |
|
||
| `lr-ag` | LoRa agricultural valve |
|
||
| `lr-mas` | LoRa master valve |
|
||
| `lr-pc` | LoRa pool controller |
|
||
| `lr-ip-eco` | LoRa IP ECO |
|
||
| `lr-pr` | LoRa pressure sensor (filter) |
|
||
| `pool-level-sensor` | Pool float level switch |
|
||
| `lr-niv` | LoRa level controller (fill valve) |
|
||
| `wf-mb` | WiFi gateway |
|
||
| `wf-is` / `bl-is` | WiFi/BT sensor |
|
||
| `bl-ip` | BT IP |
|
||
| `wf-ol` | WiFi online |
|
||
|
||
---
|
||
|
||
## Input type codes
|
||
|
||
| Code | Meaning | Unit |
|
||
|---|---|---|
|
||
| `2` | TOR (on/off, e.g. rain sensor) | — |
|
||
| `5` | Air/soil temperature | °C |
|
||
| `6` | pH | — (raw ÷ 100) |
|
||
| `7` | ORP / Redox | mV |
|
||
| `8` | Pressure | bar (unit `6`, expression: `(1.5×raw−500)/1000`) |
|
||
| `12` | Soil moisture | % (unit `10`) |
|
||
| `20` | Air moisture | — |
|
||
| `21` | Pool level TOR switch | raw 0/1 |
|
||
| `33` | Volumetric / flow | L (unit `1`) |
|
||
| `133` | Water temperature | °C (unit `2`) |
|
||
| `149` | Fill valve / level state | raw 0/1 |
|