MQTT AT commands

AnyNet SMARTconnect™ Message Queuing Telemetry Transport (MQTT) AT commands are specific to devices that have built-in MQTT capabilities. They provide a simple and lightweight way to implement MQTT communication on a wide range of IoT devices.

Send the following AT command to enable AnyNet SMARTconnect™ MQTT on your device: AT+ETMSTATE="startmqtt" If the configuration file [operation] <mode> parameter is set to mqtt, then AnyNet SMARTconnect™ automatically starts MQTT after power up. If the <mode> is not set, after each reboot you must send AT+ETMSTATE="startmqtt" again.

The MQTT client registers each topic with an index that is used to publish the messages. The response indicates acceptance or rejection of the topic. Optionally, you can configure a single fixed topic so the module need not keep track of topic indices for sending or receiving data.

The MQTT client supports QoS 0 and 1, and always connects to the broker as a clean session. All publish messages are queued in a non-volatile flash memory until they are sent to the broker. For QoS 1 messages, AnyNet SMARTconnect™ waits for a puback from the broker before discarding the sent data and transmitting the next message. This mechanism queues messages while a network connection is not available, and forwards messages when the connection establishes.

In the event of a power failure, queued messages are retained until reconnection occurs. Retained message storage is defined by nvqueuemaxsize in the Configuration File. For more information, see Using AnyNet SMARTconnect™ configuration file.

Retained messages are expunged from the flash memory when the broker successfully receives them.

Where to next?