Function Definition

Last Updated on : 2023-12-21 07:31:25download

Types of data point (DP)

Tuya IoT Platform allows you to define functions with six data types, including bool, value, enum, fault, string, and RAW.
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.
Enum value: A custom finite set of values, such as the high, medium, and low levels.
Fault: specified for fault report and statistics. Support Only report when multiple faults occur.
Char type: It indicates data transfer in CHAR type.
RAW type: It indicates data transfer in a RAW binary format.

Standard DPs

Standard DPs

Data point Identifier Transmission Type DP type DP property Remarks
Switch switch_led Send/report Bool
Mode work_mode Send/report Enum The enum values include white, color, scene, and music.
Brightness bright_value Send/report Integer The value ranges from 10 to 1,000, with a pitch of 1 and a scale of 0.
Color temperature temp_value Send/report Integer The value ranges from 0 to 1,000, with a pitch of 1 and a scale of 0.
Colored light colour_data Send/report String
Scene scene_data Send/report String
Countdown countdown Send/report Integer The value ranges from 0 to 86400, with a pitch of 1 and a scale of 0. Unit:s.
Music music_data Send only String
Adjust control_data Send only String
Smart Scene scene_list Report only RAW
Select a scene scene_select Send/report RAW
Scene loop scene_combine Send/report RAW
Scene reset scene_factory Send/report RAW

Description of DPs

DP20(1): on/off (required)

Type: Boolean
Value: true/false. Turn on or turn 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”}

Note:
White light, colored light, scene, and music light are displayed at the bottom tab on the mobile app.

  • White light: determined by two DPs together, mode and brightness.
  • Colored light: determined by two DPs together, mode and color.
  • Scene: determined by two DPs together, mode and scene.
  • Music light: determined by two DPs together, mode and music.
  • Delay time: determined by the DP timer.
  • Schedule: determined by the enablement of cloud timing in the advanced cloud functions.

DP22(3): brightness

Type value

  • Value: 10 – 1000
  • Example: {“22”:670 "}

Note: The brightness range of 10 to 1,000 corresponds to the value range of 1% to 100% on the mobile app. The minimum value is 1%.

DP23(4): color temp

Type value
Value: 0-1000
{“23”:797"}

Note: The color temperature range is from 0 to 1,000. It is defined between the coolest white and warmest white. The actual color temperature depends on the bead specifications, such as 2700K to 6500K.

DP24(5): color

  • Data type: string
  • Value: 000011112222
  • 0000: H (hue: 0–360, 0X0000–0X0168)
  • 1111: S (saturation: 0–1000, 0X0000–0X03E8)
  • 2222: V (value: 0–1000, 0X0000–0X03E8)

Example: {“24”:“000011112222”}

HSV value is 00DC, 004B, and 004E in hex format. After converting them to the decimal format, you will get 220°, 75%, 78%.

Note: Color values are output in HSV format. Alternatively, you can convert values to the RGB format. For more information, visit color conversion.
You can obtain RGB (R,G,B): (HEX)(32,64,C8),(DEC)(50,100,200).

DP25(6): the scene

Data type: string
Value: 0011223344445555666677778888
00: the scene No.
11: the unit switch interval (0–100)
22: the unit change time (0–100)
33: the lighting mode. 0: static. 1: jumping. 2: gradient.
4444: H (hue: 0–360, 0X0000–0X0168)
5555: S (saturation: 0–1000, 0X0000–0X03E8)
6666: V (value: 0–1000, 0X0000–0X03E8)
7777: white light brightness (0–1000)
8888: temperature value (0–1000)
Note: Each digit that ranges from 1 to 8 in the preceding example specifies a unit and a group.

Example: {"25":"010b0a02000003e803e8000000000b0a02007603e803e8000000000b0a0200e703e803e800000000"}

01: It indicates the scene ID is 01.
0b: It indicates the transition interval between lighting modes is 0.
0a: It indicates the lighting mode duration is 10.
02: It indicates the lighting mode is gradient.
0000: It indicates hue is 0x0000.
03e8: It indicates saturation. It ranges from 0 to 1,000, corresponding to 0x0000 to 0x03E8.
03e8: It indicates value. It ranges from 0 to 1,000, corresponding to 0x0000 to 0x03E8.
0000: It indicates brightness. It ranges from 0 to 1,000.
0000: It indicates color temperature. It ranges from 0 to 1,000.

DP26(7): timer

Type value
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: It indicates the timer is turned off.

Example: {"26":"120"} indicates 120 seconds.
120 s is 2 mins.

Note:
The time delay feature is available for users only after you add this DP to your product.

DP27(8): music

Data type: string
Value: 011112222333344445555
The change mode (0: jumping. 1: gradient.)
1111: H (hue: 0–360, 0X0000–0X0168)
2222: S (saturation: 0–1000, 0X0000–0X03E8)
3333: V (value: 0–1000, 0X0000–0X03E8)
4444: indicates brightness. It ranges from 0 to 1,000.
5555: the temperature value (0–1000)

Example: {"27":"1007603e803e800120025"}

The change mode (0: jumping. 1: gradient.)
Sample description:
The change mode: 0: jumping. 1: gradient.
0076: It indicates hue is 0x0076.
03e8: It indicates saturation is 0x03E8.
03e8: It indicates value is 0x03E8.
0012: It indicates brightness is 18%.
0025: It indicates color temperature is 37%.

Note: *8This DP and the DP mode together determines whether the music light is available for users.

DP28(9): adjust

Data type: string
Value: 011112222333344445555
The change mode (0: jumping. 1: gradient.)
1111: H (hue: 0–360, 0X0000–0X0168)
2222: S (saturation: 0–1000, 0X0000–0X03E8)
3333: V (value: 0–1000, 0X0000–0X03E8)
4444: indicates brightness. It ranges from 0 to 1,000.
5555: the temperature value (0–1000)

Example: {"27":"1007603e803e800120025"}

The change mode: 0: jumping. 1: gradient.
0076: It indicates hue is 0x0076.
03e8: It indicates saturation is 0x03E8.
03e8: It indicates value is 0x03E8.
0012: It indicates brightness is 18%.
0025: It indicates color temperature is 37%.

Note: This DP is used to receive commands from the cloud when users control the light on the mobile app.

DP51: Scene configuration

Type: RAW
Value: 0011112222334444400111122223344444…
00: Scene number (number in the scene library)
1111: Brightness
2222: Color temperature
33: Speed gear

Example: {“51”: “1e03e801f400000000c007701f401000001603e801f400000000603e801f420000001d02b501f400000000503e801f430000001903e801f400000000003e801f40000000”}
1e: Scene number (Tuya scene library number 30)
03e8: Brightness 1000
01f4: Color temperature 500
00: Speed gear 100 means the first-level gear, 10 means the second, 20 means the third, and 30 means the fourth, 01 means the gears of the first to the fourth cycle in turn.

Note:
After the device is successfully connected to the Internet, a DP point report must be performed first, and the panel will configure the corresponding scene interface according to the reported scene serial number.

DP 52: Scene selection

Type: RAW
Value: 00111122223344444

Sample:
{“52”:1d03e801f40000000"}
1d: scene number, 1d is converted into a system of 29
03e8: brightness (100%)
01f4: color temperature
00: speed gear 1, 00 means speed first gear, 10 means speed second gear, 20 means the third speed gear, 30 means the fourth speed gear, 01 means the 1st to 4th gears cycle in turn.

Note:
The DP is used to configure the parameters of a certain scene and make the device enter this scene.

DP53: Scene loop

Type: RAW
Value: 00112233445566…
00: scene number, 11: scene number, send as many scenes as you choose

Sample:
{“53”:0c1d0519"}
0c: Scene 12
1d: Scene 29
05: Scene 5
19: Scene 25

Note:
The device will start to execute each scene according to the selected scene number after receiving this instruction.

DP 54: synchronize unlocking methods

Type: RAW
Value: 00
00: the scene No

Sample:
{“104”:“25”}
25: Scene 25

Note: After receiving this instruction, the device restores the corresponding scene to the default value and performs an active report through DP: scene selection.

Custom functions

You can customize functions that are not supported by standard functions. 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.

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

Function Definition

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.

Function Definition

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;

Function Definition

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

Function Definition

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

Function Definition

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.

Function Definition

Cloud functions

Cloud function: It supports cloud timing and jumping page.
Timing allows you to implement functions of on/off timer and weekly schedule without embedded hardware development.
Jumping Page: With a link, users can navigate to another page, such as the online store and user guide.

Function Definition