Skip to content

Commit

Permalink
CubicMeter 1.1 normalized output and schema update (#828)
Browse files Browse the repository at this point in the history
* Schema extension

* Added examples and fixed few issues in the decoding

* Added functionality for response messages

* Added more tests for response payloads

* Comply decodeUplink with lorawan api standard

* Lost response for type statusReport fixed

* Nice naming of pipe types
  • Loading branch information
peter-quandify authored Oct 10, 2024
1 parent 5381175 commit 0480f99
Show file tree
Hide file tree
Showing 3 changed files with 362 additions and 67 deletions.
35 changes: 35 additions & 0 deletions lib/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,45 @@
"leak": {
"type": ["boolean", "string"],
"description": "Leak detected"
},
"temperature": {
"type": "object",
"properties": {
"min": {
"description": "Minimum temperature (°C)",
"$ref": "#/definitions/temperature"
},
"max": {
"description": "Maximum temperature (°C)",
"$ref": "#/definitions/temperature"
},
"avg": {
"description": "Average temperature (°C)",
"$ref": "#/definitions/temperature"
},
"current": {
"description": "Current temperature (°C)",
"$ref": "#/definitions/temperature"
}
}
}
},
"additionalProperties": false
},
"metering": {
"type": "object",
"properties": {
"water": {
"type": "object",
"properties": {
"total": {
"type": "number",
"description": "Total volume (L)"
}
}
}
}
},
"action": {
"type": "object",
"properties": {
Expand Down
81 changes: 81 additions & 0 deletions vendor/quandify/cubicmeter-1-1-plastic-codec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,84 @@
# For documentation on writing encoders and decoders, see: https://thethingsstack.io/integrations/payload-formatters/javascript/
uplinkDecoder:
fileName: cubicmeter-1-1-uplink.js

# Examples
examples:
- description: Normal status report
input:
fPort: 1
bytes: [73, 251, 223, 1, 0, 0, 222, 20, 0, 0, 0, 0, 0, 0, 70, 237, 223, 1, 6, 252, 139, 7, 2, 226, 230, 83, 84, 85]
output:
data:
fPort: 1
length: 28
hexBytes: '49FBDF010000DE1400000000000046EDDF0106FC8B0702E2E6535455'
type: 'statusReport'
decoded:
ambientTemperature: 22.5
batteryActive: 3608
batteryRecovered: 3640
errorCode: 0
isSensing: true
leakState: 2
totalVolume: 5342
waterTemperatureMax: 22
waterTemperatureMin: 21.5
warnings: []
errors: []
normalizedOutput:
data:
- air:
temperature: 22.5
water:
temperature:
min: 21.5
max: 22
leak: ''
metering:
water:
total: 5342
battery: 3.64
warnings: []
errors: []
- description: Response from set pipe downlink
input:
fPort: 6
bytes: [4, 0, 2, 16, 0, 0, 22, 2, 5, 63, 1, 0, 0, 3, 0, 227, 221, 203, 177, 189, 117, 135, 50, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
output:
data:
fPort: 6
length: 38
hexBytes: '0400021000001602053F0100000300E3DDCBB1BD758732000001000000000000010000000000'
type: 'response'
decoded:
fPort: 4
status: 'ok'
type: 'hardwareReport'
data:
appState: 'metering'
firmwareVersion: '22.0.16'
hardwareVersion: 2
pipe:
id: 0
type: 'Custom'
warnings: []
errors: []
- description: Response from set lorawan report interval
input:
fPort: 6
bytes: [19, 0, 4, 1, 192, 168, 0, 0, 88, 2, 0, 0, 0, 0, 0, 30, 0, 0, 141, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
output:
data:
fPort: 6
length: 41
hexBytes: '13000401C0A80000580200000000001E00008D27000000000000000000000000000000000000000000'
type: 'response'
decoded:
fPort: 19
status: 'ok'
type: 'settingsReport'
data:
lorawanReportInterval: 600
warnings: []
errors: []
Loading

0 comments on commit 0480f99

Please sign in to comment.