Function Definition

Last Updated on : 2023-07-17 09:22:20

Standard function DP type

DP types include Boolean, numeric, enumerated, fault, character, and RAW types.
Boolean type: a binary variable that is either true or false, such as a switch function;
Numerical value type: linearly adjustable numerical value type functions, such as temperature adjustment 20 to 40℃;
Enumeration value: a self-defined limited set of values, such as high, medium, and low gear positions;
Failure type: Function points specially used for reporting and counting failures, support multiple failures, and only report data;
String type: function points transmitted in the form of string;
Transparent transmission type: function points transparently transmitted in binary form.

Standard DP

Function point Identifier Transmission type Function point type Function point attributes Remarks
Switch switch_led can be issued and reported Boolean
Mode work_mode Can be issued and reported Enumeration type Enumeration value: white, colour, scene, music
White light brightness bright_value Can be issued and reported Numerical type Value range: 10-1000, spacing: 1, multiples: 0
Cooling and warming value temp_value Can be issued and reported Numerical type Value range: 0-1000, interval: 1, multiple: 0
Color light colour_data Distributable and reportable Character type
Scenario scene_data Can be issued and reported Character type
Countdown countdown Can be issued and reported Numerical type Value range: 0-86400, interval: 1, multiple: 0, unit: s
Music Rhythm music_data Release only Character type
Real-time adjustment control_data Distribution only Character type
Biorhythm rhythm_mode Can be issued and reported RAW type
Light to help sleep sleep_mode Can be issued and reported RAW type
Light wakeup wakeup_mode Can be issued and reported RAW type
Power-off memory power_memory Can be issued and reported RAW type The state that the light is on after power on
Do_not_disturb do_not_disturb can be issued and reported Boolean
Microphone music rhythm mic_music_data Can be issued and reported Character type

DP details description:

DP20(1): switch (required)

Type: Boolean
Value: true/false on/off

Example: {“20”:true}

DP21(2): Mode (required)

Type: Enum
Value: ”white”/”colour”/”scene”/”music”
White light mode/color light mode/scene/music light

Example: {“21”:“scene”}

Remark:
The TAB column of white light, color light, scene and music light is determined by DP point:
“White light” menu bar: mode and brightness DP are jointly determined
“IPL” menu bar: mode and color DP are jointly determined
“Scene” menu bar: mode and situation DP are jointly decided
“Music light” menu bar: mode and music light DP are jointly decided
“Countdown”: Determined by the countdown DP point
“Timing”: Determined by cloud function and cloud timing

DP22(3): White light brightness

Type: Numeric
Value: 10 – 1000

Example: {“22”:670 "}

Remark:
Brightness value 10-1000, corresponding to actual brightness 1%-100%, the lowest brightness display is 1%

DP23(4): Cooling and warming value

Type: Numeric
Value: 0-1000

Example: {“23”:797"}

Remark:
The color temperature range is 0-1000, corresponding to the actual color temperature of 0%-100%, corresponding to the warmest and coldest ranges respectively. The actual color temperature value depends on the hardware specifications, such as 2700K-6500K

DP24(5): IPL

Type: Character
Value: 000011112222
0000: H (chromaticity: 0-360, 0X0000-0X0168)
1111: S (saturation: 0-1000, 0X0000-0X03E8)
2222: V (Brightness: 0-1000, 0X0000-0X03E8)

Example: {“24”:“00DC004B004E”}

HSV (H,S,V): (HEX)(00DC, 004B,004E), converted to (DEC) to (220 degrees, 75%, 78%)

Remark:
The color is transmitted according to the HSV system, or it can be converted to the RGB color system through an algorithm Reference URL
RGB (R,G,B) can be obtained: (HEX)(32,64,C8),(DEC)(50,100,200)

DP25(6): Situation

Type: Character
Value: 0011223344445555666677778888
00: Scene number
11: Unit switching interval time (0-100)
22: Unit change time (0-100)
33: Unit change mode (0 static, 1 jump, 2 gradual change)
4444: H (chromaticity: 0-360, 0X0000-0X0168)
5555: S (saturated: 0-1000, 0X0000-0X03E8)
6666: V (Brightness: 0-1000, 0X0000-0X03E8)
7777: White light brightness (0-1000)
8888: Color temperature value (0-1000)
Note: The numbers 1-8 correspond to as many groups as there are units

Example: {“25”:“010b0a02000003e803e8000000000b0a02007603e803e8000000000b0a0200e703e803e800000000”}

01: Scene number 01
0b: Unit switching interval time (0)
0a: Unit change time (10)
02: Unit change mode: gradual change
0000: H (chromaticity: 0X0000)
03e8: S (saturated: 0-1000, 0X0000-0X03E8)
03e8: V (Brightness: 0-1000, 0X0000-0X03E8)
0000: White light brightness (0-1000)
0000: color temperature value (0-1000)

DP26(7): Countdown

Type: Numeric
Value: 0-86400
The data unit is second, which corresponds to a value of 60 for one minute, and the maximum setting is 86400=23 hours and 59 minutes
0 means off

Example: {“26”:“120”}
120 seconds, or 2 minutes

Remark:
This function point determines whether the countdown function appears

DP27(8): Music rhythm

Type: String
Value: 011112222333344445555
0: Change mode, 0 means direct output, 1 means gradual change
1111: H (chromaticity: 0-360, 0X0000-0X0168)
2222: S (saturation: 0-1000, 0X0000-0X03E8)
3333: V (Brightness: 0-1000, 0X0000-0X03E8)
4444: White light brightness (0-1000)
5555: Color temperature value (0-1000)

Example: {“27”:“1007603e803e800120025”}

0: Change mode, 0 means direct output, 1 means gradual change
Example description:
1: Change mode, 1 means gradual change
0076: H (chromaticity: 0X0076)
03e8: S (saturation: 0X03e8)
03e8:: V (Brightness: 0X03e8)
0012: Brightness (18%)
0025: Color temperature (37%)

Remark:
This function point and the mode function point together determine whether to display the music light

DP28(9): Real-time adjustment

Type: String
Value: 011112222333344445555
0: Change mode, 0 means direct output, 1 means gradual change
1111: H (chromaticity: 0-360, 0X0000-0X0168)
2222: S (saturation: 0-1000, 0X0000-0X03E8)
3333: V (Brightness: 0-1000, 0X0000-0X03E8)
4444: White light brightness (0-1000)
5555: Color temperature value (0-1000)

Example: {“28”:“1007603e803e800120025”}

1: Change mode, 1 means gradual change
0076: H (chromaticity: 0X0076)
03e8: S (saturation: 0X03e8)
03e8:: V (Brightness: 0X03e8)
0012: Brightness (18%)
0025: Color temperature (37%)

Remark:
This DP is used for real-time data delivery during panel adjustment

DP30: Biorhythm

Type: RAW type

The protocol fields are designed as follows

Version Number Task Switch Select Mode Date Setting Number of Nodes Node 1 Node N
1byte:0x00 1byte 1byte 1byte 1byte 9byte 9byte

Note: 0x01 version protocol adds 1 byte “parameter mode” field

Version Number Task Switch Select Mode Date Setting Parameter Mode Number of Nodes Node 1 Node N
1byte:0x01 1byte 1byte 1byte 1byte:
0x01: BT only
0x02: HSV only
0x03: HSVBT
1byte 5~9byte 5~9byte

Protocol field description

Field Serial Number Node Length Data Representation Description
Version number 1 / 1byte 0x00: Initial version
Task switch 2 / 1byte 0x00: task is closed, 0x01: task is open
Mode selection 3 / 1byte 0x00: The gradual change between the two nodes, 0x0F: The gradual change starts after reaching the node time, and the gradual completion time is the value of this field. The minimum allowable value is 15. For example: 0x0F means the gradual change is completed 15 minutes after the node time is reached
Date setting 4 / 1byte Analyze the specific byte position, take effect on a certain day, the corresponding position is 1, see the following date description
Number of nodes 5 / 1byte 0x01: 1 node. Range allowable value 1~8
Node switch 6 Node1 1byte The priority of the node switch is lower than that of the task switch, and the status of the node switch is judged only when the task switch is turned on. 0x00: The node is disabled and does not take effect; 0x01: The node is enabled and takes effect
Hour 6 Node 1 1byte 0x10: hex code, 16 points, range allowable value 0~23
Minutes 6 Node1 1byte 0x10: hex code, 16 points, range allowed value 0~59
Hue 6 Node 1 2byte 0x03, 0x10: hex code. In big-endian format, the first byte represents the hundreds digit, and the second byte represents the tens digit and the ones digit. The actual value means 316, and the allowable range is 0~360
Saturation percentage 6 Node 1 1byte 0x10: hex code, 16%; range allowed value 0~100
Brightness Percentage 6 Node 1 1byte 0x10: hex code, 16%; the allowable value range is 1~100
Brightness Percentage 6 Node 1 1byte 0x10: hex code, 16%; allowable value range 1~100
Color temperature percentage 6 Node 1 1byte 0x10: hex code, 16%; range allowed value 0~100
/ 7 Node 2 / /
/ 13 Node 8 / /

Date description
If all 0s are used, it means single mode, which only takes effect once; otherwise, it is cyclic mode. It is judged whether the corresponding bit is set to 1, and position 1 means it takes effect on the same day. For example, 0x42 means that the task takes effect on Saturday and Monday (note that the corresponding task switch must be turned on)

Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

DP31: Light to help sleep

Protocol field description

Field Serial Number Node Length Data Representation Description
Version number 1 / 1byte 0x00: Initial version
Number of task nodes 2 / 1byte 0x01: 1 node; 0x02: 2 nodes; 0x03: 3 nodes; 0x04: 4 nodes
Task switch 3 Node1 1byte 0x00: task is off; 0x01: task is on
Date setting 3 Node 1 1byte Analyze the specific byte position, take effect on a certain day, the corresponding position is 1, see the date description later
Gradation step value 3 Node1 1byte 0x10: hex code, a step of 5 minutes, 16*5=90 minutes of gradation time. Allowable value range 1~24
Starting hour 3 Node1 1byte 0x10: hex code, 16 points. Range allowable value 0~23
Starting minute 3 Node1 1byte 0x10:hex code, 16 points. Range allowable value 0~59
Hue 3 Node1 2byte 0x03, 0x10: hex code. In big-endian format, the first byte represents the hundreds digit, and the second byte represents the tens digit and the ones digit. The actual value means 316, and the allowable range is 0~360
Saturation Percentage 3 Node 1 1byte 0x10: hex code, 16%; range allowed value 0~100
Brightness Percentage 3 Node1 1byte 0x10: hex code, 16%; the allowable value range is 1~100
Brightness Percentage 3 Node 1 1byte 0x10: hex code, 16%; the allowable value range is 1~100
Color temperature percentage 3 Node 1 1byte 0x10: hex code, 16%; range allowed value 0~100
/ 4 Node 2 / /
/ 6 Node 4 / /

Date description
If all 0s are used, it means single mode, which only takes effect once; otherwise, it is cyclic mode. It is judged whether the corresponding bit is set to 1, and position 1 means it takes effect on the same day. For example, 0x42 means that the task takes effect on Saturday and Monday (note that the corresponding task switch must be turned on)

Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

DP32: Wake up from light

Protocol field description

Field Serial Number Node Length Data Representation Description
Version number 1 / 1byte 0x00: Initial version
Number of task nodes 2 / 1byte 0x01: 1 node; 0x02: 2 nodes; 0x03: 3 nodes; 0x04: 4 nodes
Task switch 3 Node1 1byte 0x00: task is off; 0x01: task is on
Date setting 3 Node 1 1byte Analyze the specific byte position, take effect on a certain day, the corresponding position is 1, see the date description later
Gradation step value 3 Node1 1byte 0x10: hex code, a step of 5 minutes, 16*5=90 minutes of gradation time. Allowable value range 1~24
Starting hour 3 Node1 1byte 0x10: hex code, 16 points. Range allowable value 0~23
Starting minute 3 Node1 1byte 0x10:hex code, 16 points. Range allowable value 0~59
Hue 3 Node1 2byte 0x03, 0x10: hex code. In big-endian format, the first byte represents the hundreds digit, and the second byte represents the tens digit and the ones digit. The actual value means 316, and the allowable range is 0~360
Saturation Percentage 3 Node 1 1byte 0x10: hex code, 16%; range allowed value 0~100
Brightness Percentage 3 Node1 1byte 0x10: hex code, 16%; the allowable value range is 1~100
Brightness Percentage 3 Node 1 1byte 0x10: hex code, 16%; the allowable value range is 1~100
Color temperature percentage 3 Node 1 1byte 0x10: hex code, 16%; range allowed value 0~100
Maintenance time 3 Node1 1byte 0x10:hex code, a step of 5 minutes. After the gradual change is completed, continue for this time and then turn off the light. Allowable value range: 0~24, 0 means do not turn off the light, 24 means turn off the light after 120 minutes
/ 4 Node 2 / /
/ 6 Node 4 / /

Date description
If all 0s are used, it means single mode, which only takes effect once; otherwise, it is cyclic mode. It is judged whether the corresponding bit is set to 1, and position 1 means it takes effect on the same day. For example, 0x42 means that the task takes effect on Saturday and Monday (note that the corresponding task switch must be turned on)

Reserved Saturday Friday Thursday Wednesday Tuesday Monday Sunday
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

DP33: Power-off memory

The protocol fields are designed as follows

Field Length Data Representation Description
Version number 1byte 0x00: Initial version
Mode 1byte 0x00 initial default value, 0x01 restore memory value, 0x02 user customization
H 2byte Hue
S 2byte Saturation
V 2byte Value
Bright 2byte Brightness
Temperature 2byte Temperature

DP34: Do not disturb

Type: Boolean
Value: true/false on/off

Example: {“34”:true}

DP42: Microphone music rhythm

Type: Character
Value: 0011223344556666777766667777…66667777
00: version
11: 0-close, 1-open
22 mode number, customized starting from 201
33 Transformation mode: 0-breathing mode, 1-jumping mode, 2-classic mode
44 Speed ​​of change
55 Sensitivity
6666: Color 1-Hue
7777: Color 1-Saturation
The numbers 6 and 7 correspond to as many groups as there are units

Example: {“42”:“000100016432000003e8007803e800f003e8003c03e800b403e8012c03e8”}

00: version 0
01: open
00: Mode number 0
01: Change mode is jump mode
64: Change speed 100%
32: Sensitivity 50%
0000: Color 1-Hue
03e8: Color 1-Saturation
0078: Color 2-Hue
03e8: Color 2-Saturation

012c: Color 6-Hue
03e8: color 6-saturation

Custom functions

You can customize functions that are not supported by standard function. Data point (DP) is the abstract representation of function, and each function can be defined by different function types. Six data types, namely Boolean, Integer, Enum, Fault, Char type, and RAW type.
Custom DP does not support third-party voice and third-party cloud docking. If you have good suggestions for the expansion of our standard DP. It is recommended to submit a ticket. Tuya will help create standard data functions as soon as possible.
Function Definition
DP ID is synonymous with the function, and the function name is used to quickly distinguish the function represented by the function.
The identification name is the unique identity that distinguishes functions in the product software.
You can select the type according to the DPs. The Tuya IoT Platform supports six data types, including Boolean, value, enum, fault, string, and raw.
Function Definition

  • Bool: Binary variable (true or false), such as the function of the switch.

  • Value: Apply to the data that can be linearly adjusted, such as adjusting the temperature. You should set the value range, spacing, and scale value. The scale value can be set to 0, 1, 2, 3 and transmitted in the exponential conversion of 10, suitable for decimals.

  • Enum: a self-defined limited set of values, you need to set the enumeration value and confirm with Enter. It supports numbers, letters, and underscores, such as high, mid, and low gears;

  • Fault: specified for fault report and statistics. Support Only report when multiple faults occur.

  • RAW : It indicates data transfer in a raw binary format.

The data transmission type is divided into send and report, send only, and report only. Select a type according to product functions and the panel.
Send and report: Command data can be sent to the device, and device data can be reported to the cloud.
Report only: Data can only be reported from the device.
Send only: Data can only be sent from the cloud.

Advanced functions

Cloud timing: Tuya Cloud’s provides cloud timing without local timing.
Human central lighting required: Create a lighting system that adapts to the circadian rhythm.
Jumping Page: With a link, users can navigate to another page, such as the online store and user guide.
Function Definition