This is the API hosted on Sonic allowing to manage the device and retrieve collected data. Available endpoints allow to:
Whenever unknown request is received, API returns a 404 Not Found response.
If a webhook is configured, the device will send PUT requests for the following events: "auto-shut-off-report", "telemetry", "valve", "power-supply-changed", "wifi-changed" and "online".
Message sent when new telemetry data was collected.
| Label | Unit |
|---|---|
| Flow | ml/min |
| Pressure | mbar |
| Temperature | °C |
| Event volume | ml |
| Event duration | s |
{
"type": "telemetry",
"data":
{
"flow": integer,
"pressure": integer,
"temperature": integer,
"event": { "volume": integer, "duration": integer },
"errors": ["flow"/"pressure"/"temperature"],
},
}
Message sent when the valve state changes.
{
"type": "valve",
"data": {
"state": "open"/"closed"/"opening"/"closing/unknown"
}
}
Message sent when the power supply status changes.
{
"type": "power-supply-changed",
"data": {
"supply": "battery"/"external"/"external+battery"
]
}
}
Message sent when the auto shut-off module gets triggered due to detecting a potential leak.
| Label | Unit |
|---|---|
| Volume | ml |
| Duration | s |
| Timestamp | ms |
{
"type": "auto-shut-off-report",
"data":
{
"type": ["VOLUME_THRESHOLD"/"DURATION_THRESHOLD"],
"volume": integer,
"duration": integer,
"timestamp": integer,
},
}
Retrieve specified information from the device: valve state, water flow indicator, MQTT and Wi-Fi connection status, power supply, firmware version, water meter data, and device uptime.
| Label | Unit |
|---|---|
| Water meter volume | L |
| Water meter duration | min |
| Uptime | s |
{- "valveState": "closed",
- "waterFlowing": false,
- "mqttConnected": true,
- "wifiConnected": true,
- "powerSupply": "external",
- "firmwareVersion": "2024.1.0",
- "serialNumber": "abcdef1234567890",
- "waterMeter": {
- "positive": {
- "volume": 567820,
- "duration": 3908
}, - "negative": {
- "volume": 567820,
- "duration": 3908
}
}, - "uptime": 1024560,
- "buzzerPlaying": false
}Request the change of the valve state. If the valve is already in the desired state, its position won't change.
| state | string Default: "close" Enum: "open" "close" |
{- "state": "open"
}Control the buzzer by playing a song or stopping playback. Available actions:
Supported songs: beep, christmas_1, christmas_2
| Label | Unit |
|---|---|
| Interval | ms |
| Times | count |
| action required | string Enum: "start" "stop" Action to perform (start or stop buzzer). |
| name | string Name of the sound to play (required when action is "start"). |
| interval | integer Default: 1000 Interval between sound repetitions in milliseconds (optional, default 1000). |
| times | integer Default: 1 Number of times to repeat the sound (optional, default 1 = play once, X = play X times). |
{- "action": "start",
- "name": "beep",
- "interval": 1000,
- "times": 3
}Retrieve sensors readings from the device. This includes: flow rate, pressure, water temperature, ongoing event data and potential errors. When an error is detected, the corresponding value is excluded from the payload. When water is not flowing, the event data is excluded from the payload.
| Label | Unit |
|---|---|
| Flow rate | ml/min |
| Pressure | mbar |
| Water temperature | °C |
| Event volume | ml |
| Event duration | s |
{- "flow": 6800,
- "pressure": 2320,
- "temperature": 0,
- "event": {
- "volume": 16000,
- "duration": 90
}, - "errors": [
- [
- "flow",
- "pressure"
]
]
}Retrieve the power status of the device. When the device is running only on external power supply, the battery voltage is excluded from the payload.
| Label | Unit |
|---|---|
| Battery voltage | mV |
{- "battery": false,
- "external": true,
- "batteriesVoltage": 6800
}Retrieve the networking status of the device.
| Label | Unit |
|---|---|
| RSSI | dBm |
| Wi-Fi uptime | ms |
| MQTT uptime | ms |
{- "mqttConnected": true,
- "wifiConnected": true,
- "ip": "192.168.21.37",
- "gateway": "192.168.1.0",
- "subnet": "192.168.1.0/24",
- "ssid": "MyWi-Fi",
- "rssi": -45,
- "wifiUpTime": 1024560,
- "mqttUpTime": 1023450
}Update the networking configuration of the system.
| ssid | string SSID of the Wi-Fi network to connect. |
| password | string Password of the Wi-Fi network to connect. |
{- "ssid": "MyWi-Fi",
- "password": "password"
}Execute a specific command on the device.
| Command | Description |
|---|---|
| reboot | Software reboot of the device |
| type | string Value: "reboot" Type of the command to execute. |
{- "type": "reboot"
}