Navigation: Settings > Data sources >
This data source is an MQTT client that connects to another MQTT broker, then subscribes to the specified values and transmits data between the sources.
Fig. 11. MQTT.
Broker - the program allows you to set up a connection to one or more brokers at the same time. Choose a connection from the list of previously configured brokers, or use the Add button to set up a new connection to the broker (Fig. 12). The other buttons in the window are used to change connection settings and delete connections.
Tag Name - the function enables you to specify the path and name of a value on the MQTT broker. The "/" character is used as a separator in the path.
Data Type - since all data on the MQTT broker are presented in the text form, the data type is not specified, but the program expects that the format of the values should be matching those specified in the connection settings.
Retain - when sending data to an MQTT broker, the program will set a Retain flag, which indicates to the broker that it is necessary to save the last received value.
QoS - in this field you can specify priority of a value from 1 (regular) to 4 (maximum).
JSON Value - oftentimes, a single tag in an MQTT broker stores a text representation of an object in JSON format, which may contain multiple values. JSON format allows you to unify the format for storing values, thus reducing the number of individual tags on an MQTT broker, which may be appropriate in complex applications. The value specified in this field defines the name of the value in the JSON string. When receiving data from a broker by subscription, the program will automatically locate the specified value and convert the data type. When sending data, the program will only change this value.
Fig. 12. Broker connection settings.
Name is a text description of a broker that is displayed in the list, as in fig. 11.
IP Address and Port are the IP address or URL of the broker on a local network or the Internet. A broker port name uses a colon as a separator.
Login and Password - the function enables authorization in the case a broker does not allow anonymous connections.
Enable Secure Connection Mode – the function encrypts all traffic between the program and the broker. This encryption uses a set of certificates and keys.
Certificate of Certification Authority (CA) - a file that must be provided by a broker's administrator.
Client Certificate and Private Key of the Client are generated by the user. To achieve that, you can use an OpenSSL utility (not included in the scope of supply). Also, to better protect the connection, it is possible to specify the client's public key on the broker.
Data Format Settings (Fig. 13) are used when converting values into a string in order to transmit them to an MQTT broker. These settings do not apply to values in JSON format.
Fig. 13. Data format.