Message Settings Tab

You use the Message Settings tab to configure the template for the MQTT messages that are to be sent later to the MQTT server.

Payload Settings

In the upper part of the screen, you can define the following data for the MQTT messages:

Payload Settings

Field

Description

Topic Name

You enter the topic name for the MQTT message here.

The following restrictions apply when you enter the topic name:

  • It must not start with a $ character because this character is reserved for the purposes of the MQTT server.
  • It must not contain any wildcard characters, such as # or +. (See also: Wildcards in the Topic Filter.)

If you do not enter anything for the topic name here, the MQTT destination system automatically provides an input variable of the type String with the name inTopicName. In this way, the topic can be determined for the message during runtime.

You can enter a constant value or a template here. For example, if you want to determine the topic name based on the value of the input variable MachineID, you can enter the following character string, for example: Measurement recording/{MachineID}/Temperature. The string {MachineID} is then displayed as an input variable MachineID in the table of input variables. At runtime, the machine ID is read and replaced dynamically.

QoS

Quality of service: To make sure that a sent message reaches the recipient, MQTT defines three different quality of service (QoS) levels with which a message can be sent:

  • 0 - At Most Once

    This service quality level is suitable for transferring sensor data. Messages might be lost. The message reaches the recipient at most once.

  • 1 - At Least Once

    This service quality level ensures that the message reaches the recipient. The recipient might receive the message more than once.

  • 2 - Exactly Once

    This level makes sure that the message reaches the recipient exactly once.

Payload Type

Specifies the format of the MQTT messages. The following formats are supported:

  • JSON

  • XML

  • URL-Encoded

  • Formatted String

Generate Mapping from Template

You can choose the button Generate Mapping from Template to insert a specified character string in the dialog box that appears. The template generates an MQTT message that is to be sent from PCo to the MQTT server. (See: Generate Mapping from Template.)

Message Configuration Screen Area

In the lower part of the screen, you can add payload parameters if you have chosen JSON, XML, or URL-formatted as the payload type. Using the parameters you have entered, PCo generates a template for the MQTT messages. (See: Message Configuration Screen Area.)