pubsub
OPC UA PubSub (OPC UA Part 14) sends data to a broker, so that MQTT clients get values without an OPC UA connection. The gateway publishes JSON messages to an MQTT broker. Only the mqtt-json transport exists. A published data set is a named list of variables. A data set writer sends one published data set. A writer group sends the messages of its writers at each publishingInterval:. The gateway does not start if a published field names a node that does not exist or is not a Variable, if a writer names an unknown data set, or if a name or an id is used twice.
Example
pubsub:
publisherId: edge-01
publishedDataSets:
- name: Boiler
fields:
- name: Temperature
node: /ua:Objects/own:Boiler/own:Temperature
connections:
- name: PlantBroker
transport: mqtt-json
url: mqtt://broker.local:1883
writerGroups:
- name: Fast
writerGroupId: 1
publishingInterval: 1000
dataSetWriters:
- name: BoilerWriter
dataSetWriterId: 1
dataSet: Boiler
The value
pubsub: is the PubSub settings.
The PubSub settings
The publisher name, the data sets to publish and the brokers that receive them.
| Key | What it does | Value | Required |
|---|---|---|---|
publisherId | The name of the gateway in each message (the PublisherId). Use a value that is unique on the broker. The default is the host name of the machine. | text or whole number | |
publishedDataSets | The data sets that the writers can send. Each data set is a named list of variables. | list of published data set | |
connections | The brokers that receive the messages. Add one entry for each broker. | list of PubSub connection |
A published data set
A named list of variables that the gateway sends together.
| Key | What it does | Value | Required |
|---|---|---|---|
name | The name of the data set. A data set writer refers to it with dataSet:. The name must be unique. | text | yes |
fields | The variables of the data set. Their order is the order in the message. | list of published field | yes |
A PubSub connection
One MQTT broker that receives the messages, and the writer groups that send to it.
| Key | What it does | Value | Required |
|---|---|---|---|
name | The name of the connection. The name must be unique. | text | yes |
url | The URL of the broker, for example mqtt://broker.local:1883 or mqtts://broker.local:8883. To give a user name and a password, put them in the URL: mqtt://user:password@broker.local:1883. | text | yes |
writerGroups | The writer groups of the connection. | list of writer group | yes |
transport | The transport profile. Only mqtt-json exists: an MQTT broker and JSON messages. | mqtt-json |
A published field
One variable of a published data set.
| Key | What it does | Value | Required |
|---|---|---|---|
name | The key of the value in the JSON message. | text | yes |
node | The variable to publish, as a browse path or a NodeId, as in mapping:. The node must exist and must be a Variable. | text | yes |
samplingInterval | The time in ms between two samples of the variable. The default is the publishingInterval of the writer group. | number |
A writer group
A group of data set writers that send their messages at the same interval.
| Key | What it does | Value | Required |
|---|---|---|---|
name | The name of the writer group. | text | yes |
writerGroupId | The number of the writer group in the messages. It must be unique in the connection. | whole number | yes |
dataSetWriters | The data set writers of the group. Add one writer for each data set to send. | list of data set writer | yes |
publishingInterval | The time in ms between two messages. The default is 1000. | number | |
qos | The MQTT quality of service. atMostOnce (QoS 0) sends a message once, with no check. atLeastOnce (QoS 1) repeats it until the broker confirms. exactlyOnce (QoS 2) delivers it one time. The default is atMostOnce. | atMostOnce, atLeastOnce, exactlyOnce | |
topic | The MQTT topic of the data messages of this group. A writer can set its own topic:. The default is opcua/json/data/<publisherId>/<writerGroupId>/<dataSetWriterId>. | text |
A data set writer
The part of a writer group that sends one published data set.
| Key | What it does | Value | Required |
|---|---|---|---|
name | The name of the data set writer. | text | yes |
dataSetWriterId | The number of the writer in the messages. It must be unique for the publisher. | whole number | yes |
dataSet | The name of the published data set that this writer sends. | text | yes |
topic | The MQTT topic of the data messages of this writer. The default is the topic of the writer group. | text |