.ie \n(.g .ds Aq \(aq .el .ds Aq ' .TH mqttui-read-one 1 "read-one " .SH NAME mqttui\-read\-one \- Wait for the first message on the given topic(s) and return its payload to stdout .SH SYNOPSIS \fBmqttui read\-one\fR [\fB\-r\fR|\fB\-\-ignore\-retained\fR] [\fB\-p\fR|\fB\-\-pretty\fR] [\fB\-b\fR|\fB\-\-broker\fR] [\fB\-u\fR|\fB\-\-username\fR] [\fB\-\-password\fR] [\fB\-i\fR|\fB\-\-client\-id\fR] [\fB\-\-client\-cert\fR] [\fB\-\-client\-key\fR] [\fB\-\-insecure\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fITOPIC\fR] .SH DESCRIPTION Wait for the first message on the given topic(s) and return its payload to stdout. .PP Returns exactly one payload of the first received message on the given topic(s). The topic of the received message is printed to stderr. This means that you can handle stdout and stderr separately. .PP This can be helpful for scripting to get the current temperature reading and pipe it to somewhere else: .PP `echo "The temperature is $(mqttui read\-one room/temp)"` .PP The output is the exact payload in its binary form. This might be valid ASCII / Unicode but could also be something not intended to be displayed on a terminal. For a human readable format use `\-\-pretty` or `mqttui log`. .SH OPTIONS .TP \fB\-r\fR, \fB\-\-ignore\-retained\fR Do not return on a retained message on connection, wait for another message to arrive .TP \fB\-p\fR, \fB\-\-pretty\fR Parse the payload and print it in a human readable pretty form. This might not be useful for piping the data. .TP \fB\-b\fR, \fB\-\-broker\fR=\fIURL\fR [default: mqtt://localhost] URL which represents how to connect to the MQTT broker. Examples: `mqtt://localhost` `mqtt://localhost:1883` `mqtts://localhost` `mqtts://localhost:8883` `ws://localhost/path` `ws://localhost:9001/path` `wss://localhost/path` `wss://localhost:9001/path` .RS May also be specified with the \fBMQTTUI_BROKER\fR environment variable. .RE .TP \fB\-u\fR, \fB\-\-username\fR=\fISTRING\fR Username to access the mqtt broker. Anonymous access when not supplied. .RS May also be specified with the \fBMQTTUI_USERNAME\fR environment variable. .RE .TP \fB\-\-password\fR=\fISTRING\fR Password to access the mqtt broker. Consider using a connection with TLS to the broker. Otherwise the password will be transported in plaintext. Passing the password via command line is insecure as the password can be read from the history! You should pass it via environment variable. .RS May also be specified with the \fBMQTTUI_PASSWORD\fR environment variable. .RE .TP \fB\-i\fR, \fB\-\-client\-id\fR=\fISTRING\fR Specify the client id to connect with .RS May also be specified with the \fBMQTTUI_CLIENTID\fR environment variable. .RE .TP \fB\-\-client\-cert\fR=\fIFILEPATH\fR Path to the TLS client certificate file. Used together with \-\-client\-key to enable TLS client authentication. The file has to be a DER\-encoded X.509 certificate serialized to PEM. .RS May also be specified with the \fBMQTTUI_CLIENT_CERTIFICATE\fR environment variable. .RE .TP \fB\-\-client\-key\fR=\fIFILEPATH\fR Path to the TLS client private key. Used together with \-\-client\-cert to enable TLS client authentication. The file has to be a DER\-encoded ASN.1 file in PKCS#8 form serialized to PEM. .RS May also be specified with the \fBMQTTUI_CLIENT_PRIVATE_KEY\fR environment variable. .RE .TP \fB\-\-insecure\fR Allow insecure TLS connections .TP \fB\-h\fR, \fB\-\-help\fR Print help (see a summary with \*(Aq\-h\*(Aq) .TP [\fITOPIC\fR] [default: #] Topics to watch .RS May also be specified with the \fBMQTTUI_TOPIC\fR environment variable. .RE