Skip to Content
Skip to Content
Developer GuideConnectorCustom Communication

Device Management and OTA System Overview

1. System Overview

This system supports real-time communication between each IoT device (e.g., sensors, controllers, etc.) and the central server. This communication is done via a protocol called MQTT, where devices periodically report status information and the server can send commands to devices as needed.

2. Key Concepts and Terms

  • MQTT: A lightweight and fast messaging protocol for communication between devices and the server.
  • link_id: A unique ID for identifying a device.
  • Topic: The address structure used to deliver messages.

3. MQTT Topic Hierarchy

  • l/{link_id}/h: Heartbeat
  • l/{link_id}/s/{sensor_id}: Sensor data report
  • l/{link_id}/s/{status_type}: Device status report
  • l/{link_id}/e/{event_id}: Event report
  • l/{link_id}/c/{command_id}/req: Server → Device command request
  • l/{link_id}/c/{command_id}/res: Device → Server command response

4. Heartbeat

The device periodically notifies the server that it is operating normally.

  • Format: l/{link_id}/h

  • Payload:

    { "uptime": 1234567 }
    • uptime: Elapsed time since the system booted (in milliseconds)

5. Sensor Data Report

The device sends measured sensor data to the server.

  • Format: l/{link_id}/s/{sensor_id}

  • Payload Example:

    • Number:

      23.5
    • JSON:

      { "value": 23.5, "unit": "C", "timestamp": 1621234567890 }

6. Status Report

The device reports its operational or configuration status to the server.

  • Format: l/{link_id}/s/{status_type}
  • Example: Current mode, operational status, etc.

7. Event Report

The device sends specific events that occur to the server.

  • Format: l/{link_id}/e/{event_id}
  • Example: Button press, warning triggered, sensor error, etc.

8. Command Request and Response

8.1 Command Request (Server → Device)

  • Format: l/{link_id}/c/{command_id}/req
  • Example: Request to change settings, request to restart device, etc.

8.2 Command Response (Device → Server)

  • Format: l/{link_id}/c/{command_id}/res

  • Payload Format:

    {responseStatus}|{body}
    • Example:

      OK|{"message": "Completed"}

8.3 Possible Response Statuses

  • OK: Command processed successfully
  • UNPROCESSABLE: Unknown command
  • ERROR: Error occurred during processing
  • TIMEOUT: Timeout
  • UNKNOWN: Other unknown error