A sub-device can be connected to IoT Platform only by using a gateway. This article describes how to connect a sub-device to IoT Platform by using a gateway.

First, create a gateway and a sub-device in the IoT Platform console. Then, develop a device SDK for the gateway to connect the gateway to IoT Platform. Next, the gateway creates a topological relationship between the gateway and sub-devices and reports the relationship to IoT Platform. If a sub-device has a topological relationship with the gateway, the gateway reports the certificate of the sub-device to IoT Platform or dynamically registers the sub-device. IoT Platform validates the identity of the sub-device and the topological relationship between the sub-device and the gateway. If the validation is successful, IoT Platform establishes a logical channel between the sub-device and IoT Platform and associates the logical channel with the physical channel of the gateway. This way, the sub-device can connect to and communicate with IoT Platform by using the gateway.

Sub-device communication

This example describes only how to connect a sub-device to IoT Platform by using a gateway, and does not involve configurations for data communication such as Thing Specification Language (TSL) data communication. If you want to transmit TSL data between your sub-device and IoT Platform, configure your gateway to transmit the data for the sub-device. For more information, see TSL model communication.

Note Data transmission between a gateway and a sub-device must be implemented by the provider of the gateway. Alibaba Cloud does not provide code for this feature.

Reference

You can download the sample code for connecting a sub-device to IoT Platform by using a gateway: iotx-api-demo.

To connect the sub-device to IoT Platform by using the gateway, perform the following steps:

  1. Create a gateway and a sub-device
  2. Initialize the SDKs
  3. Connect the gateway to IoT Platform
  4. Connect the sub-device to IoT Platform