You must import the verification information about a device to a gateway product whose Authentication Type parameter is set to One-party Verification. This way, the information can be used to verify the device when you connect the device to IoT Platform. This topic describes how to import the verification information about devices.
Prerequisites
A gateway whose Authentication Type parameter is set to One-party Verification is created as a product in the IoT Platform console. For more information, see Create an MQTT gateway.
Background information
After you create a gateway whose Authentication Type parameter is set to Third-party Certification and use the gateway to connect a device to IoT Platform for the first time, IoT Platform automatically uses the return value of the deviceName parameter as the device name to create a device.
You can use MQTT.fx to simulate a device and connect the device to IoT Platform by using a gateway to enable communication. For more information, see Use MQTT.fx to connect a device (Function Compute for device verification).
After you create a gateway whose Authentication Type parameter is set to One-party Verification, you must import the verification information about devices to add the devices to the gateway product in the IoT Platform console. The following section describes how to add devices.
Add multiple devices
Log on to the IoT Platform console.
On the Overview tab, click the Exclusive Enterprise Edition instance that you want to manage.
In the left-side navigation pane, choose . Find the gateway that you created and click Manage Devices in the Actions column.
On the Devices page, click Batch Add.
In the Batch Add Devices dialog box, click Download. csv Template to download the template of device verification information.
In the template file, enter the serial number (SN), Message Queuing Telemetry Transport (MQTT) username, and MQTT password of each device that you want to add, and save the file.
ImportantMQTT usernames and MQTT passwords are required. SNs are optional.
An MQTT username must be 4 to 32 characters in length, and can contain letters, digits, hyphens (-), underscores (_), at signs (@), periods (.), and colons (:). Each MQTT username must be unique in a product.
An MQTT password must be 1 to 32 characters in length, and can contain letters, digits, hyphens (-), underscores (_), at signs (@), periods (.), and colons (:).
Each template file can contain the information of up to 10,000 devices. Do not import information about duplicate devices.
Go to the Batch Add Devices dialog box, click Upload File, upload the completed template file to the IoT Platform console, and then click OK.
If a template file contains invalid information, an error is returned. Click Download Invalid Device Name List, view and change the invalid information, and then re-upload the template file.
Related operations
API | Description |
Adds a device to an MQTT gateway product. | |
Adds multiple devices to an MQTT gateway product at the same time. | |
Verifies multiple devices that are added at the same time. | |
Queries multiple devices that are added at the same time by application ID. |
Result
After the device verification information is imported, IoT Platform creates devices and uses the uploaded MQTT usernames as DeviceNames. The Devices page displays the information about the devices that are created.
What to do next
After the devices are added to the gateway product, you must update the endpoint of each device.
If an endpoint is specified for a device, you must configure a CNAME record to change the endpoint to the gateway URL. For information about how to resolve domain names, see Alibaba Cloud DNS.
If no endpoint is specified for a device, you must specify the gateway URL as the endpoint of the device. For more information, see Connect a device to IoT Platform over MQTT.
For information about how to obtain a gateway URL, see View the gateway URL of a gateway.
For information about how to connect a device to IoT Platform by using a gateway, see Messaging.
You can use MQTT.fx to simulate a device and connect the device to IoT Platform by using a gateway to establish communication. For more information, see Use MQTT.fx to connect a device (one-party verification).