I'm just starting with ThingsBoard and I fail to understand how to configure the platform for my scenario.
Currently, I have a custom LoRa network with three Arduino Nano. I use one of them as a receiver to collect and transmit data from the other ones. The transmission is done though a serial connection.
So on my PC I have a program to collect and parse the data to JSON. There is an id field to identify each node.
I am able to publish the data from my PC to ThingsBoard, but only with one device. So even if the id change, the data is still interpreted as coming from one device.
{"id": 1, "temperature": 25, "humidity": 61}
{"id": 2, "temperature": 26, "humidity": 71}
Starting from there, I don't really know how to split the data based on the id in the JSON.
Is there a way to automatically map new devices based on the id (especially if I add some sender to the LoRa Network) ?
Or should I manually add every device to ThingsBoard and do the routing from the PC ?
I have seen some information about the thingsboard-gateway and rule chains, but I didn't understand how to suit my needs. So I'm still going through the docs.
So I've found a way. Basically this is the work of iot-gateway. It's just a small tweak from getting started guide: https://thingsboard.io/docs/iot-gateway/getting-started/#step-3-add-new-connector.
Scroll down to “Data conversion” section:
For “Device” subsection use the following options/values:
In the “Name” row, select “Constant” in the “Source” dropdown field, fill in the “Value / Expression” field with the “Device Demo” value.
In the “Profile name” row, select “Constant” in the “Source” dropdown field, fill in the “Value / Expression” field with the “default” value.
One just need to extract the name of the device from the message payload (or from path if applicable)
So just specify the device id like this in the connector configuration
"deviceInfo": {
"deviceNameExpression": "Node ${your_id}",
"deviceNameExpressionSource": "message",
"deviceProfileExpressionSource": "constant",
"deviceProfileExpression": "default"
}