Main Content

Troubleshoot MQTT Publish

The MQTT protocol provides minimal feedback, and error messages are limited. Use these steps to troubleshoot issues with connecting and publishing messages. The steps are all independent possibilities, with the most likely problems listed first.

  1. Ensure that the client address is If you incorrectly configure your client to connect to the ThingSpeak™ MQTT broker, your connection request is rejected.

  2. Check that you have the correct topic format to Publish to a Channel Feed or to Publish to a Channel Field Feed.

  3. Ensure that your MQTT device credentials are correct. Select Devices > MQTT. The device configuration details are visible when you click Edit, but if you did not save or make note of the password when you created the device, you can regenerate a new one by clicking The regenerate button.

  4. Make sure your QoS is set to 0. Some devices have a default QoS that is different than 0. Some clients require you manually change the setting.

  5. Do not set CleanSession flag to 0. If you set the CleanSession flag to 0 on your MQTT client, any connection request to the ThingSpeak™ MQTT broker is rejected with a CONNACK status of "0x05 Connection Refused, not authorized".

  6. Make sure that the port is correct. See MQTT Client Configuration for a list of accepted ports.

  7. Do not set the Will flag to nonzero values on your MQTT client. Any connection request to the ThingSpeak MQTT broker with a nonzero Will flag is rejected with a CONNACK status of "0x05 Connection Refused, not authorized".

  8. If you are having trouble connecting with SSL, be aware that your client can require extra steps to enable a secure connection.

  9. If you are sending data from a device, ensure that the buffer size for your MQTT library is large enough to send the full message to ThingSpeak. The buffer size should be at least 1K if your device has enough memory available.

  10. If you need to update the channel at a higher rate than allowed, see License Options.

See Also

Related Topics