Add MQTT Publisher
Configure a MQTT Publisher to publish messages to MQTT Broker defined Topic. Any MQTT client subscribed to that Topic receives the messages.
TIP:
The publisher only supports scalar variables. Arrays, UDTs, and other non-scalar variables are not supported.
- In Project view, right-clickMQTT, selectNew, and selectMQTT Publisher.
- InProperties, configure the following properties:
- Sampling mode
- None.automatic recording is disabled, can record by invoking the Sample method;
- Periodic. at regular intervals records the values of all the selected variables;
- Change in value. at regular intervals records only the values of the selected variables that have changed with respect to the previous sampling.
- Sampling period
- Interval in hours, with millisecond precision, between one sampling and the next, in the Periodic mode.
- Pooling time
- Interval in hours, with millisecond precision, between one sampling and the next, in the Value change mode.
- Folder
- This folder contains variables whose values will be sent to the broker. The Folder node must be a global object and cannot be a session-based object.
- Topic
- Defines MQTT topic on which we are sending/publishing data. (Topic is required. Once topic is empty Publisher will generate warrning message during first publish. RT will not stop and other mqtt functions will keep working, only this specific Publisher will be stopped.)
- QoS
- MQTT Quality of Service (QoS), defines the guarantee of delivery for a specific message (0, 1, 2).0 - At most once (May lose messages).1 - At least once (Guarantees the message delivery but potentially duplicate messages).2 - Exactly once (Ensures messages are delivered exactly once without duplication).
- Retain
- Retain message on the topic even after read
- True - Enables Retain functionality
- False - Disables Retain functionality
In
Project view
, in the MQTT
folder, the MQTT Publisher
object appears.Provide Feedback