Taking Sub-Device Online/Offline

Last Updated on : 2022-10-17 07:53:38download

The gateway takes care of reporting the online/offline status of the sub-device to the cloud. It can report the online status one by one or in bulk. Before online status reporting, the topological relationship between the sub-device and the gateway must be established. When the gateway reports the online status of a sub-device, the cloud will verify their topological relationship and perform identity authentication to determine if the gateway is authorized to serve as a proxy to the sub-device.

  • The gateway must establish the topological relationship with the sub-device before reporting the online/offline status of this sub-device.
  • Reporting status in bulk is an asynchronous operation, so the cloud does not return a response.

This topic describes the protocol for sub-device going online/offline.

Sub-device goes online

With an established topological relationship, the gateway can act as the proxy for the sub-device and report its online status to the cloud.

Device sends messages

Topic: tylink/${deviceId}/device/sub/login

{
    "msgId":"45lkj3551234001",
    "time":1626197189600,
    "data":[
      "123455asdf",
      "123456tyiy"
    ]
}

Description

Type Description Required Notes
${deviceId} string The device ID. Yes The ID of the gateway that reports the online status of a sub-device.
version string Protocol version No The protocol version defaults to 1.0, which is the only valid value currently.
msgId string Message ID Yes A string up to 32 bits in length. The request and response are associated with a message ID.
time number Message timestamp Yes The Unix timestamp when a message is sent, in seconds (10-digit value) or milliseconds (13-digit value).
data array The list of online deviceId Yes The list of deviceId of sub-devices, with no more than 100 sub-devices.

Sub-device goes offline

With an established topological relationship, the gateway can act as the proxy for the sub-device and report its offline status to the cloud.

Device sends messages

Topic: tylink/${deviceId}/device/sub/logout


{
    "msgId":"45lkj3551234001",
    "time":1626197189600,
    "data":[
      "123455asdf",
      "123456tyiy"
    ]
}

Description

Parameters Type Description Required Notes
${deviceId} string The device ID. Yes The ID of the gateway that reports the offline status of a sub-device.
version string Protocol version No The protocol version defaults to 1.0, which is the only valid value currently.
msgId string Message ID Yes A string up to 32 bits in length. The request and response are associated with a message ID.
time number Message timestamp Yes The Unix timestamp when a message is sent, in seconds (10-digit value) or milliseconds (13-digit value).
data array The list of offline deviceId Yes The list of deviceId of sub-devices, with no more than 100 sub-devices.