English
English
简体中文
Contact Us
Register
Log In
TuyaOSTuya Wind IDE

Tuya Wind IDE

Last Updated on : 2022-12-14 08:29:03download

Tuya Wind IDE (integrated development environment) provides comprehensive facilities to TuyaOS EasyGo developers.

Background

Tuya Wind IDE is provided as an extension of Visual Studio Code (VS Code) and is available in both English and Chinese. You log in to this IDE with the account of the Tuya IoT Development Platform. Tuya Wind IDE manages, distributes, and updates the TuyaOS EasyGo development kits, enabling a consistent development experience across hosts and programming tools.

Set up environment

Tuya Wind IDE supports the following environments:

  • Linux virtual machine (VM) on Windows host, or Linux VM: used for developing most networked products, cellular products, gateways, control panels, IP cameras (IPCs), and network video recorders (NVRs).

    The environment setup has been verified on Ubuntu 18.04 and 20.04 on VirtualBox.

  • Windows 10 or 11: used for developing most sub-devices.

    In most cases, the flashing tools for firmware built on Linux are available for Windows only, so it is recommended to work on a Linux VM throughout the development process.

Linux VM on Windows host

If you only use a Linux VM throughout the development, see Step 1: Install VM and then see the section Install IDE for the following operations.

Step 1: Install VM

Install VM software, VirtualBox or VMware, and create a VM. Install Ubuntu 18.04 or 20.04 on the VM. It is recommended to set the RAM of the VM to 8G.

For more information about VM installation, see Install Linux VM on Windows.

Then, run the following command to install the required software.

$ sudo apt update
$ sudo apt install net-tools openssh-server python3.8 python3-pip python3-distutils build-essential lib32stdc++6
  • pip3:

    • Make sure pip3 points to Python 3.8 instead of other Python versions.

      $ pip3 --version
      pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
      
    • If pip3 does not point to the correct Python version, specify the Python version in the pip3 script.

      $ which pip3
      In the first line, change the python version to python3.8, as shown below.
      #!/usr/bin/python3.8
      
  • Python3-distutils:

    • If you fail to install python3-distutils, manually update pip. Make sure you use pip3 v21.xx or later versions.

      curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
      python3.8 get-pip.py --user
      pip3 --version
      
  • Ubuntu system:

    • If you have Ubuntu 20.04 VM installed on your system and then upgrade it to Ubuntu 22.04, Tuya Wind IDE installation will fail. Make sure not to upgrade Ubuntu when Tuya Wind IDE is being installed.

    • You can run the following command to check the Ubuntu version.

      cat /proc/issue
      
  • Python 3.9:

    If your system already has Python 3.9 installed, installing Python 3.8 can cause some problems. For more information about the possible error, see the issue ModuleNotFoundError: No module named ‘distutils.cmd’ on GitHub. There is currently no solution.

  • VirtualBox:

    1. If you use VirtualBox, set the Adapter 2 to Host-only Adapter to ensure VS Code on Windows can connect to the VM via SSH.

      Tuya Wind IDE
    2. If you cannot create Host-only Adapter, on the main VirtualBox window, choose File > Host Network Manager and configure as shown below. Or visit this website for troubleshooting.

      Tuya Wind IDE Tuya Wind IDE
    3. Power on your VM and get the IP address of your VM.

      Tuya Wind IDE

If you only use a Linux VM throughout the development, see the section Install IDE for the following operations.

Step 2: Enable SSH login without password

Windows 10 or 11 has a built-in SSH client.

On the Windows host, run the following commands in PowerShell to configure an SSH login without password.

  • Assume the username of the VM is vscode.

  • The IP address of the VM is 192.168.56.105.

  1. Generate an SSH key.

    ssh-keygen -t rsa -b 4096
    
  2. Specify the username and IP address of your VM.

    $USER_AT_HOST="vscode@192.168.56.105"
    
  3. Specify the location where the public key to upload resides.

    $PUBKEYPATH="$HOME\.ssh\id_rsa.pub"
    
  4. Register the public key. You are required to enter the username and password of the server.

    $pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh "$USER_AT_HOST" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
    
    Tuya Wind IDE

Step 3: Install Remote SSH extension

  1. Install and open VS Code.

  2. Click Extensions in the left navigation pane. Search for and install Remote - SSH.

    Tuya Wind IDE Tuya Wind IDE Tuya Wind IDE
  3. Set up and connect to SSH. This example uses the IP address 192.168.56.105.

    Tuya Wind IDE Tuya Wind IDE

Step 4: Configure port mapping

  1. Open the SSH configuration file.

    Tuya Wind IDE
  2. Edit the port mapping.

    Tuya Wind IDE

    Replace the Host, User, and HostName with your values.

  3. Enter the following code to configure port mapping:

    Host 192.168.56.105
        HostName 192.168.56.105
        User vscode
        LocalForward 127.0.0.1:8319 127.0.0.1:8319
        LocalForward 127.0.0.1:8320 127.0.0.1:8320
    
  4. Close and open the IDE, and you are good to go.

    For more information about port mapping, see Remote Development using SSH.

Windows

  1. Install Python 3.8 as instructed by Python installation guide.

  2. Make sure to select Add Python 3.8 to PATH to add your Python 3.8 directory to the PATH variable.

    Tuya Wind IDE
  3. Install Python 3.8.

    • Click Install Now.
    • If you choose Customize installation, restart your computer after pip installation and then install Tuya Wind IDE on VS Code.

Install IDE

Install VS Code on your Windows computer.

  1. Open VS Code. Search for and install Tuya Wind IDE as shown in the following figures.

    Tuya Wind IDE
  2. The Output window displays status messages. Wait for the installation to complete.

    Tuya Wind IDE
  3. When the installation is complete, click Reload Now or close and open VS Code again.

    Tuya Wind IDE

How-to guide

Log in

Open the login page as shown in the following figure. Log in to the IDE with the account of the Tuya IoT Development Platform.

Tuya Wind IDE

Log out

Click the account icon in the top right corner and click Log Out.

Tuya Wind IDE

Development framework download

Choose Home > Create Framework.

Tuya Wind IDE

Complete the required fields on the TuyaOS Framework Wizard. The following table lists the parameters and their description.

Parameter Description
Development mode
  • OS mode: Tuya has adapted programs to chip platforms. You can directly focus on application development using the provided development kit.
    • What is in the development kit: development kit, tool, and kernel.
    • What to develop: application driver and application code.
  • SDK mode: Tuya provides the basic development kit that has the TuyaOS Kernel built in. You need to adapt to the target chip platform first before application development.
    • What is in the development kit: development kit and tool.
    • What to develop: Kernel, application driver, and application code.
Type development kit Various development kits are provided in terms of development frameworks and application scenarios.
Development Platform The chip platform that a development framework supports. Choose the chip platform according to the processor, manufacturer, category, and model.
TuyaOS version The version number is in the format xx.xx.xx.
Local project name Give your project a name.
Location Use the default location or enter a custom location.
Note: If you use a custom location, make sure that you have write permission for the specified directory.

You can click the link in the pop-up window to learn more about the development mode and type development kit you choose.

  • Introduction to development framework:

    Tuya Wind IDE
  • Introduction to type development kit:

    Tuya Wind IDE
  • Be sure to download the TuyaOS development framework in the correct development environment and use that framework accordingly. Click Finish to download the development kit.

    Tuya Wind IDE

Context menu

Tuya Wind IDE

In the following table, {project} represents the path of the current TuyaOS development framework, and {project}/software/apps/{application} represents the path of the application of the current TuyaOS development framework.

Context menu Feature Scope
Create Project Create an application. {project}/software/apps
Build Project Build the current application. {project}/software/apps/{application}
Clean Project Clean the build of the current application. {project}/software/apps/{application}
Config Project Configure the current application with a graphical interface (GUI). This action applies to product development kits that support dynamic configurations. {project}/software/apps/{application}
Flash App/Flash Prod Flash firmware to hardware. This action applies to Windows environments only. {project}/software/apps/{application}
Quick Start Development framework documentation. {project}/software/subdirectory
Tuya Home Log in or out of your account, and download or import a TuyaOS development framework. {project}/software/subdirectory
Show Project Information The information about all the development frameworks in the current VS Code workspace. {project}/software/subdirectory

Actions on development frameworks

You have a development kit opened in the workspace.

Tuya Wind IDE

Expand the software directory in the Explorer. Right-click on software or any subdirectory and choose Show Project Information. Click Development Framework in the left navigation pane of Tuya Home. The information about the development framework is displayed on the right side of the screen.

Switch between development frameworks

If the development framework has multiple versions, you will see a drop-down menu next to TuyaOS Version.

Tuya Wind IDE

Select the desired TuyaOS version from the drop-down menu.

Tuya Wind IDE

Click Switch to change to that version.

Tuya Wind IDE

Product development kit download

If a TuyaOS development framework provides a product development kit to download, the Product Dev Kit tab will appear on the page of Dev Framework information.

Tuya Wind IDE

Click Request Permission and complete the required information accurately to get access to the product development kit.

Request Permission is only available to enterprise developers, so be sure to enter the correct email address of the account manager that you are in touch with. If you have questions about the required information, contact your account manager.

Tuya Wind IDE
  • After you submit the request, you will get a message saying Your request for permission is being reviewed. Please wait.

    Tuya Wind IDE
  • After approval, you can download the requested product development kit.

    Tuya Wind IDE
  • The downloaded product development kit will be found in the directory software/TuyaOS/apps in the workspace.

    Tuya Wind IDE

Dynamic configuration of product development kit

Expand the software/TuyaOS/apps/xxx directory in the Explorer. Right-click on the xxx folder and choose Config Project.

  • If the product development kit supports configuration with a GUI, you can edit the configuration in the GUI and click Save.

    Tuya Wind IDE
  • If the product development kit does not support GUI-based configuration, you will get a prompt in the lower right corner.

    Tuya Wind IDE

Create an application

Expand the software/TuyaOS/apps directory in the Explorer. Right-click on the apps folder and choose Create Project.

Build an application

  1. Expand the software/TuyaOS/apps/xxx directory in the Explorer. Right-click on the xxx folder and choose Build Project. If the path is incorrect, you will get an error message in the lower right corner.

    Tuya Wind IDE

    If there is only one demo in the apps directory, the demo folder is shown behind the apps directory in Explorer due to the design of VS Code. You need to choose and right-click on the subdirectory of apps. Otherwise, you will get an error message in the lower right corner.

  2. Choose Build Project, enter the version number of the build in the format x.x.x, and hit the Enter key to confirm. The version number of the application for Bluetooth mesh and Beacon takes the format x.x and for other protocols, x.x.x is used.

    Tuya Wind IDE
  3. Wait for the IDE terminal to download the toolchain and build the project. The directory where the built firmware resides is shown in the terminal window.
    Tuya Wind IDE

Clean a build

  1. Expand the software/TuyaOS/apps/xxx directory in the Explorer. Right-click on the xxx folder and choose Clean Project.

    Tuya Wind IDE

    If there is only one demo in the apps directory, the demo folder is shown behind the apps directory in Explorer due to the design of VS Code. You need to choose and right-click on the subdirectory of apps. Otherwise, you will get an error message in the lower right corner.

  2. Choose Clean Project, enter the version number of the build in the format x.x.x, and hit the Enter key to confirm. The version number of the application for Bluetooth mesh and Beacon takes the format x.x and for other protocols, x.x.x is used.

    Tuya Wind IDE

Flash firmware

  • If your environment is a Linux virtual machine on Windows, find the flashing tool in the pc/tools directory. You can use the provided tools for firmware flashing and verification on Windows.
  • If your environment is Windows, you can use the Flash App and Flash Prod features on the context menu to flash the firmware.
  • Expand the software/TuyaOS/apps/xxx directory in the Explorer. Right-click on the xxx folder and choose Flash App.
    • Flash App erases data on the user area.
  • Expand the software/TuyaOS/apps/xxx directory in the Explorer. Right-click on the xxx folder and choose Flash Prod.
    • Flash Prod erases all the data.

Documentation navigation

  1. Right-click on software or other subdirectories and choose Quick Start.

    Tuya Wind IDE
  2. TuyaOS documentation navigation appears.

    TuyaOS development documentation includes:

    • hardware directory: documentation for embedded software development.
    • pc/tools directory: documentation for programs running on the host, such as the flashing tool.
    • software directory: documentation for demos and APIs.

    What you can do:

    • You can always go back to the documentation hub page by clicking TuyaOS Documentation Navigation in the top left corner.
    • Check TuyaOS API documentation.
    • Check TuyaOS Demo documentation.

Directory structure of API reference

  • Homepage: describes the current development kit.

  • Related webpages/developer guide: describes the development process, process diagram, and things to note.

  • Struct: provides information about the structs for use.

  • Files: describes functions, definitions, enumeration, macros, and more.

  • Search box: searches for any information about development with global search (default) and filters (such as structs and files).

    Fuzzy search is supported. For example, if you enter the character a, all relevant information will be returned.

    Tuya Wind IDE

Things to note for search

  • VS Code does not allow searching within the page. You can press Ctrl and click Homepage to open the current page in your system browser.

  • Then, you can search within the page.

Debug

Install a preferred debugging extension on VS Code.