У меня ThingsBoard работает на rpi3, и мне не повезло подключить брокера MQTT от комаров к ThingsBoard через шлюз Thingsboard IOT. Я могу видеть данные от брокера с помощью MQTT_spy, поэтому я знаю, что он публикуется, журнал TB показывает, что он подключается к брокеру.
Журнал коннектора показывает, что что-то не так, но я не могу расшифровать. Любые указатели или предложения будут с благодарностью.
pi@ThingsBoard:/var/log/thingsboard-gateway $ cat connector.log
''2020-04-18 07:29:09' - DEBUG - tb_logger - 37 - Added remote handler to log extension'
''2020-04-18 07:29:09' - DEBUG - tb_logger - 37 - Added remote handler to log converter'
''2020-04-18 07:29:09' - DEBUG - tb_logger - 37 - Added remote handler to log connector'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 138 - MQTT Broker Connector connected to 192.168.0.30:1883 - successfully.'
''2020-04-18 07:29:09' - DEBUG - mqtt_connector - 139 - Client <paho.mqtt.client.Client object at 0x75c62c90>, userdata None, flags {'session present': 0}, extra_params ()'
''2020-04-18 07:29:09' - ERROR - mqtt_connector - 166 - Invalid subscription filter.'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/mqtt/mqtt_connector.py", line 159, in _on_connect
self.__subscribe(mapping["topicFilter"])
File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/mqtt/mqtt_connector.py", line 122, in __subscribe
message = self._client.subscribe(topic)
File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1311, in subscribe
raise ValueError('Invalid subscription filter.')
ValueError: Invalid subscription filter.
''2020-04-18 07:29:09' - ERROR - mqtt_connector - 166 - Invalid subscription filter.'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/mqtt/mqtt_connector.py", line 159, in _on_connect
self.__subscribe(mapping["topicFilter"])
File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/mqtt/mqtt_connector.py", line 122, in __subscribe
message = self._client.subscribe(topic)
File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1311, in subscribe
raise ValueError('Invalid subscription filter.')
ValueError: Invalid subscription filter.
''2020-04-18 07:29:09' - DEBUG - mqtt_connector - 146 - Custom converter for topic /var1/+ - found!'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 162 - Connector "MQTT Broker Connector" subscribe to /var1/+'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 192 - "MQTT Broker Connector" subscription success to topic /var1/+, subscription message id = 1'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 192 - "MQTT Broker Connector" subscription success to topic sensor/connect, subscription message id = 2'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 192 - "MQTT Broker Connector" subscription success to topic sensor/+/connect, subscription message id = 3'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 192 - "MQTT Broker Connector" subscription success to topic sensor/disconnect, subscription message id = 4'
''2020-04-18 07:29:09' - INFO - mqtt_connector - 192 - "MQTT Broker Connector" subscription success to topic sensor/+/disconnect, subscription message id = 5'
pi@ThingsBoard:/var/log/thingsboard-gateway $
tb_gateway.yaml
thingsboard:
host: demo.thingsboard.io
port: 1883
remoteConfiguration: false
security:
accessToken: 48JZBOorporxNGkeIyz3
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
========================
mqtt.json
{
"broker": {
"name":"Default Local Broker",
"host":"192.168.0.30",
"port":1883,
"security": {
"type": "basic",
"username": "xxxx",
"password": "xxxx"
}
},
"mapping": [
{
"topicFilter": "#",
"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}"
}
]
}
},
…….