Last Updated on : 2024-01-04 08:19:29download

This topic describes the common issues with TuyaOS central control development and solutions to them. If you cannot find the answers to your questions, you can post them on the Tuya Developer Forum.

What is a demo program?

A demo program is a virtual central control device running on the Ubuntu system. You can add it to the Tuya Smart app. After the virtual device is added to a home, it will traverse and operate other devices in the home once as a demonstration. The demonstration and example code help familiarize yourself with the process of central control device development.

How can I use the demo program?

  1. Pull the code and compile it in Tuya Wind IDE. The build output is located in the output folder.
  2. Open the config.json file in the project and replace the PID, UUID, and Authkey with your own values.
  3. Run the program and scan the QR code shown on the screen to add the virtual device to your home. The demo program should then run smoothly.

How to generate QR codes for a virtual device?

The QR code must be created manually. After the virtual device operates, shorturl : https://XXX.XXXX.XXX/XXX will be printed. You can search for the keyword shorturl and get the URL, which can be used to generate a QR code.

How to check logs?

After you connect the Android Debug Bridge (ADB), run the command tail -f /tmp/tuya.log to read the log.

Can the DP control music playback?

tuya_user_voice_dp_report_ctrl_cmd implements local DP control, but does not support the previous and next actions currently. The API featuring this functionality is expected to be available in the future.

Why can the device be added to the Tuya Smart app by QR code scanning, but not to the OEM app?

This could be due to a problem with the OEM app. Consult the OEM app manager for assistance in troubleshooting. If the OEM app can pair with other devices but not with the central control, consult the FAE to check for issues with the pairing process.

Does the SDK support LAN control?

Yes, it does.
To enable device control over LAN, a master must be selected from multiple gateways to handle message forwarding. Selecting a master requires an internet connection. Once the internet is connected, make sure to select a master, enabling LAN control even without an internet connection. If no internet is available after a restart, the cached master data will be used to select a master.

What is the maximum number of stable connections?

The maximum number of devices that can be stably connected depends on the processing capacity of the device, theoretically without limit. The result of a comprehensive test on the Tuya-enabled gateway indicates that up to 128 devices can be connected and run properly.

Can the rooms be sorted?

Sorting rooms on the app will not be updated accordingly on the SDK. This feature will be implemented in the future.

How to unbind a device with no internet connection?

A device that becomes unbound when the internet is disconnected cannot be bound again.
Do not call tuya_iot_gw_reset when the internet is disconnected. Make sure to check the network status before calling this API. Otherwise, the device is only unbound locally but remains in a bound state in the cloud. In this case, the device cannot be bound by scanning a QR code, but can only be discovered over LAN. Alternatively, you can unbind the device using the app and then bind it again.

The recommended logic:

Factory reset
Check network
Invoke ty_iot_gw_reset
Delete data in
reset_cb callback