MQTT Connectivity
Connection Troubleshooting
Diagnose why a device can't connect, why its data doesn't appear, or why it shows offline
Work through the sections in order: can it connect → is the message received → is it stored → does status look right.
Keep the application's Live Data page open while you test. It shows every message the platform receives, and every error, in real time.
1. The device can't connect
| Symptom | Likely cause | Fix |
|---|---|---|
| Connection times out | Wrong host or port, or a firewall blocking port 8883 | Use mqtt.sensorclouds.app:8883. Ask your network team to allow outbound 8883 |
| Connection refused on port 443 | WSS isn't available | Use MQTTS on port 8883 |
| TLS handshake fails | The device doesn't trust the certificate, or its clock is wrong | Embed ISRG Root X1. Make sure the device has the correct time |
| "Not authorized" / bad username or password (MQTT code 4 or 5) | Wrong token or password, or the password was regenerated | Copy the Device Token again. Generate a new password and update the device |
ESP32 connect() returns false, state = -2 | PubSubClient buffer too small, TLS failure, or network | Add mqtt.setBufferSize(1024). Check the root CA and the clock |
| Connects, then drops right away | Another client is using the same client ID, or the client ID was refused | Use the Device Token as the client ID, and only on one connection |
2. Connected, but nothing in Live Data
| Symptom | Likely cause | Fix |
|---|---|---|
| Publish succeeds, but nothing appears | Wrong topic. The device isn't allowed to publish there, so the broker drops the message | Copy the topic from the device's Overview tab. Check the /data suffix |
| Unknown device in Live Data | The token in the topic doesn't match a registered device in that application | Check the token and the Application ID in the topic |
| Invalid topic | The topic doesn't follow the pattern | Use tenant/{tenantId}/app/{applicationId}/device/{deviceToken}/data |
| Payload too large | The message is bigger than 256 KB | Send smaller messages |
| Rate limited | The device publishes faster than allowed | Send less often, or combine readings into one message |
3. In Live Data, but not on dashboards
| Symptom | Likely cause | Fix |
|---|---|---|
| Uplink received, but Decoded payload is empty | The profile's codec is NONE | Switch to CUSTOM and add the JSON decoder |
| Decode failed | The decoder threw an error | Open the event details for the error, then fix and test the decoder |
| Fields are decoded, but a widget is empty | The widget uses a different field name, or a time window older than the data | Compare field names. Choose a window that includes the data |
| Data appears hours in the past | The payload contains a timestamp with the wrong time zone or units | Send Unix seconds/milliseconds or ISO 8601 with a zone, or remove timestamp |
4. Status looks wrong
| Symptom | Likely cause | Fix |
|---|---|---|
| Flips between ONLINE and OFFLINE | It reports less often than 1.5 × the profile's keep-alive | Raise the keep-alive above the reporting interval |
| Stays ONLINE after being unplugged | No Last Will was set | Set the Last Will on /status. See Connecting Your Device |
| Stays UNKNOWN | It has never sent a message | Start at section 1 |
5. Commands don't work
| Symptom | Likely cause | Fix |
|---|---|---|
| Stays SENT, then TIMEOUT | The device isn't subscribed to /cmd, or never acknowledges | Subscribe to /cmd with QoS 1, and publish an ACK to /ack |
| Always FAILED although it worked | The ACK uses the wrong status value | Send "status": "ok" (not "success") |
| ACK ignored | commandId missing or not copied exactly | Echo the commandId from the command |
Still stuck?
Collect these details before contacting support:
- The device's name and Device Token (never send the password)
- The time of a failed attempt
- The error from the device's log, and any Live Data event details