abstractMqttDriver-AbstractMqttDevice

This driver supports four MQTT device components that communicate with the broker: AbstractMqttDevice, DefaultMqttDevice, AwsMqttDevice and GcpMqttDevice. The only difference among them is that the AbstractMqttDevice does not provide communication security, which means that it does not include an authenticator component. You configure the device by setting its properties to match the settings for the broker.

Figure 1. DefaultMqttDevice properties


To access these properties, expand Config > Drivers and double-click a device object in the Nav tree.

In addition to the standard properties (Status, Enabled, Fault Cause, Health, Alarm Source Info, and Poll Frequency), these properties are unique to these components.

PropertyValueDescription
Message for L W Tread-onlyReports the Last Will and Testament (last known good value) when an unexpected error occurs.
Clean Sessiontrue or false (default)Controls the persistence of the session between broker and client.

true enables a clean session that is not persistent. All information is lost when the client disconnects from the broker for any reason.

false disables the clean session creating a persistent session. The driver preserves this session until the client requests a clean session again. If a session is already available, the driver uses it and delivers any queued messages to the client.

Enable L W Ttrue or false (default)Turns on (true) and off (false) the Last-Will-and-Testament feature.
Topic for L W Tread-onlyReports the topic that contains the Last Will and Testament value.
Qos for L W Tdrop-down list
Defines the Qos (Quality of Service) level, which configures how persistently the broker and client attempt to ensure that a message is received.

Fire And Forget (0) delivers the message once with no confirmation.

Atleast Once (1) delivers the message at least once with confirmation required.

Exactly Once (2) delivers the message exactly once by using a four-step handshake.

Messages may be sent at any Qos level, and clients may attempt to subscribe to topics at any Qos level.

Retained for L W Ttrue (default) or false
Configures the broker to save the message for the specified topic as its Last Will and Testament (last known good value).

It is useful for newly-connected subscribers to receive the last retained message for the topic immediately after subscribing and extremely helpful to provide status updates from components and devices on individual topics.

Keep AlivesecondsDefines the longest period during which the broker and client can remain connected without sending a message. The broker must disconnect a client that does not send a PINGREQ (ping request) or another message within this period.

To ensure that the connection remains open and both client and broker remain connected, the client sends this time interval to the broker during the establishment of the connection. This provides Abstract MQTT with a work-around for the issue of half-open connections.

Connection TimeoutsecondsSpecifies the maximum amount of time the client waits after sending a request to the broker.
Status MessagetextReports the current status of the component.
PointsfolderContains the discovered points.
Send Enum Asdrop-down list (defaults to TAG)Configures how to transmit an enum value.

TAG

ORDINAL

authenticator (available using DefaultMqttDevice component only)additional propertiesDefines the authenticator component to use for this device. An authenticator secures the connection between the client and broker.

Actions

These actions are available on both components. To perform an action, right-click the device in the Nav tree and click Actions followed by selecting the action.

ActionDescription
PingThis checks the device status.
ConnectEstablishes a connection with a broker.
DisconnectDisconnects session with a broker.
Subscribe allSubscribes clients for all topics.
Unsubscribe allUnsubscribes clients from all topics

The Ip address, Client ID, and port number of the broker must be entered for Connect and Disconnect actions to work.