Last Updated on : 2023-03-21 08:58:48download
This topic describes how to create and set up a cloud development project in the smart home system, and how to integrate it with Tuya’s cloud development.
Authorize and link an OEM app to a new cloud project. Then, query user information and control devices by using OpenAPI and message queues.
The following figure shows the interaction logic.
The whole process is detailed step by step.
Go to the account registration page on the Tuya IoT Development Platform.
Follow the guide to register a developer account. The registered account is granted all respective permissions. Keep it properly.
If you are an organization developer, you can follow instructions in Organization Verification and verify your organization’s identity.
The cloud project is a carrier or collection of resources on the Tuya IoT Development Platform, including devices and users. Resources deployed for each project are isolated from those for other projects.
Log in to the Cloud Development Platform.
In the left-side navigation bar, choose Cloud > Development > Create Cloud Project.
Enter the required information as prompted and click Create.
To create a smart home project, you must select Smart Home in the Development Method field.
On the Configuration Wizard page, click Authorize to subscribe to the API services and authorize the cloud project.
By default, the APIs that support the specified development method are selected for the project on the platform. You can add or delete the default API services, or select other API services. For more information about API services, see Manage API Services.
After you create and set up a project, you can view the project in the project list.
For more information about cloud projects, see Manage Projects.
After creating a cloud project, you need to link your OEM app with the cloud project.
On the page of Cloud Management, click a project to enter the details page.
Choose Devices > Link My App > Add Apps.
Select the desired OEM app and link it with the cloud project.
The following figure shows the linking result.
On the page of Cloud > Message Service, you can enable this service for the cloud project and configure parameters to get alerts of excessive messages.
The following figure shows the result of enabling the message service.
For more information about the message service, see Message Service.
We will use the API Explorer to complete the above case.
Call the Get User List API to get a list of app users.
As shown above, there is a user with UID ay16600***ONz7
under the current OEM app.
Call the Get User’s Device List API to get a list of devices that belong to the user.
As shown above, there is a socket device with ID 87707085bcddc****fa3
that belongs to the user.
If you have linked a Tuya app account with the project, you can find the user ID (UID) in the list of linked accounts.
In the Device Control section, call the Get the instruction set supported by the device API to get the instructions supported by the device.
The socket supports two functional instructions:
The code of the switch instruction is switch_1
, and the value is of Boolean type. true
: Turn on. false
: Turn off. For more information about functional instructions, see Standard Instruction Set.
Call the Control Device API to control the device and turn on the socket.
The output window shows that the insruction has been sent to the device. The content of the instruction is as follows:
[
{
"code":"switch_1",
"value":true
}
]
On the Message Test tab, add the device to the message test channel and enable the Test Channel.
Call the Control Device API again and observe the test channel.
As you can see, the listener has returned the message that the socket was turned off.
The message test channel is for trial and debugging only. If you add your device to the test channel, you will not receive messages in the production environment.
Now, you have completed the quick start and can dive deep into the smart home system.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback