[HELP] Dockerized Thingsboard + Thingsboard Gateway -> New device created but no data is published
See original GitHub issueDescribe 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)
- 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
- 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:
- Created 3 years ago
- Comments:12 (4 by maintainers)
Hi @tmontanaro,
Thank you for your feedback, I will try to repeat this issue tomorrow and write to you.
@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 😃