[HELP]Local MQTT connector `ModuleMQTT` (configuration `moduleMqtt.json`) is not loaded when `remoteConfiguration` is false
Describe the issue
I am running ThingsBoard IoT Gateway on an embedded ARM Linux board (Buildroot-based, Rockchip RK3566).
During development, I configured and tested an MQTT connector using Remote Configuration in the ThingsBoard UI. It worked correctly.
Now I want to productize this connector so that all gateways use a local connector configuration instead of remote configuration.
I did the following:
- Copied the working MQTT connector configuration from remote configuration to a local file
moduleMqtt.jsonunder/etc/thingsboard-gateway/config/. - Updated
/etc/thingsboard-gateway/config/tb_gateway.jsonto register this connector:"connectors": [ { "type": "mqtt", "name": "ModuleMQTT", "configuration": "moduleMqtt.json" } ] - Set
"remoteConfiguration": falseintb_gateway.jsonbecause I want to use only local configuration. - Started the gateway manually with:
thingsboard-gateway
Expected behavior
- The local MQTT connector
ModuleMQTTshould be loaded on startup. - I expect to see log lines like
Starting MQTT connector ModuleMQTT ...and connector-specific logs inconnector.log. - In statistics,
connectorsStatsshould contain an entry forModuleMQTT. - The gateway should try to connect to the external MQTT broker defined in
moduleMqtt.json.
Actual behavior
- The gateway itself starts successfully and connects to ThingsBoard, but the local MQTT connector does not appear to be loaded.
- Console output shows messages like:
Connector with id c5cdde8b-9ca5-4035-b4f5-b3fe261ccc0f not found, trying to use default connector... Connector with id c5cdde8b-9ca5-4035-b4f5-b3fe261ccc0f not found, trying to use default connector... Connector with id c5cdde8b-9ca5-4035-b4f5-b3fe261ccc0f not found, trying to use default connector... Cannot use TLS connection on this port. Client will try to connect without TLS. [STRLAN ONLY] 2025-12-08 16:58:38,277 - INFO - tb_gateway_service - Start checking new gateway attributes... [STRLAN ONLY] 2025-12-08 16:58:38,284 - INFO - tb_gateway_service - Gateway core started [STRLAN ONLY] 2025-12-08 16:58:38,293 - INFO - tb_gateway_service - Gateway connected to ThingsBoard [STRLAN ONLY] 2025-12-08 16:58:38,303 - INFO - tb_gateway_service - Persistent device storage created [STRLAN ONLY] 2025-12-08 16:58:38,305 - INFO - tb_gateway_service - Gateway started. [STRLAN ONLY] 2025-12-08 16:58:38,319 - INFO - statistics_service - Collected requests statistics... connectorsStatsis always{}, which suggests that no connector is actually active.- I do not see any log line indicating that
ModuleMQTTis started, nor any connection attempts to the external MQTT broker defined inmoduleMqtt.json. - The UUID
c5cdde8b...looks like it belongs to an old remotely-configured connector. My understanding, however, is that when"remoteConfiguration": falseis set, the gateway should ignore any remote connector definitions and only use the localconnectorsarray fromtb_gateway.json.
So the core issue is:
Even though the local MQTT connector
ModuleMQTT(configuration filemoduleMqtt.json) is correctly listed intb_gateway.jsonand the file exists in the config directory, it is not loaded/started when using local configuration mode.
Hi @JamesLebron, thanks for your interest in ThingsBoard IoT Gateway! We will try to reproduce your issue and let you know about the result. So, let's stay in touch!
Hello ThingsBoard Team,
I would like to provide supplementary details regarding my specific use case and test results to help diagnose the issue.
Environment
- ThingsBoard IoT Platform: 4.2.1 (Docker Deployment -
docker pull thingsboard/tb-postgres:4.2.1) - ThingsBoard Gateway: 3.8.0
Use Scenario
- Runtime: Embedded Linux running ThingsBoard Gateway via Python source code.
- Devices: Two Linux applications running within the embedded Linux system act as virtual devices.
- Connectivity: These two virtual devices connect to the Gateway using the official MQTT Connector.
- Status: The MQTT connector has been fully configured with the required business parameters.
Note: Based on this scenario, the complete solution has been tested and verified locally.
Expected Deployment Flow
I aim to perform a batch deployment based on the verified solution:
- File Preparation: Place the two core configuration files into the embedded file system:
tb_gateway.json(Includes host, remoteShell, remoteConfiguration, storage, grpc, connectors, etc.)mqtt_connector.json(Specific MQTT configuration)
- Auto-Provisioning: On the first run, the Gateway should automatically initialize itself (create a Gateway device on the Platform) using the
provisioningsection intb_gateway.json."provisioning": { "type": "ACCESS_TOKEN", "deviceName": "Gateway-xxxxxxxxxxxx", "provisionDeviceKey": "xxxxxxxxxxxx", "provisionDeviceSecret": "xxxxxxxxxxxx" } - Config Sync (Gateway): After initialization, with
remoteConfiguration=true, the Gateway should automatically sync settings (remoteShell, storage, grpc, connectors, etc.) fromtb_gateway.jsonto the IoT Platform. - Config Sync (Connectors): The Gateway should automatically load
mqtt_connector.jsonand sync the verified MQTT configuration to the IoT Platform viaremoteConfiguration=true.
Actual Test Results (Provisioning Flow)
1. Success:
- The Gateway auto-provisioning process works correctly.
2. Anomalies/Bugs:
- (1) Version Missing: The IoT Platform does not display the Gateway software version.
- (2) Gateway Config Sync Failure: Configurations in
tb_gateway.json(remoteShell, remoteConfiguration, storage, grpc, connectors) are not synced to the IoT Platform. When I attempt to modify these configurations on the IoT Platform, the Gateway only logs the following:tb_gateway_service - __process_remote_logging_update - 693 - Remote logging level set to: NONE - (3) Connector Sync Failure:
mqtt_connector.jsonis not loaded or synced to the IoT Platform (no connectors are displayed in the dashboard).- If I manually create a connector on the IoT Platform, the UI shows "Success", but the Gateway outputs no logs/response.
Additional Investigation (Access Token Flow)
Suspecting the issue might be related to the auto-provisioning process, I adjusted the workflow for testing. I manually created a Gateway device on the platform and configured tb_gateway.json to log in using the security section (Access Token).
1. Results:
- Login: Successful. The IoT Platform correctly displays the Gateway version.
- Gateway Config Sync: Configurations in
tb_gateway.json(remoteShell, storage, grpc, etc.) are successfully synced to the IoT Platform. Modifying configurations (e.g., storage) on the platform syncs back to the Gateway correctly.
2. Remaining Issues:
- Connector Sync Failure Persists:
mqtt_connector.jsonis still not loaded/synced to the IoT Platform (no connectors displayed). - If I manually create an MQTT connector on the IoT Platform, the UI shows success. However, when I try to modify the connector configuration, it does not sync to the Gateway. Instead, I receive the following error log:
Cannot find separated report strategy for connector 'TEST_MQTT_CONNECOTR'. The main report strategy will be used as a connector report strategy.
Summary Table
I have compiled a comparison table of the test results below:
| Feature | Auto-Provisioning Flow | Manual Access Token Flow |
|---|---|---|
| Login/Connection | Success | Success |
| Version Display | Failed (Not shown) | Success |
| Main Config Sync (tb_gateway.json) | Failed | Success |
| Connector Config Sync (mqtt_connector.json) | Failed | Failed (with error log) |
Log
Provisioning Flow
Access Token Flow
Hi @JamesLebron, you have to execute the following commands:
sudo chown thingsboard_gateway:thingsboard_gateway /etc/thingsboard-gateway/config/your-connector-configuration.json
sudo chmod 644 /etc/thingsboard-gateway/config/your-connector-configuration.json
sudo systemctl restart thingsboard-gateway
Let me explain:
- You created a connector configuration file as a root user or different from
thingsboard_gateway - Gateway service doesn't have access to this file because the owner is different
- You need to update the rights to this file or create configuration files under the
thingsboard_gatewayuser
We will mention this situation in the documentation.
After initialization, with remoteConfiguration=true, the Gateway should automatically sync settings (remoteShell, storage, grpc, connectors, etc.) from tb_gateway.json to the IoT Platform.
It is not possible, because if you have remote configuration enabled, a higher priority has remote settings. Also, we mentioned this in the official documentation.
@JamesLebron, also this can help you: https://github.com/thingsboard/thingsboard-gateway/issues/2034#issuecomment-3645717934