我在文档和留言板中搜索过,但无法找到以下内容 .
我正在尝试使用IOT网关将数据从mqtt导入到thingboard中 .
该文档概述了如何配置IOT网关以导入json格式的数据 .
{
"topicFilter": "sensors",
"converter": {
"type": "json",
"filterExpression": "",
"deviceNameJsonExpression": "${$.serialNumber}",
"attributes": [
{
"type": "string",
"key": "model",
"value": "${$.model}"
}
],
"timeseries": [
{
"type": "double",
"key": "temperature",
"value": "${$.temperature}"
}
]
}
}
来自(https://thingsboard.io/docs/iot-gateway/getting-started/#step-81-basic-mapping-example) .
然后该映射用于导入如下发布的数据: mosquitto_pub -h localhost -p 1883 -t "sensors" -m '{"serialNumber":"SN-001", "model":"T1000", "temperature":36.6}'
我希望也可以导入原始数据,即没有json格式,因为我已经有许多数据主题与原始数据有效负载 . 所以,只是原始的ascii编码值 . 所以,像这样: mosquitto_pub -h localhost -p 1883 -t "sensors/livingroom/temperature" -m '36.6'
IOT网关是否可以,如果是这样,配置会是什么样的?
1 回答
这是可能的,但您需要实现新的转换器类型 . 我们拥有的是使用JSON . 您可以实现自己的接受二进制数据的转换器 . 因此,您的配置看起来与此类似: