Ernesto Barbosa
Ernesto Barbosa

Reputation: 21

Thingsboard Gateway SigFox - Messages not arriving

I'm trying to receive data from SigFox devices in Thingsboard using the Thingsboard Gateway. However, althought I'm not getting any error anywhere, data is not visible at Thingsboard dashboard at all.

I setup the gateway as per described in:

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

In order not to wait for actual device transmission, I'm replacing the data callback generated by SigFox with a raw cURL call.

My Gateway configuration (tb-gateway.yml) looks like this:

 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

Then, the sigfox extension (sigfox-config.json) containing the Thingsboard converter looks like the following:

{
  "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"
              }
            }
          ]
        }
      ]
    }
  ]
}

The cURL call I'm using is:

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/

The cURL call returns with a HTTP 200 success call, however Thingsboard dashboard doesn't show any new device with a name as per specified in the cURL call, nor shows the input data in the latest-telemetry tab of a previously existing device.

Any help is greatly appreciated.

Thanks and greetings!

Upvotes: 0

Views: 462

Answers (1)

Ernesto Barbosa
Ernesto Barbosa

Reputation: 21

I already solved this issue! What I did was delete the sigfox options from the tb-gateway.yml file and replace the current sigfox extension with the default HTTP extension, which is:

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

Later on, the http-config.json file contains the same as the sigfox-config.json file. Finally, and this is probably what I haven't tried before, go to thingsboard dashboard > devices > gateway > extensions, and manually add a new extension.

Fill the new extension as follows:

  1. Extension id: myExtension
  2. Extension type: HTTP
  3. Converter id: 08361da0-02f8-11e9-9bcd-09e3ecf51872
  4. Security token: o84vmEizpHrmDXdOe4Zd

-> Converters

  1. Device name expression: ${$.device}
  2. Device type expression: ${$.type}

-> Attributes // As per described in the http-config.json file

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

-> Timeseries

  1. temperature ...
  2. humidity ...

Finally, refresh and try the extension with the following raw cURL call:

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/

And voilá! you have the SFX devices created automatically in thingsboard devices section, with the data received in the attributes and telemetry tabs correspondingly.

Have fun!

Upvotes: 1

Related Questions