Skip to main content

MQTT command

When run with the necessary options, the trustedge mqtt command provides functionality for managing MQTT communications. TrustEdge CLI tool supports both MQTT 3.1.1 and MQTT 5.0 protocols for publishing messages to an MQTT broker and subscribing to MQTT topics to receive messages.

Notice

TrustEdge CLI tool does not support MQTT at this time. MQTT support will be included in a future update.

TrustEdge MQTT command options

To view the available options for the trustedge mqtt command, use the following:

trustedge mqtt --help

Examples

Publish a message to a topic

To publish a message to an MQTT topic, use the pub command with the necessary options:

trustedge mqtt pub -h 192.168.1.1 -m "test message" -t house/bulb1

This command publishes the message test message to the topic house/bulb1 on the MQTT broker located at 192.168.1.1.

Subscribe to a topic

To subscribe to an MQTT topic, use the sub command with the necessary options:

trustedge mqtt sub -h 192.168.1.1 -t house/bulb1

This command subscribes to the topic house/bulb1 on the MQTT broker located at 192.168.1.1.