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.
Ensure that the client address is
mqtt3.thingspeak.com
. If you incorrectly configure your client to connect to the ThingSpeak™ MQTT broker, your connection request is rejected.Check that you have the correct topic format to Publish to a Channel Feed or to Publish to a Channel Field Feed.
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 .
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.
Do not set
CleanSession
flag to 0. If you set theCleanSession
flag to 0 on your MQTT client, any connection request to the ThingSpeak™ MQTT broker is rejected with aCONNACK
status of"0x05 Connection Refused, not authorized"
.Make sure that the port is correct. See MQTT Client Configuration for a list of accepted ports.
Do not set the
Will
flag to nonzero values on your MQTT client. Any connection request to the ThingSpeak MQTT broker with a nonzeroWill
flag is rejected with aCONNACK
status of"0x05 Connection Refused, not authorized"
.If you are having trouble connecting with SSL, be aware that your client can require extra steps to enable a secure connection.
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.
If you need to update the channel at a higher rate than allowed, see License Options.