Skip to main content
Documentation v2.0
Publish telemetry/docs/mqtt/publish-telemetry

MQTT

Stable

Publish telemetry

Send sensor data from a device to Ruang IoT securely and efficiently.

On this page4 sections

Sending telemetry

CPP main.ino
void kirimData() {
  float suhu = 28.5;
  ruangiot.send("temperature", suhu);
}

Set the interval

Avoid publishing on every loop() iteration. Use a timer so the publish rate matches what the sensor needs without overloading the broker or the database.

Payload format

  • Use numbers for numeric data.
  • Use consistent values for booleans, for example 0/1 or OFF/ON.
  • Avoid large JSON payloads when a single variable is enough.
  • Don't send passwords, tokens, or personal data.

Validate the results

  1. Check the Serial Monitor.
  2. Make sure the MQTT status shows as connected.
  3. Open Data History and filter by device/variable.
  4. Make sure the timestamp and data source are correct.

Documentation feedback

Was this article helpful?

Documentation search

What do you want to learn?

Type at least two characters to search the documentation.
Code copied.