This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Publish to a Channel Field Feed

Publish message to update single channel field




channels/<channelID>/publish/fields/field<fieldnumber>/<apikey> publishes messages to the topic to update a channel field. Replace <channelID> with the channel ID, <fieldnumber> with field number that you want to update, and <apikey> with the write API key of the channel. To learn more about configuring your channel, see Channel Properties. Use this method to update a single field in a channel. To update multiple parameters simultaneously, see Payload Parameters.

  • Set the PUBLISH messages to a QoS value of 0.

  • Set the connection RETAIN flag to 0.

  • Set the connection CleanSession flag to 1.

To learn more about these flags, see MQTT v3.1.1 specification.

Input Arguments

expand all

Channel ID for the publish target, secified as a numeric.

Data Types: uint16 | int16 | int8 | uint8

Channel write API Key. The value can be found on the Channel Settings > API Keys. This value is different than the MQTT API Key used for connection, and it is different than the channel Read API Key.

Data Types: char

Field number of the Publish target, specified as a positive integer

Data Types: uint16 | int16 | int8 | uint8

Payload Parameters

Data to be entered in the specified field of a channel, specified as a string. For example: 100


Configure MQTT.fx to send a PUBLISH message to update a channel field.

Replace <channelID> with the channel ID and <apikey> with the Write API Key of the channel. This PUBLISH message publishes a value of 45 to field1 of the specified channel.