0

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?

4

1 回答 1

0

这是可能的,但您需要实现新的转换器类型。我们拥有的是使用 JSON。您可以实现自己的接受二进制数据的转换器。因此,您的配置将类似于以下内容:

{
  "topicFilter": "sensors",
  "converter": {
    "type": "binary",
    /* whatever configuration structure that is applicable to your use case */
  }
}
于 2018-01-22T09:52:22.547 回答