Publish message to update multiple channel fields simultaneously with MQTT
channels/ updates a channel
feed by publishing a message to the specified topic. Replace
with your ThingSpeak channel ID. To learn more about configuring your channel, see Channel Properties. To update multiple parameters simultaneously, see Payload Parameters.
Add any necessary Payload Parameters.
PUBLISH messages to have a
Set the connection
RETAIN flag to
Set the connection
CleanSession flag to
To learn more about these flags, see the MQTT v3.1.1 specification.
<channelid>— channel ID for the publish target
Channel ID for the publish target, specified as a positive integer.
Specify the optional payload parameters for the
PUBLISH message as a string
Name=Value arguments, separated by
field1=100&field2=50&lat=30.61&long=40.35 If the
parameter definition string contains any special characters, it must be URL (percent) encoded
Data to be entered in field 1 of a channel.
Data to be entered in field x of a channel. Make sure the field is enabled in the channel settings.
x must be less than or equal to 8, the number of allowed fields.
Location of your channel in the form of latitude.
Location of your channel in the form of longitude.
Elevation of your channel from the ground level in meters.
Status message of your channel.
User name of your Twitter® account that is linked to ThingTweet app.
Status message update of your Twitter account.
tweet=Tweet from my channel
Date of feed entry in ISO 8601 format.
Configure MQTT X to send a
PUBLISH message to update a channel feed.
In the New Connection dialog, use the following connection settings, along with client ID, username, and password derived when the MQTT device was created in ThingSpeak:
Name: MyChanName Client ID: ENTER_MQTT_DEVICE_CLIENT_ID Host: mqtt:// mqtt3.thingspeak.com Port: 1883 Username: ENTER_MQTT_DEVICE_USERNAME Password: ENTER_MQTT_DEVICE_PASSWORD
In the Payload pane, use the following settings:
Topic: channels/33301/publish Payload: field1=45&field2=60&status=MQTTPUBLISH
PUBLISH message publishes a value of
field2 of channel
33301, along with a status message