Weekly Schedule

Last Updated on : 2024-06-21 03:56:47download

This topic describes the types and settings of weekly schedules and the data parsing example for MCU integration protocol.

Without MCU integration protocol

Advanced function (cloud timing)

Weekly Schedule
  • Time format: hh:mm (24-hour clock)

  • Extension: Allow the user to set on/off, mode, and temperature for a schedule. This requires support for the corresponding standard functions (DPs).

  • Limitations:

    • Module-based timing allows for a maximum of 30 schedules, while cloud-based timing has no such limitations.
    • You can select either cloud timing or week_program_free to implement the weekly schedule.
  • Trigger logic:

    • The cloud sends the module the schedule that users created on the mobile app. The module then stores the schedule and starts a timer. When the timer triggers, the module will send the DP command specified in the schedule to the MCU for execution.
    • The schedule can run as expected without an internet connection.
    • If the module is disconnected for a long time, it cannot sync its clock with the server time. This can lead to a time drift, resulting in deviations in the trigger time of the schedule.

Weekly schedule (free form) week_program_free

Weekly Schedule
  • Time format: hours (24-hour clock)

  • Extension: Allow the user to set mode (default), temperature and mode, temperature, and on/off for a schedule.

  • Limitation: Schedules cannot be sent to the device without an internet connection.

    You can select either cloud timing or week_program_free to implement the weekly schedule.

  • Trigger logic: Schedule processing depends on the cloud. When the time has elapsed, the cloud sends the specified DP command to the device.

With MCU integration protocol

Weekly schedule (multi-segment) week_program_multi

Weekly Schedule
  • Time format: hours (24-hour clock), 28, 56, 84, 112, 140, or 168 bytes.

  • Extension: Up to six segments can be configured.

  • Trigger logic: Data in hex is transmitted. MCU’s clock is used to trigger the schedule.

  • Raw data format:

    • Each segment is four bytes. The schedule data has a minimum size of 28 bytes (4 × 1 × 7) and a maximum size of 168 bytes (4 × 6 × 7).
    • The first two bytes of a segment indicate the start time in minutes, and the last two bytes indicate the temperature with decimal places. For example, if the heater is scheduled to turn on at 06:30 with a temperature of 35°C, the data is 01 86 01 5e.
      • 01 86 is 390 (minutes) in decimal, indicating the time 06:30.
      • 01 5e is 350 in decimal, indicating the temperature is 35.0.

Weekly schedule (mode) week_program_mode

Weekly Schedule
  • Time format: hours (24-hour clock), 84 bytes.

  • Extension: The mode enum value is retrieved from the DP mode. You can hide an unnecessary mode on the Tuya Developer Platform.

    Weekly Schedule
  • Trigger logic: Data in hex is transmitted. MCU’s clock is used to trigger the schedule.

  • Raw data format:

    • One mode can be set per hour. DP 4 mode determines the available modes.
    • Each bit is a value in hex. Suppose that the data for the first day is 100000000000000000000000, indicating that a mode is set for the first hour on Monday. The mode displayed is determined by the valid values of DP 4 mode. For example, 1 for smart, 2 for auto, and 3 for cold.
  • Command parsing:

    100000000000000000000000
    100000000000000000000000
    200000000000000000000000
    002222200000000000000000
    000000000000000000000000
    333333300000000000000000
    000000000000000000000000
    

Weekly schedule (on/off) week_program_switch

  • Time format: hours (24-hour clock), 21 bytes.

  • Trigger logic: Data in hex is transmitted. MCU’s clock is used to trigger the schedule.

  • Raw data format:

    • On/off state can be set per hour. This DP is 21 bytes. Every three bytes indicate an on/off state.

    • Take the schedule on Monday as an example, d40000 in hex is 11010100 00000000 00000000 in binary, 1 for on and 0 for off.

      d40000
      fc0000
      000000
      000000
      000000
      000000
      000000
      

Weekly schedule (temp) week_program_temp

Weekly Schedule
  • Time format: hours (24-hour clock), 168 bytes.

  • Trigger logic: Data in hex is transmitted. MCU’s clock is used to trigger the schedule.

  • Raw data format:

    • Each hour is one byte. The user can set the temperature for each hour of the day weekly.
    • Take the schedule on Monday as an example, 06060606ffffffffffffffffffffffffffffffffffffffff indicating the temperature at 00:00, 01:00, 02:00, and 03:00 is set to 6°C. ff means no temperature set.

    The temperature range is consistent with the value range of the DPs temp_set and temp_set_f. After the temperature unit is changed, the value range is changed accordingly and the weekly schedule should be set again.

    Weekly Schedule Weekly Schedule
  • Command parsing:

    06060606ffffffffffffffffffffffffffffffffffffffff
    ffffffffffffffffffffffffffffffffffffffffffffffff
    ffffffffffffffffffffffffffffffffffffffffffffffff
    ffffffffffffffffffffffffffffffffffffffffffffffff
    ffffffffffffffffffffffffffffffffffffffffffffffff
    ffffffffffffffffffffffffffffffffffffffffffffffff
    ffffffffffffffffffffffffffffffffffffffffffffffff