SL 651 protocol message examples

Updated at:

For cloud gateway devices that use the SL 651 protocol, messages about device status and reported data can be forwarded to your server. You can use the data forwarding feature of IoT Platform to forward these messages. Data messages can also be pushed to your server using the Advanced Message Queuing Protocol (AMQP) subscription feature. This topic describes the topics and data formats for the messages.

Device online and offline status

Topic: /sys/${productKey}/${deviceName}/device/status/notify.

  • Data format for an online device:

    {
        "protocol": "sl651",
        "status":"online",
        "iotId":"4z819VQHk6VSLmmBJfrf00107e****",
        "productKey":"al12345****",
        "deviceName":"deviceName1234",
        "time":"2018-08-31 15:32:28.205",
        "utcTime":"2018-08-31T07:32:28.205Z",
        "lastTime":"2018-08-31 15:32:28.195",
        "utcLastTime":"2018-08-31T07:32:28.195Z",
        "clientIp":"192.0.2.1"
    }
  • Data format for an offline device:

    {
        "protocol": "sl651",
        "status":"offline",
        "iotId":"4z819VQHk6VSLmmBJfrf00107e****",
        "offlineReasonCode":427,
        "productKey":"al12345****",
        "deviceName":"deviceName1234",
        "time":"2018-08-31 15:32:28.205",
        "utcTime":"2018-08-31T07:32:28.205Z",
        "lastTime":"2018-08-31 15:32:28.195",
        "utcLastTime":"2018-08-31T07:32:28.195Z",
        "clientIp":"192.0.2.1"
    }

Parameter descriptions:

Parameter

Type

Description

protocol

String

The SL 651 protocol for cloud gateways. The value is sl651.

status

String

The status of the device.

  • online: Online.

  • offline: Offline.

iotId

String

The unique identifier of the device in IoT Platform.

offlineReasonCode

Integer

The error code that is returned when the device goes offline. For more information, see Device behavior error codes.

productKey

String

The unique identifier of the product to which the device belongs.

deviceName

String

The name of the device.

lastTime

String

This parameter is a historical field and is no longer used.

utcLastTime

String

time

String

The time when the device went online or offline.

The received messages are not sorted by the time when the device went online or offline. You must sort the messages based on the value of the time parameter.

For example, you receive the following three messages in sequence:

  1. Online: 2018-08-31 10:02:28.195.

  2. Offline: 2018-08-31 10:01:28.195.

  3. Offline: 2018-08-31 10:03:28.195.

These three messages show that the device first went offline, then went online, and finally went offline again.

utcTime

String

The UTC time when the device went online or offline.

clientIp

String

The public IP address of the device.

Data reported by a device

Topic: /sys/${productKey}/${deviceName}/device/message/uplink

payload:
{
    header:{
        telemetryAddress:""
    },
    body:{
        data:"dGVzdDEyMw=="
    }
}

Parameter name

Data type

Description

header

Object

The message header data.

telemetryAddress

String

The telemetry station address.

body

Object

The message body data. The data is Base64-encoded.