Thingsboard Gateway SigFox-消息未到达

时间:2018-12-19 00:03:37

标签: gateway thingsboard

我正在尝试使用Thingsboard Gateway从Thingsboard中的SigFox设备接收数据。但是,尽管我在任何地方都没有出现任何错误,但在Thingsboard仪表板上根本看不到数据。

我按照以下说明设置网关:

https://thingsboard.io/docs/iot-gateway/getting-started/

为了不等待实际的设备传输,我将SigFox生成的数据回调替换为原始cURL调用。

我的网关配置(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调用以HTTP 200成功调用返回,但是Thingsboard仪表板不会显示任何具有cURL调用中指定名称的新设备,也不会在以前存在的最新遥测选项卡中显示输入数据设备。

非常感谢您的帮助。

谢谢和问候!

1 个答案:

答案 0 :(得分:1)

我已经解决了这个问题! 我要做的是从tb-gateway.yml文件中删除sigfox选项,并用默认的HTTP扩展名替换当前的sigfox扩展名,即:

id: "http"
type: "HTTP"
extensionConfiguration: http-config.json

稍后,http-config.json文件包含与sigfox-config.json文件相同的文件。 最后,这可能是我以前从未尝试过的方法,请转到Thingsboard仪表板>设备>网关>扩展,然后手动添加新的扩展。

按以下步骤填写新的扩展名:

  1. 扩展名:myExtension
  2. 扩展名类型:HTTP
  3. 转换器ID:08361da0-02f8-11e9-9bcd-09e3ecf51872
  4. 安全令牌:o84vmEizpHrmDXdOe4Zd

->转换器

  1. 设备名称表达式:$ {$。device}
  2. 设备类型表达式:$ {$。type}

->属性//按照http-config.json文件中的描述

  1. lat ...
  2. lng ...

->时间序列

  1. 温度...
  2. 湿度...

最后,使用以下原始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/

瞧瞧!您已在“物联网设备”部分中自动创建了SFX设备,并在“属性”和“遥测”选项卡中相应地接收到数据。

玩得开心!