Sub-Device Registration

Register a Device


Upstream

  • Request TOPIC: /sys/{productKey}/{deviceKey}/thing/device/register

  • Reply TOPIC: /sys/{productKey}/{deviceKey}/thing/device/register_reply

Sample Request Format


{
  "method":"thing.device.register",
  "id":"1",
  "params":[
    {
      "timezone":"+08:00",
      "deviceKey":"sample_dev_01",
      "productKey":"aVpQQTDp",
      "deviceAttributes":{
        "location":"Shanghai",
        "name":"dev_01"
      },
      "deviceName":{
        "defaultValue":"sample_dev_01",
        "i18nValue":{
          "en_US":"eng_dev_01",
          "zh_CN":"dev_01"
        }
      },
      "deviceDesc":"dev desc"
    },
    {
      "timezone":"+09:00",
      "deviceKey":"sample_dev_02",
      "productKey":"aVpQQTDp",
      "deviceAttributes":{
        "location":"Beijing",
        "name":"dev_01"
      },
      "deviceName":{
        "defaultValue":"sample_dev_02",
        "i18nValue":{
          "en_US":"eng_dev_02",
          "zh_CN":"dev_02"
        }
      },
      "deviceDesc":"dev desc"
    }
  ],
  "version":"1.1"
}

Sample Response Format


{
  "code":200,
  "data":[
    {
      "deviceSecret":"yourDeviceSecret",
      "assetId":"LOMCp6V2",
      "deviceKey":"sample_dev_01",
      "productKey":"aVpQQTDp"
    },
    {
      "deviceSecret":"yourDeviceSecret",
      "assetId":"8MGrcj2b",
      "deviceKey":"sample_dev_02",
      "productKey":"aVpQQTDp"
    }
  ],
  "id":"1"
}

Request Parameter Description


Parameter

Type

Mandatory/Optional

Description

id

String

Mandatory

The message ID. It is a reserved parameter that is reserved for future use.

version

String

Mandatory

The version of the protocol. The current version is 1.0.

params

Array

Mandatory

The parameters used for the registration.

deviceAttributes

Map

Optional

The list of the properties of the device.

deviceKey

String

Optional

The device key of the device.

deviceName

String

Optional

The device name.

deviceDesc

String

Optional

The device description.

productKey

String

Mandatory

The product key of the device.

assetId

String

Mandatory

The asset ID of the device.

deviceSecret

String

Mandatory

The device secret of the device.

method

String

Mandatory

The request method.

Response Parameter Description


Parameter

Type

Description

code

Integer

The return code. “200” indicates that the request operation is executed successfully.

data

JSON

The detailed information of the device.

Return Code


Return Code

Error Message

Explanation

702

DeviceKey existed

The device key you defined already exists.

714

Generate deviceKey failed

EnOS failed to automatically generate a device key for you.

739

Exceed the product max device size

Adding this device will exceed the limit for the maximum number of devices allowed under this product.