I am using Ubuntu 20.04.1 OS with MQTT Broker installed. I followed all the instructions from the ThingsBoard Gateway website to download, install and configure the ThingsBoard Gateway. I used the first method i.e. IoT Gateway installation on Ubuntu (DEB). During this installation, an error occured, here it is.
I need the service running so that I can send the device data to the gateway which will then send it to the ThingsBoard platform.
Every time I check the status it shows its Failed. After restarting the service, it show active for a second, but upon checking again, it shows it has Failed yet again. This is what I see after restarting the service.
The log files at location /var/log/thingsboard-gateway/ are all empty. I cant even find a log file to check what exactly the issue is.
Is this some sort of library problem? Do i need to edit any config file? Do I need to reinstall everything again? I have done it a couple of times but can't get rid of the problem. I am not using multiple controller, I just want the MQTT controller.
These are the config files that I edited.
- tb_gateway.yaml
thingsboard:
host: demo.thingsboard.io
port: 1883
remoteShell: false
remoteConfiguration: false
statistics:
enable: true
statsSendPeriodInSeconds: 3600
configuration: statistics.json
minPackSendDelayMS: 0
checkConnectorsConfigurationInSeconds: 60
handleDeviceRenaming: true
checkDeviceInactivity: false
inactivityTimeoutSeconds: 120
inactivityCheckPeriodSeconds: 10
security:
accessToken: Ubuntulaptop
qos: 1
storage:
type: memory
read_records_count: 100
max_records_count: 100000
grpc:
enabled: false
serverPort: 9595
keepaliveTimeMs: 100000
keepaliveTimeoutMs: 50000
keepalivePermitWithoutCalls: true
maxPingsWithoutData: 0
minTimeBetweenPingsMs: 10000
minPingIntervalWithoutDataMs: 5000
connectors:
-
name: MQTT Broker Connector
type: mqtt
configuration: mqtt.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: REQUEST Connector
# type: request
# configuration: request.json
#
# -
# name: CAN Connector
# type: can
# configuration: can.json
#
# -
# name: BACnet Connector
# type: bacnet
# configuration: bacnet.json
#
# -
# name: ODBC Connector
# type: odbc
# configuration: odbc.json
#
# -
# name: REST Connector
# type: rest
# configuration: rest.json
#
# -
# name: SNMP Connector
# type: snmp
# configuration: snmp.json
#
# -
# name: FTP Connector
# type: ftp
# configuration: ftp.json
#
#
# ========= Customization ==========
#
#
# -
# name: Custom Serial Connector
# type: serial
# configuration: custom_serial.json
# class: CustomSerialConnector
#
# -
# name: GRPC Connector 1
# key: auto
# type: grpc
# configuration: grpc_connector_1.json
- MQTT.json
{
"broker": {
"name": "Default Local Broker",
"host": "192.168.1.102",
"port": 1883,
"clientId": "ThingsBoard_gateway",
"maxMessageNumberPerWorker": 10,
"maxNumberOfWorkers": 100,
"security": {
"type": "basic",
"username": "user",
"password": "*********"
}
},
"mapping": [
{
"topicFilter": "/sensor/data",
"converter": {
"type": "json",
"deviceNameJsonExpression": "${serialNumber}",
"deviceTypeJsonExpression": "${sensorType}",
"timeout": 60000,
"attributes": [
{
"type": "string",
"key": "model",
"value": "${sensorModel}"
},
{
"type": "string",
"key": "${sensorModel}",
"value": "on"
}
],
"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)"
}
],
"attributeRequests": [
{
"retain": false,
"topicFilter": "v1/devices/me/attributes/request",
"deviceNameTopicExpression": "${SerialNumber}",
"attributeNameJsonExpression": "${sensorModel}"
}
],
"attributeUpdates": [
{
"retain": true,
"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}"
}
]
}