Serial Protocol for Offline Voice (Wi-Fi)

Last Updated on : 2024-06-21 03:23:35download

The Wi-Fi serial port protocol for offline voice modules is based on Tuya Standard MCU Wi-Fi Serial Communication Protocol, and some commands dedicated to offline voice are added. Its architecture frame is shown in the figure below.

Serial Protocol for Offline Voice (Wi-Fi)

Enable the extended DP service

  • This service extends the source of data sending to LAN, WAN, and Bluetooth.
  • This service conflicts with Send commands.

The MCU sends the following command:

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x36
Data length 2 0x0002
Data 1 Sub-command: 0x00
1 0x00: disable the extended DP service.
0x01: enable the extended DP service.
-
Checksum 1 Add up all bytes starting from the header and divide the sum by 256 to get the remainder.

For example, 0x55aa 03 36 0002 00 01 3c

The module returns the following command:

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x36
Data length 2 0x0002
Data 1 Sub-command: 0x00
1 0x00: The service is enabled or disabled.
0x01: Failed to enable or disable the service.
-
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

For example, 0x55aa 00 36 0002 00 00 38

Send commands of extended DPs

  • “Send command” can contain “command data units” of multiple DPs.
  • The asynchronous processing protocol is used to send the command, corresponding to the Report the status of the MCU.
  • The source of extended DP data sending must be set manually, which conflicts with the Send commands and Report status.
  • Except for the supported parts, other source types are not supported.

The module sends the following command:

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x36
Data length 2 It depends on the type and number (N+2) of the command data units.
Data 1 Sub-command: 0x01
1 The source of data sending:
0x00: unknown sources.
0x01: LAN.
0x02: WAN
0x03: scheduled tasks in LAN.
0x04: local scene linkage.
0x05: scene linkage in LAN.
0x06: Bluetooth.
0x07: offline voice modules.







-
N Command data units -
Checksum 1 Add up all bytes starting from the header and divide the sum by 256 to get the remainder.

For example, in LAN, if DP 3 of a boolean type is used for on/off control, and 1 means to turn on the device, the module will send the following command.

0x55aa 00 36 0007 01 01 03 01 0001 01 44

Report status of extended DPs

  • This feature only applies to offline voice modules.
  • The asynchronous processing protocol is used to report status. The trigger mechanism has three types:
    1. After the MCU executes the command of extended DPs from the module, it reports the changed status of extended DPs to the module.
    2. When the MCU detects DP changes, it sends the DP status to the module.
    3. When the MCU receives a status query frame, it sends the status of all DPs to the module.
  • The status reporting can include the data unit of multiple DPs.

The MCU sends the following command:

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x36
Data length 2 It depends on types and the number (N+3) of status data units.
Data 1 Sub-command: 0x02
1 0x00: The MCU proactively reports status.
0x01: The MCU responds to status queries.
0x02: The MCU responds to commands of extended DPs.

-
1 When the MCU proactively reports DP status or responds to status queries, it responds to the data source requested by Send commands of extended DPs with 0x00.
0x00: unknown sources.
0x01: LAN.
0x02: WAN
0x03: scheduled tasks in LAN.
0x04: local scene linkage.
0x05: scene linkage in LAN.
0x06: Bluetooth.
0x07: offline voice modules.
-
N Status data units -
Checksum 1 Add up all bytes starting from the header and divide the sum by 256 to get the remainder.

For example, in WAN, if the DP 5 of value type indicates the current humidity of 30%, the MCU sends the following command to the module.

0x55aa 03 36 000b 02 02 02 05 02 0004 0000001e 6f

Module information field description:

Name Description Options Get Setting
cc Country code 0: applies to China, Korea, Singapore, Australia, Japan (1-13), and others
1: applies to the United States, Taiwan (China), and Canada
2: applies to Japan (1-14)
3: applies to Europe
Supported Not supported
ap Access point (AP) - Supported Not supported