is there ant way which can create devices based on input json payload.
Lets suppose input payload is
{
"success": true,
"msg": [{
"deviceName": "new sensor 05",
"deviceType": "temperature sensor",
"temperature": 39,
"humidity": 76,
"serial": "ACBR342D"
}, {
"deviceName": "new sensor 06",
"deviceType": "temperature sensor",
"temperature": 39,
"humidity": 76,
"serial": "ACW4756RD"
}]
})
and intend is from this input payload Thingsboard GW create below two devices ie. based on number of array in msg object it should create that number of devices on thingsboard engine:
- device 1: new sensor 05
- device 2: new sensor 06
and mapping coversion code is:
"converter": {
"type": "json",
"deviceNameJsonExpression": "${msg[:3].deviceName}",
"deviceTypeJsonExpression": "${msg[:3].deviceType}",
"telemetry": [{
"key": "temp",
"type": "int",
"value": "${msg[:3].temperature}"
},
{
"key": "hum",
"type": "int",
"value": "${msg[:3].humidity}"
}
],
"attributes": [{
"key": "serialNumber",
"type": "string",
"value": "${msg[:3].serial}"
}]
}