Updated on 2023-02-16 GMT+08:00

Platform Notifying a Gateway of New Child Device Connection

Function

This API is used by the platform to notify a gateway that a new child device is connected.

Topic

Downstream: $oc/devices/{device_id}/sys/events/down

Parameters

Parameter

Mandatory or Optional

Type

Description

object_device_id

Optional

String

Indicates the device that the event is about. If this parameter is not carried, the device specified in the topic is considered to be the device involved.

services

Optional

List<ServiceEvent>

Indicates a list of services that the event is about.

ServiceEvent structure

Parameter

Mandatory or Optional

Type

Description

service_id

Mandatory

String

System field. The value is fixed to $sub_device_manager.

event_type

Mandatory

String

System field. The value is fixed to add_sub_device_notify.

event_time

Optional

String

Indicates the time when the event occurs.

paras

Mandatory

Object

Indicates the event parameters in JSON format.

paras structure

Parameter

Mandatory or Optional

Type

Description

devices

Mandatory

List<DeviceInfo>

Indicates the device list.

version

Mandatory

Long

Indicates the version of the child device information. The gateway can save this value and include it in the request for synchronizing the child device list.

DeviceInfo structure

Parameter

Mandatory or Optional

Type

Description

parent_device_id

Mandatory

String

Identifies the parent device.

node_id

Mandatory

String

Indicates the node ID.

device_id

Mandatory

String

Identifies a device.

name

Optional

String

Indicates the device name.

description

Optional

String

Indicates the device description.

manufacturer_id

Optional

String

Identifies a manufacturer.

model

Optional

String

Indicates the device model.

product_id

Optional

String

Identifies a product.

fw_version

Optional

String

Indicates the firmware version.

sw_version

Optional

String

Indicates the software version.

status

Optional

String

Indicates the device status.

ONLINE: The device is online.

OFFLINE: The device is offline.

INACTIVE: The device is not activated.

extension_info

Optional

Object

Indicates the custom extended information.

Example

Topic: $oc/devices/{device_id}/sys/events/down 
Data format:
{
	"object_device_id": "{object_device_id}",
	"services": [{
		"service_id": "$sub_device_manager",
		"event_type": "add_sub_device_notify",
		"event_time": "20151212T121212Z",
		"paras": {
			"devices": [{
				"parent_device_id": "c6b39067b0325db34663d3ef421a42f6_12345678",
				"node_id": "subdevice11",
				"device_id": "2bb4ddba-fb56-4566-8577-063ad2f5a6cc",
				"name": "subDevice11",
				"description": null,
				"manufacturer_id": "ofo",
				"model": "twx2",
				"product_id": "c6b39067b0325db34663d3ef421a42f6",
				"fw_version": null,
				"sw_version": null,
				"status": "ONLINE"
			}],
			"version": 1
		}
	}]
}