我在文档和留言板中进行了搜索,但未能找到以下内容。
我正在尝试使用IOT网关将数据从mqtt导入thingsboard。
文档概述了如何配置物联网网关以导入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'
对于物联网网关,这是可能的吗?如果可能,配置会是什么样子?
发布于 2018-01-22 17:52:23
这是可能的,但您需要实现新的转换器类型。我们使用的是JSON。您可以实现自己的接受二进制数据的转换器。因此,您的配置将如下所示:
{
"topicFilter": "sensors",
"converter": {
"type": "binary",
/* whatever configuration structure that is applicable to your use case */
}
}
https://stackoverflow.com/questions/48371142
复制相似问题