Connecting Your Device
Step-by-step guide to connect your first IoT device to Sensorclouds via MQTT
Follow these steps to connect a physical device to the Sensorclouds platform.
Prerequisites
- A registered device with MQTT credentials (see Registering Devices)
- Your Sensorclouds instance broker URL
Connection Steps
Register the Device
If you haven't already, create an Application, a Device Profile, and register a Device within the application. The platform generates MQTT credentials on device creation.
Get MQTT Credentials
Navigate to Device → Settings and:
- Copy the Device Token (this is your MQTT username)
- Click Generate Password and copy the MQTT password immediately
The password is shown only once. Store it securely before closing the dialog.
Configure Your Device
Set the following on your device firmware:
| Parameter | Value |
|---|---|
| Broker URL | your-instance.sensorclouds.com |
| Port | 443 (WSS) or 8883 (MQTTS) |
| Username | Your Device Token |
| Password | The generated password |
| Client ID | Any unique string (device token recommended) |
| TLS | Required for production |
Publish Telemetry
Send data to your device's telemetry topic:
tenant/{tenantId}/app/{applicationId}/device/{deviceToken}/dataPayload can be:
- JSON:
{"temperature": 25.3, "humidity": 60} - Hex string:
"48656C6C6F"(auto-detected and decoded) - Raw bytes: Decoded by the device profile's payload decoder
Configure LWT (Recommended)
Set up Last Will and Testament for automatic offline detection:
tenant/{tenantId}/app/{applicationId}/device/{deviceToken}/status| LWT Parameter | Value |
|---|---|
| Will Topic | tenant/{tenantId}/app/{appId}/device/{token}/status |
| Will Payload | {"status": "offline"} |
| Will QoS | 1 |
| Will Retain | true |
On successful connection, publish {"status": "online"} to the same topic.
Verify the Connection
After connecting, navigate to your application's Live Data tab. You should see telemetry messages appearing in real-time as your device publishes data.