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

Gateway Updating Child Device Status

Function

This API is used by a gateway to update child device status.

Topic

Upstream: $oc/devices/{device_id}/sys/events/up

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<EventService>

Indicates a list of services that the event is about.

EventService 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 sub_device_update_status.

event_time

Optional

String

Indicates the time when the event occurs.

event_id

Optional

String

Uniquely identifies an event. If this parameter is not carried, an event ID will be generated by the platform. An event ID is a random string of 36 characters consisting of letters, numbers, and hyphens (-).

paras

Mandatory

Object

Indicates the event parameters in JSON format.

paras structure

Parameter

Mandatory or Optional

Type

Description

device_statuses

Mandatory

List<DeviceStatus>

Indicates the device status list. The list can contain status information of 1 to 100 devices.

DeviceStatus structure

Parameter

Mandatory or Optional

Type

Description

device_id

Mandatory

String

Identifies a child device.

status

Mandatory

String

Indicates the child device status.

  • OFFLINE: The device is offline.
  • ONLINE: The device is online.

Example

Topic: $oc/devices/{device_id}/sys/events/up
Data format:
{
	"services": [{
		"service_id": "$sub_device_manager",
		"event_type": "sub_device_update_status",
		"event_time": "20151212T121212Z",
		"paras": {
			"device_statuses": [{
					"device_id": "bf40f0c4-4022-41c6-a201-c5133122054a",
					"status": "ONLINE"
				},
				{
					"device_id": "4459c0f7-10bb-4718-9b07-7a82c2d508a5",
					"status": "ONLINE"
				}
			]
		}
	}]
}