question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[HELP] Dockerized Thingsboard + Thingsboard Gateway -> New device created but no data is published

See original GitHub issue

Describe the issue I configured Thingsboard and Thingsboard gateway to work in this way:

  • new data are pushed on 1 device that is a gateway
  • if the device does not exist, it will create it
  • push received data on the (new if it did not exist, otherwise, existing) device.

As I understand from the official documentation, this task should be done through the Thingsboard gateway and the MQTT connector. You can find all the steps followed to create such a scenario here, and the configuration in the following.

Then I tried to push new data (without creating any new converter, but by using the default one) through the following instruction: mosquitto_pub -d -h 192.168.1.215 -p 1885 -t "/sensor/data" -m '{"serialNumber":"1234", "sensorType":"Farm", "sensorModel":"ciao", "temp":12,"hum":34}'

But, even though the device is created with the right name (serialNumber) and the right Type (sensorType), no data and/or attributes are inserted inside.

Am I doing anything wrong?

Configuration (Attach your configuration file)

  1. tb_gateway.yaml
thingsboard:
  host: 172.18.0.150
  port: 1883
  remoteConfiguration: false
  security:
    accessToken: Q65vseTJreuQ8RVtqTDK
storage:
  type: memory
  read_records_count: 100
  max_records_count: 100000
#  type: file
#  data_folder_path: ./data/
#  max_file_count: 10
#  max_read_records_count: 10
#  max_records_per_file: 10000
connectors:

  -
    name: MQTT Broker Connector
    type: mqtt
    configuration: mqtt.json

#  -
#    name: Request Connector
#    type: request
#    configuration: request.json
#
#  -
#    name: Modbus Connector
#    type: modbus
#    configuration: modbus.json
#
#  -
#    name: Modbus Connector
#    type: modbus
#    configuration: modbus_serial.json
#
#  -
#    name: OPC-UA Connector
#    type: opcua
#    configuration: opcua.json
#
#  -
#    name: BLE Connector
#    type: ble
#    configuration: ble.json
#
#  -
#    name: Custom Serial Connector
#    type: serial
#    configuration: custom_serial.json
#    class: CustomSerialConnector
  1. mqtt.json
{
  "broker": {
    "name":"Default Broker",
    "host":"172.18.0.1",
    "port":1885,
    "security": {
      "type": "anonymous"
    }
  },
  "mapping": [
    {
      "topicFilter": "/sensor/data",
      "converter": {
        "type": "json",
        "deviceNameJsonExpression": "${serialNumber}",
        "deviceTypeJsonExpression": "${sensorType}",
        "timeout": 60000,
        "attributes": [
          {
            "type": "string",
            "key": "model",
            "value": "${sensorModel}"
          }
        ],
        "timeseries": [
          {
            "type": "double",
            "key": "temperature",
            "value": "${temp}"
          },
          {
            "type": "double",
            "key": "humidity",
            "value": "${hum}"
          }
        ]
      }
    },
    {
      "topicFilter": "/sensor/+/data",
      "converter": {
        "type": "json",
        "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/data)",
        "deviceTypeTopicExpression": "Thermometer",
        "timeout": 60000,
        "attributes": [
          {
            "type": "string",
            "key": "model",
            "value": "${sensorModel}"
          }
        ],
        "timeseries": [
          {
            "type": "double",
            "key": "temperature",
            "value": "${temp}"
          },
          {
            "type": "double",
            "key": "humidity",
            "value": "${hum}"
          }
        ]
      }
    },
    {
      "topicFilter": "/custom/sensors/+",
      "converter": {
        "type": "custom",
        "extension": "CustomMqttUplinkConverter",
        "extension-config": {
            "temperatureBytes" : 2,
            "humidityBytes" :  2,
            "batteryLevelBytes" : 1
        }
      }
    }
  ],
  "connectRequests": [
    {
      "topicFilter": "sensor/connect",
      "deviceNameJsonExpression": "${SerialNumber}"
    },
    {
      "topicFilter": "sensor/+/connect",
      "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/connect)"
    }
  ],
  "disconnectRequests": [
    {
      "topicFilter": "sensor/disconnect",
      "deviceNameJsonExpression": "${SerialNumber}"
    },
    {
      "topicFilter": "sensor/+/disconnect",
      "deviceNameTopicExpression": "(?<=sensor\/)(.*?)(?=\/disconnect)"
    }
  ],
  "attributeUpdates": [
    {
      "deviceNameFilter": "SmartMeter.*",
      "attributeFilter": "uploadFrequency",
      "topicExpression": "sensor/${deviceName}/${attributeKey}",
      "valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}"
    }
  ],
  "serverSideRpc": [
    {
      "deviceNameFilter": ".*",
      "methodFilter": "echo",
      "requestTopicExpression": "sensor/${deviceName}/request/${methodName}/${requestId}",
      "responseTopicExpression": "sensor/${deviceName}/response/${methodName}/${requestId}",
      "responseTimeout": 10000,
      "valueExpression": "${params}"
    },
    {
      "deviceNameFilter": ".*",
      "methodFilter": "no-reply",
      "requestTopicExpression": "sensor/${deviceName}/request/${methodName}/${requestId}",
      "valueExpression": "${params}"
    }
  ]
}

Connector name (If you need help with some connector/converter): MQTT Connector

Error traceback (If it was raised): No error: the device is created with the right type, but neither attributes nor data are inserted in the device

Versions (please complete the following information):

  • OS: Ubuntu 18.04
  • Thingsboard IoT Gateway version -> the latest installed with Docker (re-downloaded 2 hours ago)
  • Thingsboard version -> the latest installed with Docker (re-downloaded 2 hours ago)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
imbeaconcommented, Apr 2, 2020

Hi @tmontanaro,

Thank you for your feedback, I will try to repeat this issue tomorrow and write to you.

1reaction
imbeaconcommented, Apr 6, 2020

@tmontanaro

Thank you for your interest in ThingsBoard and ThingsBBoard IoT gateway. Anyway we are improved the gateway, by updating the docker image and one more time check it work in some specific environment. I will pass information about this bug to ThingsBoard’s developers and we will investigate this situation.

Thank you 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | ThingsBoard Community Edition
It is possible that the data inside the cache somehow got corrupted. Regardless of the reason, it is always safe to clear cache,...
Read more >
Request Connector Configuration | ThingsBoard IoT Gateway
Use general configuration guide to enable this Connector. The purpose of this Connector is to connect to external HTTP(S) API endpoints and get...
Read more >
Getting Started with ThingsBoard
Login to your ThingsBoard instance and open the Devices page. Click on the "+" icon in the top right corner of the table...
Read more >
IoT Gateway Configuration - ThingsBoard
Installation structure and configuration of ThingsBoard IoT Gateway. ... statistics data and sending them to ThingsBoard Gateway device attributes.
Read more >
Getting Started with ThingsBoard Cloud
Push data from devices to ThingsBoard;; Build real-time end-user dashboards;; Define thresholds and trigger alarms;; Push notification about new alarms over ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found