Access Measurements in LoRaWAN Decoders
Concept
The global measurements object allows you to access the device's current measurements. It is structured like this:
{
"BATTERY": {
"field_name": "BATTERY",
"timestamp": "1600378287",
"value": 3.301
},
"SOIL_CONDUCTIVITY": {
"field_name": "SOIL_CONDUCTIVITY",
"timestamp": "1600378287",
"value": 121
}
}Code Example
function decoder() {
// get current value from field in Database
var field_in_db = measurements.FIELD_IN_DB.value;
}Building Counters
If you want to build absolute counters you can use the database access on a decoder in order to read the currently stored value, add a new count and store back the new and updated count. We show you how you can do that.
Last updated
Was this helpful?