CmdID

CmdID / Commands

mosquitto_pub

A simple MQTT version 3.1.1 client that will publish a single message on a topic and exit. tldr-pages

On several platforms

Opens CmdID with your command. It is read in your browser and sent nowhere.

Several platforms

from tldr-pages, CC BY 4.0

Publish a temperature value of 32 on the topic sensors/temperature to 192.168.1.1 (defaults to localhost) with Quality of Service (QoS) set to 1

mosquitto_pub --host 192.168.1.1 --topic sensors/temperature --message 32 --qos 1Identify

Publish timestamp and temperature data on the topic sensors/temperature to a remote host on a non-standard port

mosquitto_pub --host 192.168.1.1 --port 1885 --topic sensors/temperature --message "1266193804 32"Identify

Publish light switch status and retain the message on the topic switches/kitchen_lights/status to a remote host because there may be a long period of time between light switch events

mosquitto_pub --retain --host "iot.eclipse.org" --topic switches/kitchen_lights/status --message "on"Identify

Send the contents of a file (data.txt) as a message and publish it to sensors/temperature topic

mosquitto_pub --topic sensors/temperature --file data.txtIdentify

Send the contents of a file (data.txt), by reading from stdin and send the entire input as a message and publish it to sensors/temperature topic

mosquitto_pub <data.txt --topic sensors/temperature --stdin-fileIdentify

Read newline delimited data from stdin as a message and publish it to sensors/temperature topic

echo data.txt | mosquitto_pub --topic sensors/temperature --stdin-lineIdentify