Shows how to build your own Network to control how devices deliver their data to TagoIO. We create the Network, write a payload parser that pulls the device serial out of the incoming message, and test it with a sample body in Postman. Payload parser:
// The Payload Parser runs every time a message is received from a device
if (Array.isArray(payload)) {
// Device sends the "serial" variable by default
const payload_received = payload.find(x => x.variable === "serial");
// Extract the serial from the value of the serial variable
serial = payload_received?.value;
} Example request body:
[
{
"variable": "serial",
"value": "12345"
},
{
"variable": "temperature",
"value": "71",
"unit": "°F"
},
{
"variable": "humidity",
"value": "89",
"unit": "%"
}
] TagoIO Team
Training recommended if you'd like to dig deeper