我正在尝试使用Thingsboard网关从Thingsboard中的SigFox设备接收数据。然而,尽管我在任何地方都没有收到任何错误,但Thingsboard仪表板上根本看不到数据。
我按照下面的说明设置网关:
https://thingsboard.io/docs/iot-gateway/getting-started/
为了不等待实际的设备传输,我用一个原始的cURL调用替换了SigFox生成的数据回调。
我的网关配置(tb-gateway.yml)如下所示:
server:
# Server bind address
# address: "0.0.0.0"
address: "10.133.18.123"
# Server bind port
port: "9090"
# Check new version updates parameters
updates:
# Enable/disable updates checking.
enabled: "${UPDATES_ENABLED:true}"
gateways:
tenants:
-
label: "Tenant"
reporting:
interval: 60000
persistence:
type: file
path: storage
bufferSize: 1000
connection:
host: "${GATEWAY_HOST:10.133.18.122}"
port: 1883
retryInterval: 3000
maxInFlight: 1000
security:
accessToken: "${GATEWAY_ACCESS_TOKEN:o84vmEizpHrmDXdOe4Zd}"
remoteConfiguration: true
sigfox.enable: true
sigfox.configuration: sigfox-config.json
extensions:
-
id: "sigfox"
type: "SIGFOX"
extensionConfiguration: sigfox-config.json然后,包含Thingsboard转换器的sigfox扩展(sigfox-config.json)如下所示:
{
"deviceTypeConfigurations": [
{
"deviceTypeId": "08361da0-02f8-11e9-9bcd-09e3ecf51872",
"token": "o84vmEizpHrmDXdOe4Zd",
"converters": [
{
"deviceNameJsonExpression": "${$.device}",
"attributes": [
{
"type": "string",
"key": "lat",
"value": "${$.lat}"
},
{
"type": "string",
"key": "lng",
"value": "${$.lng}"
}
],
"timeseries": [
{
"type": "double",
"key": "temperature",
"value": "${$.data.temperature}",
"transformer": {
"type": "intToDouble"
}
},
{
"type": "double",
"key": "humidity",
"value": "${$.data.humidity}",
"transformer": {
"type": "intToDouble"
}
}
]
}
]
}
]
}我使用的cURL调用是:
curl --verbose -H 'content-type: application/json' -H 'Authorization: Basic
o84vmEizpHrmDXdOe4Zd' -d '{"device": "2BFEC3", "lat":"19.1", "lng":"99.1",
"temperature":"11", "humidity":"22"}'
http://10.133.18.123:9090/sigfox/08361da0-02f8-11e9-9bcd-09e3ecf51872/cURL调用返回HTTP200成功调用,但是Thingsboard仪表板没有显示任何具有cURL调用中指定的名称的新设备,也没有在以前存在的设备的最新遥测选项卡中显示输入数据。
任何帮助都是非常感谢的。
感谢和问候!
发布于 2018-12-20 09:46:57
我已经解决了这个问题!我所做的是从tb-gateway.yml文件中删除sigfox选项,并将当前的sigfox扩展替换为默认的HTTP扩展,即:
id: "http"
type: "HTTP"
extensionConfiguration: http-config.json稍后,http-config.json文件包含与sigfox-config.json文件相同的内容。
按如下方式填写新的扩展名:
HTTP令牌扩展id: myExtension
->转换器
${$.device}
->属性//按照http-config.json文件中的描述
->时间序列
最后,使用以下原始cURL调用刷新并尝试扩展:
curl --verbose -H 'content-type: application/json' -H 'Authorization: o84vmEizpHrmDXdOe4Zd' -d '{"device": "2BFEC3", "type": "default", "lat":"19.1", "lng":"99.1", "temperature":"11", "humidity":"22"}' http://10.133.18.123:9090/sigfox/08361da0-02f8-11e9-9bcd-09e3ecf51872/瞧,瞧!
玩得开心!
https://stackoverflow.com/questions/53842846
复制相似问题