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.

Documentation

layoutIndex

Status Set: mal

Last Updated on : 2022-01-18 03:47:50download

Status to be sent from and to the cloud

code Name Data type Value constraint
sos_state SOS status Boolean {}
night_light_delay Night light delay Integer {“unit”:“s”, “min”:0,“max”:300,“scale”:0,“step”:1}
night_light_bright Night light brightness Integer {“unit”:“”, “min”:0,“max”:100,“scale”:0,“step”:1}
master_mode Host mode Enum {“range”:[“disarmed”, “arm”, “home”, “sos”, “work”, “play”]}
alarm_bright Brightness adjustment Integer {“unit”:“”, “min”:0,“max”:100,“scale”:0,“step”:1}
switch_alarm_light Alarm light switch Boolean {}
alarm_volume Alarm volume Enum {“range”:[“low”, “middle”, “high”, “mute”]}
switch_alarm_sound Alarm sound switch Boolean {}
alarm_time Alarm duration Integer {“unit”:“min”, “min”:1,“max”:60,“scale”:0,“step”:1}
delay_set Delay setting Integer {“unit”:“s”, “min”:0,“max”:300,“scale”:0,“step”:1}
switch_alarm_sms Alarm SMS switch Boolean {}
switch_alarm_call Alarm call switch Boolean {}
alarm_sms_number Alarm SMS number Raw {}
alarm_call_number Alarm phone number Raw {}
switch_low_battery Alarm switch of low battery Boolean {}
password_set Password setting String {“maxlen”:255}
switch_kb_light Keypad background light switch Boolean {}
switch_kb_sound Key tone switch Boolean {}
switch_mode_light Working mode indicator switch Boolean {}
switch_mode_sound Working prompt tone switch Boolean {}
alarm_ringtone Alarm ringtone enum {“range”:[“1”, “2”, “3”, “4”, “5”]}
master_state Host status Enum {“range”:[“normal”, “alarm”]}
night_light Night light mode Enum {“range”:[“light_on”, “light_off”, “light_white”, “light_warm_yellow”]}
doorbell_volume Doorbell volume Enum {“range”:[“low”, “middle”, “high”, “mute”]}
switch_mode_dl_sound Prompt tone of countdown for the mode to take effect Boolean {}
alarm_delay_time Alarm delay Integer {“unit”:“s”, “min”:0,“max”:300,“scale”:0,“step”:1}
switch_alarm_propel Alarm push notification Boolean {}
muffling Mute Boolean {}
zone_attribute Defense zone attribute Enum {“range”:[“disarmed”, “arm”, “home”, “24h”, “delay”, “others”]}
call_looptimes The number of missed repeated calls Integer {“unit”:“”, “min”:1,“max”:10,“scale”:0,“step”:1}
alarm_volume_value Alarm volume Integer {“unit”:“”, “min”:0,“max”:100,“scale”:0,“step”:1}
master_language Host language Enum {“range”:[“chinese_simplified”, “chinese_traditional”, “english”, “french”, “italian”, “german”, “spanish”, “portuguese”, “russian”, “japanese”]}
sub_admin Sub-device management Raw {}
sub_type Sub-device type Enum {“range”:[“motion_sensor”, “contact_sensor”, “smoke_alarm”, “gas_alarm”, “co_alarm”, “vibration_detector”, “water_leak_sensor”, “infrared_emission_detector”, “glass_break_detector”, “sos_button”, “remote_controller”, “keypad”, “doorbell”, “door_lock”, “rfid”, “alarm”, “environment_detector”, “others”]}
sub_class Sub-device category Enum {“range”:[“detector”, “remote_controller”, “wired_detector”, “rfid”, “doorbell_door_lock”, “alarm”, “others”]}
factory_reset Restore to factory defaults Boolean {}
doorbell_ringtone Doorbell ringtone Enum {“range”:[“1”, “2”, “3”, “4”, “5”]}

Status only to be reported to the cloud

code Name Data type Value constraint
master_information Host information String {“maxlen”:255}
battery_percentage Battery level Integer {“unit”:“%”, “min”:0,“max”:100,“scale”:0,“step”:1}
charge_state Charging status Boolean {}
temper_alarm Tamper alarm Boolean {}
alarm_msg Alarm message Raw {}
telnet_state Phone network status Enum {“range”:[“normal”, “network_no”, “phone_no”, “sim_card_no”, “network_search”, “signal_level_1”, “signal_level_2”, “signal_level_3”, “signal_level_4”, “signal_level_5”]}
sub_state Sub-device status Enum {“range”:[“normal”, “alarm”, “fault”, “others”]}

sub_admin status example

sub_admin represents the data point (DP) of sub-device management. The supported features are as follows.

Code (hexadecimal) Name
0x01 Query the number of sub-devices of a specified category
0x02 Query the attributes of all sub-devices of a specified category
0x03 Query the attribute of a specified sub-device
0x04 Modify the attribute of a specified sub-device
0x05 Delete a sub-device
0x06 Add a sub-device

Encode with Base64 to report an instruction.

0x01

Field description

This is a status reporting protocol to query the number of sub-devices of a specified category.

Field description No. Number of bytes Description
DP code 1 1 0x01: Query the number of sub-devices of a specified category.
Device category 2 1 The device category. For more information, see the description of Device category.
The number of sub-devices. 3 1
  • Parameter description: The number of sub-devices.
  • Valid values: 0x00 to 0xFF.
  • Example: 0xFF, representing 255 sub-devices.

Example of reporting DP data to the cloud

  • The Base64 data reported: AQEK
  • The decoded hexadecimal data: 01010A

Data decoding process description (subsequent descriptions of protocol fields are the same as this process)

  • Base64 data: AQEK

  • Binary data: 00000001 00000001 00001010

  • Hexadecimal data: 01 01 0A

    For more information about Base64 to binary conversion, see the Base64 encoding table.

    Field description Field value Description
    DP code 01 Query the number of sub-devices of a specified category.
    Device category 01 The device category is remote control.
    The number of sub-devices. 0A The number of sub-devices is 10.

0x02

Field description

This is a status reporting protocol to query the attributes of all the sub-devices of a specified category. Sub-device attributes are reported in groups, and the attributes of up to five devices can be reported each time. You can calculate how many times data needs to be reported based on the number of reported sub-devices.

Field description No. Number of bytes Description
DP code 1 1 0x02: Query the attributes of all sub-devices of a specified category.
Device category 2 1 The device category. For more information, see the description of Device category.
The number of sub-devices. 3 1
  • Parameter description: The number of sub-devices.
  • Valid values: 0x00 to 0xFF.
  • Example: 0xFF, representing 255 sub-devices.
Sub-device attribute No. 4 1 0x01: represents the first device. Make sure that the serial number of each device is unique.
Type 5 1 The sub-device type. For more information, see the description of Sub-device type.
Defense zone attribute 6 1 The attribute of a specified defense zone. For more information, see the description of Defense zone attribute.
Linking 7 1
  • 0x00: Enable.
  • 0x01: Disable.
  • 0xFF: This feature is unavailable.
Working status 8 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0x02: Fault.
  • 0x03: Others.
  • 0xFF: This feature is unavailable.
Battery level 9 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0xFF: This feature is unavailable.
Number of bytes of name 10 1
  • Parameter description: the number of bytes in the name field.
  • Valid values: 0x01 to 0xFE. 0xFF means this feature is unavailable.
  • Example: 0x03. The name field has 3 bytes.
Name 11 n A name, if any, will be reported in UTF-16BE encoding format, and the FEFF prefix will be removed. Otherwise, there is no such field.
No. 12 1 0x02: represents the second device. Make sure that the serial number of each device is unique. The other fields are the same as above.

Example of reporting DP data to the cloud

  • The Base64 data reported: AgECAQwA/////wIMAP//////
  • The decoded hexadecimal data: 020102010C00FFFFFFFF020C00FFFFFFFFFF
Field description Field value Description
DP code 02 Query the attributes of all sub-devices of a specified category
Device category 01 The device category is remote control.
The number of sub-devices. 02 The number of sub-devices is 2.
The first sub-device No. 01 The serial number of the device is 1.
Type 0C The device type is doorbell.
Defense zone attribute 00 General defense zone.
Linking FF This feature is unavailable.
Working status FF This feature is unavailable.
Battery level FF This feature is unavailable.
Number of bytes of name FF This feature is unavailable.
The second sub-device No. 02 The serial number of the device is 2.
Type 0C The device type is doorbell.
Defense zone attribute 00 General defense zone.
Linking FF This feature is unavailable.
Working status FF This feature is unavailable.
Battery level FF This feature is unavailable.
Number of bytes of name FF This feature is unavailable.

0x03

Field description

This is a status reporting protocol to query the attribute of a specified sub-device.

Field description No. Number of bytes Description
DP code 1 1 0x03: Query the attribute of a specified sub-device.
Device category 2 1 The device category. For more information, see the description of Device category.
No. 3 1 0x01: represents the first device. Make sure that the serial number of each device is unique.
If the read fails, the following bytes are no longer reported.
Type 4 1 The sub-device type. For more information, see the description of Sub-device type.
Defense zone attribute 5 1 The attribute of a specified defense zone. For more information, see the description of Defense zone attribute.
Linking 6 1
  • 0x00: Enable.
  • 0x01: Disable.
  • 0xFF: This feature is unavailable.
Working status 7 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0x02: Fault.
  • 0x03: Others.
  • 0xFF: This feature is unavailable.
Battery level 8 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0xFF: This feature is unavailable.
Number of bytes of name 9 1
  • Parameter description: the number of bytes in the name field.
  • Valid values: 0x01 to 0xFE. 0xFF means this feature is unavailable.
  • Example: 0x03. The name field has 3 bytes.
Name 10 n A name, if any, will be reported in UTF-16BE encoding format, and the FEFF prefix will be removed. Otherwise, there is no such field.

Example of reporting DP data to the cloud

  • The Base64 data reported: AwABDAD///8MAFMAZQBuAHMAbwBy

  • The decoded hexadecimal data: 0300010C00FFFFFF0C00530065006e0073006f0072

    Field description Field value Description
    DP code 03 Query the attribute of a specified sub-device
    Device category 00 The device category is detector.
    No. 01 The first device.
    Type 0C The device type is doorbell.
    Defense zone attribute 00 General defense zone.
    Linking FF This feature is unavailable.
    Working status FF This feature is unavailable.
    Battery level FF This feature is unavailable.
    Number of bytes of name 0C The name has 12 bytes.
    Name 00530065006e0073006f0072 The name is sensor.

    The name field is a string in the UTF-16BE format and must be prefixed with FEFF during parsing. The same rules apply to the following sections.

0x04

Field description

This is a status reporting protocol to modify the attribute of a specified sub-device.

Field description No. Number of bytes Description
DP code 1 1 0x04: Modify the attribute of a specified sub-device.
Device category 2 1 The device category. For more information, see the description of Device category.
No. 3 1 0x01: represents the first device. Make sure that the serial number of each device is unique.
If the modification fails, the following bytes are no longer reported.
Type 4 1 The sub-device type. For more information, see the description of Sub-device type.
Defense zone attribute 5 1 The attribute of a specified defense zone. For more information, see the description of Defense zone attribute.
Linking 6 1
  • 0x00: Enable.
  • 0x01: Disable.
  • 0xFF: This feature is unavailable.
Working status 7 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0x02: Fault.
  • 0x03: Others.
  • 0xFF: This feature is unavailable.
Battery level 8 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0xFF: This feature is unavailable.
Number of bytes of name 9 1
  • Parameter description: the number of bytes in the name field.
  • Valid values: 0x01 to 0xFE. 0xFF means this feature is unavailable.
  • Example: 0x03. The name field has 3 bytes.
Name 10 n A name, if any, will be reported in UTF-16BE encoding format, and the FEFF prefix will be removed. Otherwise, there is no such field.

Example of reporting DP data to the cloud

  • The Base64 data reported: BAABDAD///8MAFMAZQBuAHMAbwBy

  • The decoded hexadecimal data: 0400010C00FFFFFF0C00530065006e0073006f0072

    Field description Field value Description
    DP code 04 Modify sub-device attribute.
    Device category 00 The device category is detector.
    No. 01 The first device.
    Type 0C The device type is doorbell.
    Defense zone attribute 00 General defense zone.
    Linking FF This feature is unavailable.
    Working status FF This feature is unavailable.
    Battery level FF This feature is unavailable.
    Number of bytes of name 0C The name has 12 bytes.
    Name 00530065006e0073006f0072 The name is sensor.

0x05

Field description

This is a status reporting protocol to delete the attribute of a specified sub-device.

Field description No. Number of bytes Description
DP code 1 1 0x05: Delete a sub-device.
Device category 2 1 The device category. For more information, see the description of Device category.
Sub-device serial number 3 1 0x01: represents the first device. Make sure that the serial number of each device is unique.

Example of reporting DP data to the cloud

  • The Base64 data reported: BQAB
  • The decoded hexadecimal data: 050001
Field description Field value Description
DP code 05 Delete a sub-device.
Device category 00 The device category is detector.
Sub-device serial number 01 The serial number of the device is 1.

0x06

Field description

This is a status reporting protocol to add the attribute of a specified sub-device. To add multiple devices, the data shall be reported multiple devices. Only one device can be reported each time.

Field description No. Number of bytes Description
DP code 1 1 0x06: Add a sub-device.
Device category 2 1 The device category. For more information, see the description of Device category.
No. 3 1 0x01: represents the first device. Make sure that the serial number of each device is unique.
Type 4 1 The sub-device type. For more information, see the description of Sub-device type.
Defense zone attribute 5 1 The attribute of a specified defense zone. For more information, see the description of Defense zone attribute.
Linking 6 1
  • 0x00: Enable.
  • 0x01: Disable.
  • 0xFF: This feature is unavailable.
Working status 7 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0x02: Fault.
  • 0x03: Others.
  • 0xFF: This feature is unavailable.
Battery level 8 1
  • 0x00: Normal.
  • 0x01: Alarming.
  • 0xFF: This feature is unavailable.
Number of bytes of name 9 1
  • Parameter description: the number of bytes in the name field.
  • Valid values: 0x01 to 0xFE. 0xFF means this feature is unavailable.
  • Example: 0x03. The name field has 3 bytes.
Name 10 n A name, if any, will be reported in UTF-16BE encoding format, and the FEFF prefix will be removed. Otherwise, there is no such field.

Example of reporting DP data to the cloud

  • The Base64 data reported: BgEBDAH/////

  • The decoded hexadecimal data: 0601010C01FFFFFFFF

    Field description Field value Description
    DP code 06 Add a sub-device.
    Device category 01 The device category is remote control.
    No. 01 The serial number of the device is 1.
    Type 0C The device type is doorbell.
    Defense zone attribute 01 Emergency defense zone.
    Linking FF This feature is unavailable.
    Working status FF This feature is unavailable.
    Battery level FF This feature is unavailable.
    Number of bytes of name FF This feature is unavailable.

Description of device category

The values correspond to the enumerated values of DP 36 (sub_class).

Code (hexadecimal) Identifier Name
0x00 detector Detector
0x01 remote_controller Remote control
0x02 wired_detector Wired detector
0x03 rfid RFID
0x04 doorbell_door_lock Lock with doorbell
0x05 alarm Alarm
0x06 others Others

Description of sub-device type

The values correspond to the enumerated values of DP 37 (sub_type).

Code (hexadecimal) Identifier Name
0x00 motion_sensor Infrared motion sensor
0x01 contact_sensor Contact sensor
0x02 smoke_alarm Smoke detector
0x03 gas_alarm Gas detector
0x04 co_alarm Carbon monoxide (CO) detector
0x05 water_leak_sensor Water detector
0x06 vibration_detector Vibration detector
0x07 infrared_emission_detector Infrared emission detector
0x08 glass_break_detector Glass break detector
0x09 sos_button Emergency button
0x0A remote_controller Remote control
0x0B keypad Security keypad
0x0C doorbell Doorbell
0x0D door_lock Door lock
0x0E rfid RFID
0x0F alarm Alarm
0x10 environment_detector Environmental detector
0x11 others Others
0xFF None This feature is unavailable.

Description of defense zone attribute

The values correspond to the enumerated values of DP 24 (zone_attribute).

Code (hexadecimal) Identifier Name
0x00 disarmed General defense zone.
0x01 arm Emergency defense zone.
0x02 home Defense zone when the user is at home.
0x03 24h 24/7 defense zone.
0x04 delay Delay defense zone.
0x05 others Other defense zones.
0xFF None This feature is unavailable.

Support up to eight defense zones. If the value of a field ranging from bit0 to bit7 is 1, it means that the corresponding enumerated value of DP 24 is selected. This feature is not supported by default. To support this feature, a panel configuration item is required.