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

Function Definition

Last Updated on : 2021-09-28 10:05:47download

Defining product functions is the first step in product development. It consists of three kinds of functions—standard functions, custom functions, and cloud functions. The following describes the typical function definition of the power statistics socket.

Standard function definition

1. Standard function DP list

DP ID DP Identifier Data Transmission Type Type Attribute Is Required
1 Switch 1 switch_1 Send and report bool true: open; false: closed required
9 Switch 1 countdown countdown_1 Send and report value Value range: 0 to 86400, interval: 1, multiple: 0, unit: s Required
17 Increase power add_ele Send and report value Value range: 0 to 50000, interval: 100, multiple: 3, unit: kwh Required
18 Current current cur_current Report only value Value range: 0 to 30000, interval: 1, multiple: 0, unit: mA Required
19 Current power cur_power Report only value Value range: 0 to 80000, spacing: 1, multiple: 1, unit: W Required
20 Current voltage cur_voltage Report only value Value range: 0 to 5000, spacing: 1, multiple: 1, unit: V Required
21 Production test result bit test_bit Report only value Value range: 0 to 5, interval: 1, multiple: 0, unit: Required
22 Voltage calibration coefficient voltage_coe Report only value Value range: 0 to 1000000, interval: 1, multiple: 0, unit: Required
23 Current calibration coefficient electric_coe Report only value Value range: 0 to 1000000, interval: 1, multiple: 0, unit: Required
24 Power calibration coefficient power_coe Report only value Value range: 0 to 1000000, interval: 1, multiple: 0, unit: Required
25 Electricity calibration coefficient electricity_coe Report only value Value range: 0 to 1000000, interval: 1, multiple: 0, unit: Required
26 Fault alarm fault Report only fault Fault value ov_cr, ov_vol, ov_pwr, ls_cr, ls_vol, ls_pow Required
38 Power-on status setting relay_status Send and report enum Enumeration value off, on, memory Optional
41 Cycle timer cycle_time Send and report string For protocol details, refer to the function details Optional
42 Random timer random_time Send and report string For protocol details, refer to the function details Optional

2. Cloud function
Turn on the Cloud timer function, you can set a repeated timer effective from Monday to Sunday. It can help turn on and off your devices at a fixed time. The time changes automatically between the daylight saving time and standard time.
Function Definition

Detailed function

  • Power statistics related functions

    • Increased power: It refers to the power consumption of the device. Each time the “incremental” is reported.

    • Current current, voltage, and power: It refers to the real-time parameters of the device. To reduce the interference of data reporting, when the parameters exceed a certain change threshold, the current real-time value will be reported.

    • Calibration coefficient: It is mainly used for calibration of measured data.

    • Fault reporting: It refers to the reporting of various fault values ​​such as overcurrent, overpower, overpower, undervoltage, etc.

  • Advanced timer function

    • Cycle timer: You can set 10 timers at most.

      • Every 10 bytes represents #1 channel number (bit0: switch; bit1 to bit7: channel number)
      • #2: weeks
      • #3 and #4: Start time (min)
      • #5 and #6: End time (min)
      • #7 and #8: Turn-on time (min)
      • #9 and #10: Turn-off time (min)
      • Week: 00 (single time) 01 (Sunday) 02 (Monday) 04 (Tuesday) ) 08 (Wednesday) 10 (Thursday) 20 (Friday) 40 (Saturday).
    • Random timer: You can set 16 timers at most.

      • Every 6 bytes represents #1 channel number (bit0: Switch, bit1 to bit7: Channel number. The slot number is 0 to 6)
      • #2: Week
      • #3 and #4: Start time (min)
      • #5 and #6: End time (min), with a maximum of 42 groups of characters: 6×2 bytes.
  • Power-on status setting

    Detailed enumeration value:

    • None: Turn off the indicator light. You are recommended to set it in the night environment to avoid interference with sleep.

    • Relay: Indicates the power. The indicator is on when it is connected.

    • POS: Indicates the position. The power indicator goes off when it is connected. You are recommended to set it in the night environment. You can find the switch socket conveniently at night. The function is similar to the fluorescent strip function in the traditional switch socket.
      Note: Only the io-controlled power indicator or the indicator that is also a power indicator are supported.