Protocol Description

Last Updated on : 2024-11-20 08:51:38download

This topic describes the protocol specific to the features of the infrared (IR) thermostat.

Background

To make a traditional air conditioner smart, the popular approach is to use a smart plug for the air conditioner and universal remote control. However, this approach is app-dependent and can only support simple operations. It cannot provide deep experience in smart life.

Given this, Tuya provides the IR thermostat that can be used in tandem with the existing IR remote control for a better and smarter user experience. The IR thermostat can get and display the status of the air conditioner.

Overview

Code library download

The thermostat controls the air conditioner with cloud-based IR codes.

Process description:

  1. The module matches the IR code from the remote control of the air conditioner against IR code libraries.

  2. With successful matching, the module downloads the corresponding IR code library to the local system.

  3. The download library is stored in the external flash.

    Up to three IR code libraries can be stored. Deleting or switching between libraries is supported.

    Protocol Description

Reverse decoding

The module parses the IR code from the remote control and syncs the status to the MCU.

Process description:

  1. The module matches the received IR code against the local IR code library to get information such as temperature, mode, and speed.

  2. Then, it syncs the obtained status data to the MCU through serial communication.

  3. The MCU parses the received data and gets the status such as temperature, mode, and speed to update the display.

  4. The status of the air conditioner is synced to the app panel through the data point (DP). This keeps the status of the air conditioner in sync with the thermostat and the app panel.

    Protocol Description

IR learning

IR learning allows users to capture IR codes from a remote control by using the app panel. The module uploads the learned IR code to the cloud to match it against the IR code libraries.

IR control can be performed with the app panel or the thermostat display.

  • Control with app panel

    1. The app panel sends a command of DP 201 to the module. The command contains the IR code and the corresponding temperature status.
    2. The module receives and parses the command, sends the IR signal to the air conditioner, and syncs the temperature status to the MCU.
    3. The MCU receives and parses the temperature status, updates the thermostat display, and reports the current temperature to the app panel. This keeps the status of the air conditioner in sync with the thermostat and the app panel.
  • Control with thermostat display

    1. When users adjust the air conditioner, the MCU will send the updated status such as temperature, mode, and speed to the module through serial communication.

    2. The module parses the received command.

    3. With the mapping table, the module retrieves the corresponding IR code from the flash memory address.

    4. If the IR code is found, the module will transmit the IR signal and returns success to the MCU. Otherwise, the module will not transmit the IR signal and returns failure to the MCU.

    5. On successful return, the MCU will update the display and report the temperature status to the app panel. This keeps the status of the air conditioner in sync with the thermostat and the app panel.

      Protocol Description

Serial protocol (0x38)

IR control (0x3801)

The MCU sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x38
Data length 2 0x0002
Data 1 0x01 (subcommand)
1 Category:
0x01: Air conditioner
N IR code group: mode + speed + temperature and on/off
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The module returns the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x38
Data length 2 0x0002
Data 1 0x01 (subcommand)
1 0x00/0x01
  • 0: Failure
  • 1: Success
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Protocol description

The MCU uses the command 0x3801 to sync the status of the air conditioner to the module. After receiving the command, the module will parse it to get the IR code.

  • On/off: The module parses the on/off command, gets the flash memory address with the mapping table, and transmits the IR signal to the air conditioner.
    • The module returns success if it reads the IR code successfully.
    • The module returns failure if it fails to read the IR code.
  • Mode + speed + temperature: Supports two modes: special mode (dry and fan) and normal mode (heat, cool, and auto)
    • The special mode and the on/off control work with the same logic.

    • The group code for special mode: mode + speed or mode + speed + temperature.
      For the special mode, the MCU includes the temperature in the command. The module matches the received command against the library. The module returns success if it reads the IR code successfully. The module returns failure if it fails to read the IR code.

      After returning failure, the module continues retrieving the mode + speed code group. If the retrieval failed, the module polls the mode + speed + temperature code group at different temperatures. On success, the module syncs the code to the MCU. Otherwise, the module does not return a value.

IR status notification (0x3802)

The module sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x38
Data length 2 0x0002
Data 1 0x02 (subcommand)
1 Product category
0x01: Air conditioner
N IR code group: mode + speed + temperature, mode + speed, and on/off.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The MCU returns the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x38
Data length 2 0x0001
Data 1 0x02 (subcommand)
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Protocol description

The module uses the command 0x3802 to sync the status of the air conditioner to the MCU.

  • When the module receives the IR signal from the remote control, it performs reverse decoding to get the code group and syncs it to the MCU.
  • When the module receives the command of DP 201 from the app panel, it parses the command to get the code group and syncs it to the MCU.
  • When the module processes the code group for the special mode, if the retrieval failed, it uses the specific algorithms to find the correct code and then syncs to the MCU.

Hardware SPI read/write test (0x3803)

The MCU sends the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x38
Data length 2 0x0002
Data 1 0x03 (subcommand)
1 Product category
0x01: Air conditioner
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The module returns the following data.

Field Length (byte) Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x38
Data length 2 0x0002
Data 1 0x03 (subcommand)
1 0x00/0x01
  • 0: Failure
  • 1: Success
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Protocol description

The MCU sends the command 0x3803 to the module to test the SPI read, write, and erase operations. Make sure the external flash is greater than or equal to 2 MB. The return value 0x01 means success and 0x00 means failure.

For more information about the IR code group, submit a service ticket.