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

Instruction Set: mal

Last Updated on : 2022-01-18 04:00:27download

Standard instruction set

Instruction 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”]}

sub_admin instruction example

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

Code (hexadecimal) Description
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 the Base64 to send a command.

0x01

Field description

This is an instruction sending 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.

Example of sending an instruction

  • The hexadecimal data sent: 0101
  • The Base64 encoded data: AQE=

Data encoding process description (subsequent protocol field descriptions are the same as this process)

  • Hexadecimal data: 01 01

  • Binary data: 00000001 00000001

  • Base64 encoded data: AQE=

    For more information about binary to Base64 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.

0x02

Field description

This is an instruction sending protocol to query the attributes of all the sub-devices of a specified category.

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.

Example of sending an instruction

  • The hexadecimal data sent: 0201

  • The Base64 encoded data: AgE=

    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.

0x03

Field description

This is an instruction sending protocol to query the attribute of a specified sub-device of a specified category.

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.
Sub-device serial number 3 1 0x01: represents the first device. Make sure that the serial number of each device is unique.

Example of sending an instruction

  • The hexadecimal data sent: 030001

  • The Base64 encoded data: AwAB

    Field description Field value Description
    DP code 03 Query the attribute of a specified sub-device.
    Device category 00 The device category is detector.
    Sub-device serial number 01 The serial number of the device is 1.

0x04

Field description

This is an instruction sending 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.
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 sent in UTF-16BE encoding format, and the FEFF prefix will be removed. Otherwise, there is no such field.

Example of sending an instruction

  • The hexadecimal data sent: 0400010C00FFFFFF0C00530065006e0073006f0072

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

    Field description Field value Description
    DP code 04 Modify 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.

0x05

Field description

This is an instruction sending protocol to delete a 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 sending an instruction

  • The hexadecimal data sent: 050001

  • The Base64 encoded data: BQAB

    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 an instruction sending protocol to add a sub-device.

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.
  • 0xFF: No specific category is designated.

Example of sending an instruction

  • The hexadecimal data sent: 06ff

  • The Base64 encoded data: Bv8=

    Field description Field value Description
    DP code 06 Add a sub-device.
    Device category ff No specific category is designated.

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.