Reputation: 35
I've searched in the documentation and in the message boards, but was unable to find the following.
I'm trying to import data from mqtt into thingsboard, using the IOT gateway.
The documentation outlines how to configure the IOT gateway to import json-formatted data.
{
"topicFilter": "sensors",
"converter": {
"type": "json",
"filterExpression": "",
"deviceNameJsonExpression": "${$.serialNumber}",
"attributes": [
{
"type": "string",
"key": "model",
"value": "${$.model}"
}
],
"timeseries": [
{
"type": "double",
"key": "temperature",
"value": "${$.temperature}"
}
]
}
}
from (https://thingsboard.io/docs/iot-gateway/getting-started/#step-81-basic-mapping-example).
That mapping then works to import data published like this:
mosquitto_pub -h localhost -p 1883 -t "sensors" -m '{"serialNumber":"SN-001", "model":"T1000", "temperature":36.6}'
I am hoping that it is also possible to import raw data, i.e. without json formatting, because I already have many data topics with raw data payloads. So, just raw ascii-encoded values. So, like this:
mosquitto_pub -h localhost -p 1883 -t "sensors/livingroom/temperature" -m '36.6'
Is that possible with the IOT gateway, and if so, what would the configuration look like?
Upvotes: 0
Views: 1275
Reputation: 732
It is possible, but you will need to implement new converter type. The one we have is using JSON. You can implement your own converter that accepts binary data. So, your configuration will looks similar to this:
{
"topicFilter": "sensors",
"converter": {
"type": "binary",
/* whatever configuration structure that is applicable to your use case */
}
}
Upvotes: 0