Copied!
Private Cloud
  • Application Development Services
    • Quick Start
    • API Gateway
      • API Request
        • Request Structure
        • Authorization Method
        • Sign Requests
        • Global Error Codes
      • Best Practice
        • Set Postman Environment and Call API Operations
      • API List
        • Basic API
          • Authorization Token Management
            • Refresh Token
            • Get a Token
        • IoT Core
          • Device Management
            • Query Devices in Space
            • Get Status Reporting Log
            • Get Update Progress
            • Query Device Details in Bulk
            • Delete Device
            • Get Update Information
            • Query Device Details
            • Confirm Start of Update
            • Get Device State
            • Get Operation Log
            • Modify Basic Properties
            • Freeze/Unfreeze Device
            • Transfer Device
            • Restore Factory Defaults
            • Query Pairing Result
          • Device Control
            • Send Property
            • Query Properties
            • Modify Properties
            • Set Desired Property
            • Query Desired Properties
            • Query Things Data Model
            • Device Control (Standard Instruction Set)
              • Get Status Set
              • Send Commands
              • Get Specifications and Properties of the Device
              • Get Instruction Set of the Device
              • Get Instruction Set of the Category
              • Get Status of a Single Device
              • Get Latest Status of Multiple Devices
          • Device Group
            • Create Group
            • Delete Group
            • Query Group
            • Rename Group
            • Get Group in Space
            • Add Device
            • Delete Devices
            • Get Device Group
            • Query Group Properties
            • Send Group Properties
            • Query Group Devices
    • Message Gateway
      • Preparations
      • Development Guide
        • Integrate with Message Service
        • Data Signature
        • Message Types
      • Best Practices
        • Get Push Messages by Pulsar (Java SDK)
        • Get Push Messages by Pulsar (Python SDK)
        • Get Push Messages by Pulsar (Go SDK)
        • Get Push Messages by Pulsar (Node.js SDK)
        • Get Push Messages by Pulsar (C# SDK)
  • App Development
    • Preparation
    • Developer Guide for iOS
      • Fast Integration with Cube App SDK for iOS
      • Upgrade Guide
      • Quick Start with Cube App SDK for iOS
      • iOS App: Implement User Account Features
      • User Account Management (iOS)
        • Register and Login with Phone Number
        • Register and Login with Email Address
        • Login with UID
        • Login with Third-Party Account
        • Register and Login with Anonymous Account
        • QR Code-Based Login Authorization
        • Manage User Accounts
      • Home Management
        • Home Information Management
        • Room Information Management
        • Member Information Management
      • Device Pairing (iOS)
        • Wi-Fi EZ Mode
        • AP Mode
        • Wired Mode
        • Sub-Device Pairing
        • NB-IoT Device Pairing
        • HomeKit Device Pairing
        • Pegasus Pairing
        • CPPLUS Link-Based Device Binding
        • Matter Devices
          • Prepare for Integration with Matter Device
          • Pair Matter Device
        • Pair with QR Code on Device
      • Bluetooth Devices
        • Bluetooth Mesh
        • CPPLUS Mesh
      • Device Management
        • Firmware Update
        • Query Reported DP Logs
        • Device Sharing
        • Backup Wi-Fi Networks
        • Offline Device Alerts
        • CPPLUS Link-Based Devices
        • Manage Matter Devices
      • Device Control
        • Multi-Control Linkage
        • Scheduled Tasks
        • Group Management
        • All Category Control Panel
        • Air Conditioning Category Control Panel
        • Switch Control Panel
        • Device DP Parser
      • Smart Scenes
        • Scene Recommendation
      • Common API Methods
      • Integrate with Push Notifications
      • Message Management
        • Configure Push Notifications
        • Message Capabilities
      • Configure Widget Project
      • Error Codes
      • FAQ
      • Extension SDK
        • IPC SDK
          • SDK Architecture
          • Fast Integration with IPC SDK for iOS
          • Quick Start with IPC SDK for iOS
          • IPCs
          • Device Pairing
          • IPC Control (iOS)
          • Live Video Streaming
          • Playback of Video Stored on SD Card
          • SD Card Management
          • Audio and Video Features
          • Low Power Doorbell
          • PTZ Control
          • Doorbell Call Service
          • Cloud Storage
          • Cloud Storage Debugging Tool
          • Detection Alerts
          • Encrypted Images
          • Timeline View
          • Offline Log
          • Migrate IPC UI BizBundles
          • P2P Capabilities
          • IPC SDK Automated Test Tool
          • IPC SDK Test Cases (Reference)
          • FAQ
          • Error Codes
        • Sweeper SDK
          • P2P Download from Robot Vacuums
          • Gyroscope and Visual Robot Vacuums
          • Laser Robot Vacuum
          • Voice Package Download
          • Error Codes
          • Sample Code
        • Smart Lock SDK
          • Wi-Fi Lock
          • Bluetooth Lock
          • Wi-Fi Lock Audio and Video Capability
          • Smart Lock Basic API
      • What is UI BizBundle SDK for iOS?
        • Preparation
        • Integrate with Framework
        • Home Management UI BizBundle
        • Device Pairing UI BizBundle
        • Scene UI BizBundle
        • Multi-Control Linkage UI BizBundle
        • Device Control UI BizBundle
        • OTA UI BizBundle
        • Group Management UI BizBundle
        • Device Details UI BizBundle
        • Panel Multilingual BizBundle
        • IPC UI BizBundles
        • Cloud Storage UI BizBundle
        • FAQ UI BizBundle
        • Message Center UI BizBundle
        • Voice Skills Account Linking UI BizBundle
        • Theme Color Configuration BizBundle
        • Sharing UI BizBundle
      • Changelog
    • Developer Guide for Android
      • Fast Integration with Cube App SDK for Android
      • Upgrade Guide
      • User Account Management
        • Register and Login with Phone Number
        • Register and Login with Email Address
        • Login with UID
        • Login with Third-Party Account
        • Register and Login with Anonymous Account
        • QR Code-Based Login Authorization
        • Manage User Accounts
      • Home Management
        • Home Information Management
        • Room Information Management
        • Member Information Management
      • Device Pairing (iOS)
        • Wi-Fi EZ Mode
        • AP Mode
        • Wired Mode
        • Pair with QR Code on Device
        • Pegasus Pairing
        • Sub-Device Pairing
        • NB-IoT Device Pairing
        • CPPLUS Link-Based Device Binding
        • Matter Devices
          • Prepare for Integration with Matter Device
          • Pair Matter Device
        • Pair with QR Code on Device
      • Bluetooth Devices
        • Bluetooth LE Devices
        • Bluetooth Mesh
        • CPPLUS Mesh
      • Device Management
        • Firmware Update
        • Query Reported DP Logs
        • Device Sharing
        • Backup Wi-Fi Networks
        • Notifications of Devices Getting Offline
        • CPPLUS Link-Based Devices
        • Manage Matter Devices
      • Device Control
        • Sub-Device Control Through Zigbee Gateway
        • Multi-Control Linkage
        • Scheduled Tasks
        • Group Management
        • Device DP Parser
      • Smart Scenes
        • Scene Recommendation
      • Common API Methods
      • Integrate with Push Notifications
        • Integrate with FCM Push
        • Integrate with Xiaomi Push Notifications
        • Integrate with Huawei Push Notifications
      • Message Management
        • Configure Push Notifications
        • Message Capabilities
      • Error Codes
      • FAQ
      • Extension SDK
        • IPC SDK
          • IPC SDK Architecture
          • Fast Integration with IPC SDK for Android
          • IPCs
          • Device Pairing
          • Live Video Streaming
          • SD Card-Stored Video Playback
          • SD Card Management
          • Audio and Video Features
          • Cloud Storage
          • Cloud Storage Debugging Tool
          • Alert List
          • Video Alerts
          • Low Power Doorbell
          • Encrypted Images
          • Timeline View
          • P2P Capabilities
          • IPC SDK Automated Test Tool
          • IPC SDK Test Cases (Reference)
          • Error Codes
          • SDK Log
          • Changelog
        • Sweeper SDK
          • P2P Download from Robot Vacuums
          • Gyroscope and Visual Robot Vacuums
          • Laser Robot Vacuum
          • Voice Package Download
          • Changelog
          • Error Codes
          • Sample Code
        • Smart Lock SDK
          • Wi-Fi Smart Lock
          • Bluetooth Smart Lock
          • Wi-Fi Smart Lock Audio and Video Capabilities
          • Zigbee Lock
          • Smart Lock Basic API
          • Changelog
      • What is UI BizBundle SDK for iOS?
        • Preparation
        • Integrate with Framework
        • Home Management UI BizBundle
        • Device Pairing UI BizBundle
        • Generic Pairing BizBundle
        • Device Control UI BizBundle
        • Multi-Control Linkage UI BizBundle
        • Scene UI BizBundle
        • Group Management UI BizBundle
        • Device Details UI BizBundle
        • OTA UI BizBundle
        • IPC UI BizBundles
        • Cloud Storage UI BizBundle
        • Message Center UI BizBundle
        • FAQ UI BizBundle
        • Maps Service UI BizBundle
        • Voice Skills Account Linking UI BizBundle
        • Panel Multilingual BizBundle
        • Theme Color Configuration BizBundle
        • Sharing UI BizBundle
        • FAQ
      • Changelog
  1. Home
  2. Application Development Services
  3. API Gateway
  4. Device Control

Device Control

Last Updated on: 2024-09-10 07:19:13

Device control is a process of implementing functional control and state changes of IoT devices. Cloud service APIs enable you to send control instructions to devices and query the states reported by the devices so as to perceive changes in the operating states of the devices.

Concepts

Property

A property is used to describe the specific information and states of a device at runtime, also known as a data point (DP) in some scenarios. You can call the property APIs to query and modify the states of device parameters.

For example, in the scenarios of colored lights, you can make API requests that modify the color, brightness, and other properties of the colored lights to achieve the desired display effect.

  • System procedure:

    DeviceCloudAppSend propertiesControl the device1Send properties2Return results3Send an instruction ofquerying or modifying theproperties4Return results5Report propertiesA message of reportingproperties6The cloud verifiesand saves thereported properties78A message of reportingproperties9Query propertiesView the devicestate10Query properties11The state of properties12DeviceCloudAppQuery and modify properties
  • List of APIs:

    Service name API endpoint Description
    Send Property POST: /v2.0/cloud/thing/{device_id}/shadow/properties/issue Immediately send a property setting instruction to the specified device.
    Query Properties GET: /v2.0/cloud/thing/{device_id}/shadow/properties Query the property states recently reported by the device to the cloud.
    Modify Properties POST: /v2.0/cloud/thing/{device_id}/shadow/properties Modify the property states recently reported by the device to the cloud.
    Report device properties bizCode: devicePropertyMessage Receive a notification message that the device properties have been reported.
Desired properties

Device desired properties mean that if the device is offline when you set device properties, the cloud can cache the values that need to be set. After the device goes online, the device gets the desired properties from the cloud.

For example, a low-power device might be periodically put to sleep or woken up, instead of maintaining a persistent connection to the cloud. A device in sleep mode cannot receive instructions from the cloud. Therefore, the desired properties feature makes it possible to send instructions to offline devices. Device instructions are saved in the cloud. After the device is online, the device actively pulls the instructions from the cloud.

  • System procedure:

    DeviceCloudAppSend desired propertiesControl the device1Set desired properties2Save desiredproperties3Set successfully4The device pulls instructionsWake up the device5Connect to the cloud6Query desired properties onthe device7Return an instruction ofsending properties8Execute theinstruction9Query sending stateView the sendingstate10Query desired properties inthe cloud11Return the state of desiredproperties12DeviceCloudAppSet desired properties
  • List of APIs:

    Service name API endpoint Description
    Set Desired Property POST: /v2.0/cloud/thing/{device_id}/shadow/properties/desired Store the instruction of sending device properties in the cloud. When the device is woken up, the instruction is sent from the cloud to the device.
    Query Desired Properties GET: /v2.0/cloud/thing/{device_id}/shadow/properties/desired Query the property sending instructions in the cloud.
Things data model

The things data model describes an abstraction of physical devices. It defines the characteristics and behaviors of a type of device that connects to the cloud. This model defines an abstract representation of a device as a set of properties, actions, and events, and determines how a connected physical device interacts with the cloud applications.

  • You can call the things data model APIs to query metadata of device functional definitions.
  • This model provides detailed definitions of functional parameters, helping you complete various functional development, such as dynamic rendering of panels and data analytics.

For example, a colored light might have properties such as color, brightness, and switch. The color has three valid values of red, yellow, and blue, and the switch has two valid values of on and off. The following case gives you insight into the data structure of the things data model.

{
    "modelId":"000000er..",
    "name":"Colored Light",
    "services":[
        {
            "code":"",
            "properties":[
                  {
                    "abilityId": 1,
                    "code":"switch",
                    "name":"Switch",
                    "accessMode":"rw",
                    "typeSpec":{
                        "type":"bool"
                    }
                },
                {
                    "abilityId": 2,
                    "code":"color",
                    "name":"Color",
                    "accessMode":"rw",
                    "typeSpec":{
                        "type":"enum",
                        "range":["red", "yellow", "blue"]
                    }
                }
            ]
        }
    ]
}

The following table lists the APIs offered by Tuya.

Service name API endpoint Description
Query Things Data Model GET: /v2.0/cloud/thing/{device_id}/model Query the things data model defined for the specified device.

More capabilities

Besides the device control APIs mentioned herein, Tuya also provides another set of device control solutions based on standard instruction sets. They can be used to control devices in the same category from multiple manufacturers. For more information, see Device Control (Standard Instruction Set).

  • Prev Doc Query Pairing Result
  • Next Doc Send Property
This page contains content