English
English
简体中文
Contact Us
Register
Log In
Language
English
English
简体中文
Contact Us
Log In
Register
Go to main website
App Develop

App Development

Tuya provides multiple mobile app development methods such as no-code or IoT App SDK development to maximize the monetization of IoT apps.
layoutIndex
IoT App SDKConceptsDevice Control

Device Control

Last Updated on : 2021-09-03 01:49:38download

IoT devices have gained ground in many homes and industries. Increasing importance has been attached to the implementation of secure and flexible device control and management. Therefore, well-engineered features can be integrated to achieve these purposes, such as device control, group management, smart scenes, multi-control linkage, and scheduled tasks. This topic describes the helpful knowledge about IoT device control by mobile apps.

The device control capabilities mentioned in this topic apply to the development of Tuya IoT mobile apps. Whether your App SDK provided by a third party supports a certain control method only depends on that App SDK.

Scenarios

  • In simple scenarios, a mobile app is used to control only one device, or simultaneously control multiple devices.

    Device Control

  • In some other scenarios, devices are required to be controlled by multiple users or dependent on the status of other devices. For example, a smart lock must support locking or unlocking by all home members. In this case, the following requirements must be met: a mobile app can be used to control multiple devices. Multiple users can be authorized to mutually control multiple devices.

    Device Control

Device functions

To simplify device control, Tuya abstracts each function of IoT devices into a data point (DP) that defines the current device status.

  • DPs are defined in different types, such as Boolean, enumeration, and integer. For more information about the supported data types, see Custom Functions.
  • DPs have read and write attributes. For example, to read means to get the current value of a switch, and to write means to change the current value of the switch. A 2-gang switch has two Boolean DPs, and each DP has either a True or False value, which is readable and writable.

Tuya describes the capabilities and functionality of an IoT device as a things data model, which is mapped to the concept of Product on the Tuya IoT Platform. You can check the definitions of DPs for a product on the Tuya IoT Platform. The following figure shows the definitions of the standard functions for an example product.

Device Control

Tuya allows mobile apps to send a control command to a device and achieve the desired functionality. The following line shows the command format. The DP value depends on the function definition for the product on the Tuya IoT Platform.

{
	"<dpId>":"<dpValue>"
}

Smart scenes

To meet your needs in smart scene configuration, Tuya IoT App SDK provides APIs that enable customized smart scenes. If the status of a smart device changes, or if an environmental condition changes, other certain smart devices have their switches or status changed. This is how a smart scene works.

Device Control

Smart scenes include the following types: Automation and Tap-to-Run.

Automation

Users can set specific conditions to run a smart scene. When the conditions are met, the Automation scene is automatically triggered. The following condition types are supported:

  • Weather condition: includes temperature, humidity, weather, PM2.5, air quality, sunrise, sunset, and more.
  • Device condition: Users can predefine a device condition in a specific scene. When this condition is met, the task in the specified scene will be triggered. The same device cannot be used as a condition and a task at the same time. Otherwise, operation conflicts might occur.
  • Scheduled task: A task can be scheduled to automatically run at a specific time.

Scene actions

Users can add actions to a Tap-to-Run smart scene. Later, they can tap the scene to run it when needed. Scene actions support the following types of objects:

  • Single device
  • Device groups
  • Triggered scene
  • Automated startup
  • Automated disabling
  • Delayed action

Device groups

A device group includes devices of the same type and gathers a series of devices. Wi-Fi and Zigbee devices can be grouped in most cases.

Users can create different groups of devices on an IoT mobile app by region, type, permissions, or other rules. This allows numerous devices to be managed in bulk. For example, firmware updates can be performed for multiple groups of utility meters in a specific project.

Device Control

Scheduled tasks

Tuya Smart provides basic capabilities of scheduled tasks for devices and device groups.

The app can be used to set a scheduled task based on specific scheduled task API calls. Then, smart devices will automatically run predefined tasks. A smart device supports multiple scheduled tasks. A scheduled task supports multiple timers.

Device Control

Multi-control linkage

In this feature, a device feature is linked with a feature of another device to create a multi-control group. When a device of the multi-control group is controlled, the linked status of other devices in the group is synchronously changed.

For example, 3 two-gang Zigbee sub-device switches, the first DP of each switch is linked with the first DP of the other two switches to create a multi-control group. When the first DP for one of these switches is set to off, the first DP of the other two switches is synchronously set to off.

Device Control

Panel control

Tuya provides native control panels that are developed with native code. Panel control support most Powered by Tuya products and DPs, and features fast response and high compatibility. You can easily integrate panel libraries into your project to implement all-around capabilities for products in Tuya’s ecosystem.

Device Control Device Control

References

Service iOS Android
Smart Life App SDK Device control Device control
Commercial Lighting App SDK Device control Device control