mqttui-read-one(1)

NAME
mqttui-read-one - Wait for the first message on the given topic(s) and return its payload to stdout

SYNOPSIS
mqttui read-one [-r|--ignore-retained] [-p|--pretty] [--qos] [-b|--broker] [-u|--username] [--password] [-i|--client-id] [--client-cert] [--client-private-key] [--insecure] [-h|--help] [TOPIC]

DESCRIPTION
Wait for the first message on the given topic(s) and return its payload to stdout.

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.

This can be helpful for scripting to get the current temperature reading and pipe it to somewhere else:

`echo "The temperature is $(mqttui read-one room/temp)"`

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`.

OPTIONS

-r, --ignore-retained
    Do not return on a retained message on connection, wait for another message to arrive

-p, --pretty
    Parse the payload and print it in a human readable pretty form. This might not be useful for piping the data.

--qos <LEVEL> [default: 2]
    Maximum Quality of Service (`QoS`) for subscriptions and publishing. The lower Quality of Service level for publisher and subscriber is delivered from broker to subscriber. So subscribing with 0 will never receive a 1 or 2. Publishing with 2 will be received as 1 when subscribed with 1. - 0: at most once (fire and forget) - 1: at least once (acknowledged delivery with potential duplicates) - 2: exactly once (assured delivery without duplicates)
    May also be specified with the MQTTUI_QOS environment variable.

-h, --help
    Print help (see a summary with '-h')

[TOPIC] [default: #]
    Topics to watch
    May also be specified with the MQTTUI_TOPIC environment variable.

MQTT CONNECTION

-b, --broker <URL> [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`
    May also be specified with the MQTTUI_BROKER environment variable.

-u, --username <STRING>
    Username to access the mqtt broker. Anonymous access when not supplied.
    May also be specified with the MQTTUI_USERNAME environment variable.

--password <STRING>
    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.
    May also be specified with the MQTTUI_PASSWORD environment variable.

-i, --client-id <STRING>
    Specify the client id to connect with
    May also be specified with the MQTTUI_CLIENTID environment variable.

--client-cert <FILEPATH>
    Path to the TLS client certificate file. Used together with --client-private-key to enable TLS client authentication. The file has to be a DER-encoded X.509 certificate serialized to PEM.
    May also be specified with the MQTTUI_CLIENT_CERTIFICATE environment variable.

--client-private-key <FILEPATH>
    Path to the TLS client private key file. 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.
    May also be specified with the MQTTUI_CLIENT_PRIVATE_KEY environment variable.

--insecure
    Allow insecure TLS connections