SIMATIC S7 Connector supports the 'Tag Write' functionality. This enables you to write a tag. You must add a topic in Databus in following format to write a tag:
ie/d/j/simatic/v1/s7c1/dp/w/<connection-name>
For example, ie/d/j/simatic/v1/s7c1/dp/w/s7plus
The JSON payload structure for Bulk subscribe is as follows:
Where, seq
: unique sequence number of the payload.
vals
: array of data points published in the payload.
id
: unique identification of data point. You must fetch the tag ID from metadata payload based on the tag name.
qc
: quality code. It is an optional field. It provides specific integer value to indicate the quality of the data point value.
For more information on qc, refer JSON structure for Alarms and Tags Data.
ts
: timestamp of the data point. It is an optional field. it is in ISO 8601 Zulu format.
val
: value of the Tag. Based on the data type of the data point, the value can be simple scalar value.
Info
You can use the metadata to get the tag id published from the SIMATIC S7 connector for 'Tag Write' functionality. You can use this tag Id in the Publisher (MQTT) to write value for that tag.
In Optimized S7-Protocol (S7-1200/1500) the maximum string length supported for string is 254. If you have configured a fixed length string datatype in TIA Portal, then you need to provide the length of the string. When configuring the tag in S7 Connector or by default the length is set to maximum which is 254 . For more information, refer section Fixed Length String Fixed Length String.
For more information on Bulk Publish, refer Bulk Publish Tags.
For more information on topic format structure, refer Topic Structure for Data and Metadata.