MQTT Clients¶
The MQTT connector can be configured to function as one or more MQTT client(s) using MQTT protocol version 3.1.1 features with MQTT 3.1.1 or MQTT 5.0 brokers. Each client may have different configuration settings.
Add MQTT Client¶
To add a client, select the “Clients” navigation node and press the “Add” toolbar button. This will add a new MQTT client with default configuration settings. Rename the client to suit.
Client Settings¶
After selecting the client’s “Configuration” node, edit the following settings as required.
- Name
Choose any name.
- Client ID
Configure the MQTT client ID. This is the client ID that is sent to the MQTT broker.
- Use name as client ID
If checked, then the name of the MQTT client will also be used as the client ID that is sent to the MQTT broker.
- Transport
Select TCP or WebSocket transport to connect to the MQTT broker.
- Broker Host
For TCP, enter the host name or IP address of the MQTT broker, for example “localhost”.
For WebSockets, enter the WebSocket URL and any non-default port of the MQTT broker, excluding any protocol prefix, for example “example.com:8443/mqtt”.
- Port
Enter the TCP port of the broker (applicable to TCP transport only; for WebSockets, the port is configured as part of the WebSocket URL).
- Use encryption (TLS)
Check this option to encrypt traffic between the client and the server (the broker must support encrypted connections).
- Send client certificate
Check this option if the broker requires client certificate authentication. The configured client certificate will be sent to the broker to establish connections.
- Accept any server certificate
If the server uses a self signed certificate or a certificate that is not issued by a trusted certificate authority, then connections may fail. Check this option to accept connections regardless.
- Send credentials
If the server expects username and password authentication then check this option to send the configured credentials to the server.
After configuring the above you can try to establish a connection to the broker by pressing the “Test Connection” button.
Warning
Testing the connection will send the client ID to the broker requesting a “clean session”; this may disrupt existing connections for the configured client ID.
Client Certificate¶
Select the “Client Certificate” tab to view or configure the MQTT client certificate. The client certificate is used to identify the client to the broker when the broker requires authentication via client certificates.
By default, a client certificate issued by the configured Certificate Authority is created provided that certificate authority certificate contains the private key, otherwise a self-signed client certificate is created. Using the toolbar buttons, you have the option to create a new certificate (issued by the certificate authority or self-signed), import your own certificate (this must contain the private key), or export the current certificate (without the private key).
Diagnostics¶
Select the “Diagnostics” tab and check the selection box to optionally log MQTT messages for fault finding. Note that this may impact performance if many messages are processed.
Remove MQTT Client¶
Select the “Clients” navigation node and an MQTT client from the list on the right, then press the “Remove” toolbar button to remove the selected client. You can also right-click on an MQTT client and select “Remove” from the context menu.
Warning
Note that all topics configured for the MQTT client will be also be removed. This affects all tasks using these topics.