...
- reading simple value types
- reading arrays (with support for the Destination column)
- writing simple value types
...
- reading of template items (UDT)
...
- reading of dataset items
The communication was tested/deployed with:
...
Parameter | Description | Unit / size | Default value | ||||||
---|---|---|---|---|---|---|---|---|---|
| Activates detailed debug information about sending and receiving values. | YES/NO | NO | ||||||
| User name used in a CONNECT message to connect to the MQTT server. | - | |||||||
| Password used in a CONNECT message to connect to the MQTT server. | - | |||||||
| The name of one topic or a multiple-topic filter sent within the SUBSCRIBE message. Using the filter the MQTT client specifies topics, within which it wants to receive messages. Note: topics are hierarchically sorted, a slash (/) is used as the separator, a plus (+) is used as a one-level mask, a hash (#) character is used as a mask for multiple levels. Examples of filter: a/b , level1/+ , # , +/+/+/up Note: the change of the Topic Filter parameter will be reflected after restarting the communication - e.g. due to the breakdown of the TCP connection, as long as all stations on the line are switched off (StOff) and switched on again, or after a restart of the KOM process. In the first two cases, the message UNSUBSCRIBE is sent to the original Topic Filter and then SUBSCRIBE to the new Topic Filter (this can be important in so-called persistent sessions when the Client ID parameter is specified and the MQTT server remembers the state of the client even after the TCP connection is broken). Note: for Payload Type=Sparkplug, the filter spBv1.0/# is sufficient to receive all Sparkplug messages. | - | # | ||||||
| The desired maximum level of validation (QoS) sent within the SUBSCRIBE message. The MQTT server can then send PUBLISH messages with such or lower levels of confirmation (but not higher). PUBLISH messages sent by the MQTT server will be confirmed by the D2000 KOM process according to the level of confirmation specified in them. The higher the level of confirmation, the more messages between the client and the server are exchanged (1 at QoS_0, 2 at QoS_1, and 4 at QoS_2). | QoS_0 QoS_1 QoS_2 | QoS_1 | ||||||
| Unique client identifier (Client Identifier) sent within the CONNECT message. The tested MQTT server (thethings.network) returned an error if the Client ID was blank and Clean Session Flag=NO. Note: Some MQTT brokers (PIXII.COM, Eclipse Mosquitto) identified clients only by Client ID. In practice, this meant that two different D2000 systems that connected to the same broker were considered as one client, and the broker closed an existing connection that it considered old when a new connection was established, or it did not allow a new connection to be created and returned the error Connection Refused, identifier rejected (2). | - | D2000kom | ||||||
| Parameter Clean Session Flag of the CONNECT message. The No value means that the server uses the current session state (connection) - e. g. after the collapse and recovery of the TCP connection. This means that all unconfirmed PUBLISH messages with QoS_1 and QoS_2 are resent (optionally also QoS_0, depending on the implementation). | YES/NO | NO | ||||||
| Level of confirmation (QoS) used to send PUBLISH messages through the D2000 KOM process. Sending the PUBLISH message is the outcome of writing into the output tag with the OUT_VALUE address. The higher the confirmation level, the more messages between the client and server are exchanged (1 for QoS_0, 2 for QoS_1, and 4 for QoS_2). | QoS_0 QoS_1 QoS_2 | QoS_0 | ||||||
| Setting the Retain flag used when sending PUBLISH messages by the D2000 KOM process. Activating the Retain flag causes the last message sent by the D2000 KOM process to be available on the MQTT server to other clients immediately after they are connected, as well as after the D2000 KOM process is disconnected. | YES/NO | NO | ||||||
| Parameter Keep Alive sent as part of a CONNECT message. The recommended Keep Alive value is several minutes. The D2000 KOM process sends PING requests according to the settings of the Keep Alive and Ping Interval parameters (whichever interval expires first). | 0-65535 sec | 0 | ||||||
| If the MQTT server did not send any message during the specified time interval, the D2000 KOM process sends a PING request and waits for a PING response (until time Reply Timeout). A value of 0 turns off sending the PING request messages. The parameter allows detection of TCP connection failure. | 0-3600 sec | 60 | ||||||
| The setting of message parsing:
| Text only | Text only | ||||||
| If Payload Type=JSON, the name of the field with a timestamp. If the field name is not specified or the field is not found, the current time is assigned to the values. For more information on the field name format, see I/O tags with addresses JA=json_address. | - | - | ||||||
| Mask for parsing a value in the field with a timestamp. Special masks are:
Note: Whether the time is interpreted as local or UTC with a configured offset depends on the time station parameters settings. | - | yyyy-mm-dd hh:mi:ss.mss | ||||||
| Ignoring a missing timestamp - if it is not present in the JSON payload, no warning will be issued. | YES/NO | NO | ||||||
| Parameter Will Flag of a CONNECT message. A value of Yes means that the server will send a Last Will message to interested parties if the connection to the D2000 KOM process is lost. Note: If Payload Type=Sparkplug and the Sparkplug Host ID parameter is not empty, this parameter is ignored and Last Will will be sent (see the description of the Sparkplug Host ID parameter). | YES/NO | NO | ||||||
| The acknowledgment level (QoS) used when sending a Last Will message in the event of a loss of connection to the D2000 KOM process. Note: If Payload Type=Sparkplug and the Sparkplug Host ID parameter is not empty, this parameter is ignored and QoS_1 level will be sent (see the description of the Sparkplug Host ID parameter). | QoS_0 QoS_1 QoS_2 | QoS_0 | ||||||
| The setting of the Retain flag used when sending a Last Will message if the connection to the D2000 KOM process is lost. Note: If Payload Type=Sparkplug and the Sparkplug Host ID parameter is not empty, this parameter is ignored and Retain is set to YES (see the description of the Sparkplug Host ID parameter). | YES/NO | NO | ||||||
| The topic used to send the Last Will message if the connection to the D2000 KOM process is lost. Note: If Payload Type=Sparkplug and the Sparkplug Host ID parameter is not empty, this parameter is ignored (see the description of the Sparkplug Host ID parameter). | - | |||||||
| Contents of the Last Will report if the connection to the D2000 KOM process is lost. Note: If Payload Type=Sparkplug and the Sparkplug Host ID parameter is not empty, this parameter is ignored (see the description of the Sparkplug Host ID parameter). | - | |||||||
| If the MQTT server does not respond to the SUBSCRIBE, UNSUBSCRIBE, and PING requests within the required time or the D2000 KOM process fails to read a complete message (and only part of it is read), the D2000 KOM process declares an error, closes the connection, and opens it again. Value 0 turns off the timeout. | sec | 20 | ||||||
| A timeout of a single reading from a TCP connection. D2000 KOM repeats reading of spontaneous data Max. Wait Retry times and if no data is read, the reading is timeouted and finished (and may be followed by a further reading or writing). By lowering Wait Timeout and Max. Wait Retry parameters, it is possible to achieve a faster writing response of the D2000 KOM process at the expense of a higher CPU load when the MQTT server has no data. | sec | 0.100 | ||||||
| The number of repetitions of reading from TCP connection. See the description of the Wait Timeout parameter. | - | 3 | ||||||
| Payload field encoding. The MQTT protocol does not specify the content of the Payload field, the ISO-8859-1 standard encoding is suitable for both text and binary content, and UTF-8 is suitable if UTF-8 encoded texts are transmitted. Currently supported encodings are:
| - | ISO-8859-1 | ||||||
Sparkplug parameters | |||||||||
| The parameter activates listings of unknown metrics and topics that do not have their own stations, but end up at a station with the address ".*" (if there is any). The listings will be in the line log as error messages even if the debug on the line is turned off (to facilitate the addition of I/O tags). | YES/NO | NO | ||||||
| Activation of parsing of non-standard SparkPlug topics. | YES/NO | NO | ||||||
| Identifier of Host Application. If specified, the D2000 KOM process will send a STATE message according to the MQTT Sparkplug standard after connecting to the MQTT server. With this message it announces that it is alive (equivalent to the NBIRTH and DBIRTH messages sent by Edge Nodes and Devices). At the same time, it sets the Will Topic/Will Message in the CONNECT message according to the Sparkplug standard, with Will QoS=QoS_1, Will Retain=YES, Clean Session Flag=YES. If the identifier is not specified, the D2000 KOM does not send the STATE message (and the Will parameters are configurable). | - | - |
...
- If there is a station with address # on the line, all messages are directed to its I/O tags and no further search is performed.
- Otherwise, all other stations on the line are searched (except the .* address). If the Topic matches the address of a station, the message is directed to that station and no further search is performed.
- Otherwise, all other stations on the line are searched (except the .* address), and their address is evaluated as a regular expression. If the Topic matches the station address, the message is directed to that station and no further search is performed.
Stations are searched in descending order (by station address), so more specific terms go first (e.g., status/battery before status/batt.*) - Finally, if there is a station with a .* address, the message is addressed to it.
| Within the metric, it is possible to define a property called Quality of type Int32. According to the Sparkplug standard, it must be one of the values 0=BAD, 192=GOOD, 500=STALE. Any other D2000 Kom process reports as an error. The Ignore Unknown Quality parameter can be used to suppress this error message. | YES/NO | NO | ||||||
| The parameter specifies which addresses of Dataset metric are displayed when browsing:
| - | Columns only | ||||||
| Separator of individual levels in Templates used when entering the address of the I/O tag in Sparkplug mode. | -> | |||||||
| Identifier of Host Application. If specified, the D2000 KOM process will send a STATE message according to the MQTT Sparkplug standard after connecting to the MQTT server. With this message it announces that it is alive (equivalent to the NBIRTH and DBIRTH messages sent by Edge Nodes and Devices). At the same time, it sets the Will Topic/Will Message in the CONNECT message according to the Sparkplug standard, with Will QoS=QoS_1, Will Retain=YES, Clean Session Flag=YES. If the identifier is not specified, the D2000 KOM does not send the STATE message (and the Will parameters are configurable). | - | - | ||||||
| Adding a textual representation of the value type (e.g. Int32) and a timestamp to the IN_SP2JS text I/O tag used to convert the Sparkplug payload to JSON. | YES/NO | NO |
Kotva | ||||
---|---|---|---|---|
|
...
- Communication protocol "MQTT Client Protocol".
- Station address: the station address corresponds to the Topic field in the PUBLISH message received from the MQTT server. The address can be a specific Topic, a regular expression, a # character representing all Topics, or a topic .* representing all Topics that are not suitable for other stations. The processing priority is as follows
:Kotva prio_processing prio_processing - If there is a station with address # on the line, all messages are directed to its I/O tags and no further search is performed.
- Otherwise, all other stations on the line are searched (except the .* address). If the Topic matches the address of a station, the message is directed to that station and no further search is performed.
- Otherwise, all other stations on the line are searched (except the .* address), and their address is evaluated as a regular expression. If the Topic matches the station address, the message is directed to that station and no further search is performed.
Stations are searched in descending order (by station address), so more specific terms go first (e.g., status/battery before status/batt.*) - Finally, if there is a station with a .* address, the message is addressed to it.
- Polling parameters on the Time parameters tab - recommended value is Delay=0.
Note: for a SparkPlug MQTT server, Topic has the form 'namespace/group_id/message_type/edge_node_id/[device_id]', where message_type indicates the message type (e.g. DDATA, DBIRTH, DDEATH).
A regular expression (e.g. spBv1.0/Sparkplug Devices/.*/MyDevice/Sensor2) can be used instead of message_type to cover all message types.
If Payload Type=Sparkplug, it is possible to omit the namespace and message_type parts and write the Topic in the abbreviated form 'group_id/edge_node_id/[device_id]' (e.g. Sparkplug Devices/MyDevice/Sensor2).
Note: If the station address is in abbreviated form, commands (DCMD, NCMD) are not processed for it. If it is in the form of a regular expression ('namespace/group_id/.*/edge_node_id/[device_id]'), the station also processes commands (including the command sent by the D2000 KOM process if Send Node Control/Rebirth=YES). Therefore, we recommend specifying the station address in abbreviated form. If it is also necessary to process commands (from other Host Applications), then create another station with an address in the form of a regular expression (e.g. spBv1.0/Sparkplug Devices/DCMD/MyDevice). Kotva komunikacna_stanica_pozn komunikacna_stanica_pozn
The Browse button opens a browse dialog for the station address. As long as the communication is functional, a dialogue containing the Topics received so far will be displayed. The list of received topics can be cleared with the Refresh button.
Double-clicking on a particular line will insert the value from the Address column into the configuration of the station from which the browse dialog was opened.
Note: The Station column shows the station to which the Topic has been assigned (based on the abovementioned processing priorities). For Sparkplug addresses, the abbreviated form of the address is displayed.
Station protocol parameters
Communication station - configuration dialog box - "Protocol parameters" tab.
They influence some of the optional parameters of the protocol.
Table 2
Keyword | Full name | Meaning | Unit | Default value | ||||||
---|---|---|---|---|---|---|---|---|---|---|
| Station Will Topic | Will topic of the device. If this parameter is set and a message with the same topic is received, the station will go into a communication error (StHardErr) and the values of the I/O tags will be invalidated. In this way, it is possible to emulate the standard behavior that occurs when there is a communication error with the device (even if the communication between the D2000 Kom process and the MQTT broker is functional). | ||||||||
| Station Will Payload | Content of the Will message. If this parameter is set and a message with the same topic as defined by the Station Will Topic parameter is received, the Payload must also be the same. If this parameter is an empty string, matching the topic with the Station Will Topic parameter is sufficient. | ||||||||
| Payload Type | The setting of message parsing (overriding the line parameter Payload Type):
| Default Text only JSON Sparkplug | Default | ||||||
| Time Field Name | If Payload Type=JSON, the name of the field with a timestamp - overriding the line parameter Time Field Name. | - | - | ||||||
| Time Mask | Mask for parsing a value in the field with a timestamp - overriding the line parameter Time Mask. Note: Whether the time is interpreted as local or UTC with a configured offset depends on the time station parameters settings. | - | - | ||||||
Sparkplug parameters | ||||||||||
| Send Node Control/Rebirth | At the start of the D2000 KOM process, a command (NCMD or DCMD) with the metric 'Node Control/Rebirth' is sent to the SparkPlug station. The response should be a message (NBIRTH/DBIRTH) with all current metrics. | YES/NO | YES |
Kotva | ||||
---|---|---|---|---|
|
...
Possible value types of I/O tags: Ci, Co, TxtI, TxtO, Qi, Ci, Co, Ai, Ao, Di, Do, TiR, ToR, TiA, ToA.
The MQTT implementation supports three work modes:
- Text mode: The original implementation of the MQTT protocol contained only input text I/O tags with the addresses IN_TOPIC, IN_DATA, and optionally a pair of I/O tags with the addresses IN_ID and ACK_ID. The first two I/O tags were used to publish the received Topic and Payload (which then needed to be parsed in the script), the second two points were used to publish the packet identifier and confirm the processing of the packet. Thus, it was possible to ensure that for data sent with QoS > QoS_0, confirmation was sent only after data processing in the script.
Output I/O tags with the addresses OUT_TOPIC and OUT_VALUE are used for writing. - JSON mode: An extension for processing Payload with JSON data (Payload Type=JSON) was implemented with the help of input I/O tags with addresses JA=json_address. The D2000 KOM process directly parses the JSON payload and sets the values of I/O tagswith JSON addresses. I/O tags with addresses IN_TOPIC, IN_DATA, IN_ID, and ACK_ID may not exist at all.
Output I/O tags with the addresses OUT_TOPIC and OUT_VALUE are used for writing.
Sparkplug mode: An extension for Payload processing with Sparkplug data (Payload Type=Sparkplug) has been implemented using input I/O tags with addresses SA=sparkplug_address. The D2000 KOM process directly parses the Sparkplug payload and sets the values of I/O tags with the Sparkplug addresses. I/O tags with addresses IN_TOPIC, IN_DATA, IN_ID, and ACK_ID may not exist at all.Kotva sparkplug_address sparkplug_address
Writing simple values is possible using output I/O tags with addresses ST=type;SA=sparkplug_address, where type is the Sparkplug definition of a data type (eg Int8, UInt16, DateTime, String, etc). The output I/O tags must be on the station with the Sparkplug address since the Topic is derived from it when writing.
Note: STATE type messages that have a JSON payload can be parsed using I/O tags with a JSON address (typically an I/O tag of Di type with an address of JA=online).
Type of I/O tag | Address | Description | ||||||
---|---|---|---|---|---|---|---|---|
I/O tags for reading data sent by the MQTT server through a PUBLISH message. Note: values of I/O tags are set by the D2000 KOM process in the order IN_TOPIC, IN_DATA, and IN_ID. It is not necessary for the configuration to contain all three I/O tags. | ||||||||
TxtI |
| Topic (Topic) of received PUBLISH message. | ||||||
TxtI |
| Data (Payload) of received PUBLISH message. | ||||||
Ci |
| Identifier of a packet (Packet Identifier) of PUBLISH message that depends on the level of validation (QoS). For messages sent with QoS_0, the identifier is zero, for QoS_1 and QoS_2, it is a positive 16-bit number. Note: if the MQTT server sends also messages with the QoS_0 level of validation and the ACK_ID I/O tag is configured, then we recommend activating the option New value when changing time in the Filter tab, so that repeated writing of the value 0 will cause a new value that differs only in a timestamp to be generated. | ||||||
I/O tag to confirm the received data to the MQTT server. | ||||||||
Co |
| If an output I/O tag with ACK_ID address is defined, the D2000 KOM expects confirmation of the processing of each message by writing a copy of the value of the IN_ID tag. Only after, it sets values from the next received PUBLISH message (if it was received in the meantime) into the IN_TOPIC, IN_DATA, and IN_ID I/O tags (in this order). In the case of the QoS_0 level of confirmation, it is, therefore, necessary to repeatedly set the value of the I/O tag ACK_ID to 0. If the I/O tag ACK_ID does not exist, the values are written into the IN_TOPIC, IN_DATA, and IN_ID I/O tags immediately after the PUBLISH message is received and processed. Note: for the messages received with the QoS_0 level of validation, no confirmation is sent to the MQTT server, only the values of the received PUBLISH message will be published. | ||||||
I/O tags for sending values to the MQTT server through a PUBLISH message. Note: in order for the D2000 KOM process to send the PUBLISH messages to the MQTT server, both I/O tags must be defined within one station. | ||||||||
TxtO |
| The topic of the PUBLISH message being sent. | ||||||
TxtO |
| Data (Payload) of the PUBLISH message being sent. Note: sending the message is performed out as a result of writing to the OUT_VALUE I/O tag (i.e. if the Topic does not change then it is sufficient to set the OUT_TOPIC point once - e.g. by using default value). | ||||||
I/O tags for parsing JSON messages | ||||||||
TxtI, TxtO, Qi, |
| If Payload Type=JSON, the message is parsed as JSON data. The json_address value specifies the name of the JSON field whose value is to be assigned to the I/O tag. For other examples, see the description of the LoRaWAN protocol's Envelope type I/O tags. | ||||||
I/O tags for parsing Sparkplug messages | ||||||||
TxtI, TxtO, Qi, |
SA=sparkplug_address Output I/O tags: | If Payload Type=Sparkplug, the message is parsed as Sparkplug data (a binary format built on Google Protocol Buffers). Sparkplug data contains metrics that have text identifiers (sparkplug_address). Reading template items is possible by specifying sparkplug_address in the format <TemplateName1><Separator><TemplateName2><Separator> ... <Separator><ItemName> where:
Examples of template item addresses: Reading dataset items (equivalent to structured variables in D2000) is possible by specifying sparkplug_address in the format <DatasetName>[<Row>]^<ColumnName> where:
Examples of dataset item addresses: For output I/O tags, the value type must be specified. Simple types are supported (not template items/dataset items):
The PUBLISH message created during writing contains a Topic derived from the station address. The message type depends on the station address - whether it is Edge Node (NCMD) or Device/Sensor (DCMD). The Payload contains a timestamp, a value type (type), a written value (encoded according to the specified value type), and a metric name (sparkplug_address). | ||||||
TxtI |
| The I/O tag is used to convert the Sparkplug payload into a JSON representation, which can then be processed, e.g. in ESL script. Depending on the Convert Datatype/Timestamp to Text parameter, a textual representation of the value type and timestamp is also added. {"metrics":[{"datatype":3,"int_value":7338992,"name":"Corrected Vol Acc Stn","timestamp":1729664005479}],"seq":32,"timestamp":1729664005479} { An example of a more complex value containing properties and a dataset and also displaying a textual representation of the data type (datatype_txt) and timestamp (timestamp_txt) as a result of the set parameter Convert Datatype/Timestamp to Text: { |
...
Note: for a SparkPlug MQTT server, Topic has the form 'namespace/group_id/message_type/edge_node_id/[device_id]', where message_type indicates the message type (e.g. DDATA, DBIRTH, DDEATH).
A regular expression (e.g. spBv1.0/Sparkplug Devices/.*/MyDevice/Sensor2) can be used instead of message_type to cover all message types.
If Payload Type=Sparkplug, it is possible to omit the namespace and message_type parts and write the Topic in the abbreviated form 'group_id/edge_node_id/[device_id]' (e.g. Sparkplug Devices/MyDevice/Sensor2).
...
The Browse button opens a browse dialog for the station address. As long as the communication is functional, a dialogue containing the Topics received so far will be displayed. The list of received topics can be cleared with the Refresh button.
Double-clicking on a particular line will insert the value from the Address column into the configuration of the station from which the browse dialog was opened.
Note: The Station column shows the station to which the Topic has been assigned (based on the abovementioned processing priorities). For Sparkplug addresses, the abbreviated form of the address is displayed.
Station protocol parameters
Communication station - configuration dialog box - "Protocol parameters" tab.
They influence some of the optional parameters of the protocol.
Table 2
...
Meaning
...
Will topic of the device. If this parameter is set and a message with the same topic is received, the station will go into a communication error (StHardErr) and the values of the I/O tags will be invalidated. In this way, it is possible to emulate the standard behavior that occurs when there is a communication error with the device (even if the communication between the D2000 Kom process and the MQTT broker is functional).
...
Content of the Will message. If this parameter is set and a message with the same topic as defined by the Station Will Topic parameter is received, the Payload must also be the same. If this parameter is an empty string, matching the topic with the Station Will Topic parameter is sufficient.
Note: this parameter was implemented due to MQTT brokers sending messages with the same Topic when connecting/disconnecting the device, the difference being only in the Payload.
...
The setting of message parsing (overriding the line parameter Payload Type):
- Default - the line parameter Payload Type is respected
- Text only - the message is not parsed, it is assigned to the I/O tag with the address IN_TOPIC
- JSON - the message is parsed as JSON data. If there is an I/O tag with the address IN_TOPIC, the whole message will be assigned to it.
If there are I/O tags with addresses JA=json_address, they will be populated with the appropriate data from the JSON message. If no such addresses exist in the message, the I/O tags will be invalidated. - Sparkplug - the message is parsed as Sparkplug B payload (binary coded).
...
Time Field Name
...
Mask for parsing a value in the field with a timestamp - overriding the line parameter Time Mask.
Note: Whether the time is interpreted as local or UTC with a configured offset depends on the time station parameters settings.
...
Sparkplug parameters
...
At the start of the D2000 KOM process, a command (NCMD or DCMD) with the metric 'Node Control/Rebirth' is sent to the SparkPlug station. The response should be a message (NBIRTH/DBIRTH) with all current metrics.
...
Possible value types of I/O tags: Ci, Co, TxtI, TxtO, Qi, Ci, Co, Ai, Ao, Di, Do, TiR, ToR, TiA, ToA.
The MQTT implementation supports three work modes:
- Text mode: The original implementation of the MQTT protocol contained only input text I/O tags with the addresses IN_TOPIC, IN_DATA, and optionally a pair of I/O tags with the addresses IN_ID and ACK_ID. The first two I/O tags were used to publish the received Topic and Payload (which then needed to be parsed in the script), the second two points were used to publish the packet identifier and confirm the processing of the packet. Thus, it was possible to ensure that for data sent with QoS > QoS_0, confirmation was sent only after data processing in the script.
Output I/O tags with the addresses OUT_TOPIC and OUT_VALUE are used for writing. - JSON mode: An extension for processing Payload with JSON data (Payload Type=JSON) was implemented with the help of input I/O tags with addresses JA=json_address. The D2000 KOM process directly parses the JSON payload and sets the values of I/O tagswith JSON addresses. I/O tags with addresses IN_TOPIC, IN_DATA, IN_ID, and ACK_ID may not exist at all.
Output I/O tags with the addresses OUT_TOPIC and OUT_VALUE are used for writing. - Sparkplug mode: An extension for Payload processing with Sparkplug data (Payload Type=Sparkplug) has been implemented using input I/O tags with addresses SA=sparkplug_address. The D2000 KOM process directly parses the Sparkplug payload and sets the values of I/O tags with the Sparkplug addresses. I/O tags with addresses IN_TOPIC, IN_DATA, IN_ID, and ACK_ID may not exist at all.
Writing simple values is possible using output I/O tags with addresses ST=type;SA=sparkplug_address, where type is the Sparkplug definition of a data type (eg Int8, UInt16, DateTime, String, etc). The output I/O tags must be on the station with the Sparkplug address since the Topic is derived from it when writing.
Note: STATE type messages that have a JSON payload can be parsed using I/O tags with a JSON address (typically an I/O tag of Di type with an address of JA=online).
Type of I/O tag | Address | Description | ||
---|---|---|---|---|
I/O tags for reading data sent by the MQTT server through a PUBLISH message. Note: values of I/O tags are set by the D2000 KOM process in the order IN_TOPIC, IN_DATA, and IN_ID. It is not necessary for the configuration to contain all three I/O tags. | TxtI | |||
Kotva | in_topic | in_topic | IN_TOPICTopic (Topic) of received PUBLISH message. | TxtI |
Kotva | in_data | in_data | IN_DATAData (Payload) of received PUBLISH message. | Ci |
Kotva | in_id | in_id | IN_IDIdentifier of a packet (Packet Identifier) of PUBLISH message that depends on the level of validation (QoS). For messages sent with QoS_0, the identifier is zero, for QoS_1 and QoS_2, it is a positive 16-bit number. Note: if the MQTT server sends also messages with the QoS_0 level of validation and the ACK_ID I/O tag is configured, then we recommend activating the option New value when changing time in the Filter tab, so that repeated writing of the value 0 will cause a new value that differs only in a timestamp to be generated. | |
I/O tag to confirm the received data to the MQTT server. | Co | |||
Kotva | ack_id | ack_id | ACK_IDIf an output I/O tag with ACK_ID address is defined, the D2000 KOM expects confirmation of the processing of each message by writing a copy of the value of the IN_ID tag. Only after, it sets values from the next received PUBLISH message (if it was received in the meantime) into the IN_TOPIC, IN_DATA, and IN_ID I/O tags (in this order). In the case of the QoS_0 level of confirmation, it is, therefore, necessary to repeatedly set the value of the I/O tag ACK_ID to 0. If the I/O tag ACK_ID does not exist, the values are written into the IN_TOPIC, IN_DATA, and IN_ID I/O tags immediately after the PUBLISH message is received and processed. Note: for the messages received with the QoS_0 level of validation, no confirmation is sent to the MQTT server, only the values of the received PUBLISH message will be published. | |
I/O tags for sending values to the MQTT server through a PUBLISH message. Note: in order for the D2000 KOM process to send the PUBLISH messages to the MQTT server, both I/O tags must be defined within one station. | TxtO | |||
Kotva | out_topic | out_topic | OUT_TOPICThe topic of the PUBLISH message being sent. | TxtO |
Kotva | out_value | out_value | OUT_VALUEData (Payload) of the PUBLISH message being sent. Note: sending the message is performed out as a result of writing to the OUT_VALUE I/O tag (i.e. if the Topic does not change then it is sufficient to set the OUT_TOPIC point once - e.g. by using default value). | |
I/O tags for parsing JSON messages | TxtI, TxtO, Qi, | |||
Kotva | ja | ja | JA=json_addressIf Payload Type=JSON, the message is parsed as JSON data. The json_address value specifies the name of the JSON field whose value is to be assigned to the I/O tag. For other examples, see the description of the LoRaWAN protocol's Envelope type I/O tags. | |
I/O tags for parsing Sparkplug messages | ||||
TxtI, TxtO, Qi, | Kotva | | sa | sa | Input I/O tags:
Note: it is also possible to monitor the status of other Sparkplug Host Applications connected to the MQTT server. If the Identifier of Host Application is e.g. "ACME", so it is necessary to create a station with the address "spBv1.0/STATE/ACME" (or in abbreviated form "ACME") and on it an I/O tag of type Di with the address "JA=online" (since the Host Application sends a STATE message with a JSON payload).
...
Double-clicking on a particular line will insert the value from the Address column into the configuration of the I/O tag from which the MQTT Item Browser window was opened. At the same time, it is also inserted into the clipboard.
The Refresh button clears the list of values in both the CNF and the KOM process and optionally sends the Rebirth command (if Send Node Control/Rebirth=YES).
...