## Advanced - Random Timing

### Function Introduction
The light-watching function will simulate the scene of someone at home by randomly turning on and off the lights during the set time period, which plays a role in preventing theft.
- Some parameters are explained as follows:
- Repeat cycle: used to set a single turn-on or a cyclical turn-on. Select any time from Monday to Sunday, and the task will be repeated at the corresponding time; if no time is selected, the default is a single turn-on, and the task will automatically turn off after one execution
- Custom color: used to customize the light status when the light is on during the execution of the light-watching function
- Usage example:
- Set the task time to 6:00 pm ~ 12:00 am, select the rest days Saturday and Sunday, and turn on the light-watching function. The light will automatically turn on and off randomly from 6:00 pm to 12:00 am on Saturday and Sunday to simulate the scene of someone at home.
### DP protocol
- DP: random_timing

|Serial number| Name| Number of bytes| Identifier | Data type| Field attribute| Field description|
|---|---|---|---|---|---|---|
|1| Protocol version| 1| version| Enumeration| Initial version: 00 | Protocol version|
|2| Node length| 1| length| Value| Maximum value: 255 Minimum value: 0 Step distance: 1 Multiple: 0 | Node length|
|3| Task switch| on_off| Enumeration| Task off: 02 Task on: 03 ||
|4| Week| 1| week| Weekly data| Inverse calculation| If all are 0, it means single mode, which is effective only once; otherwise, it is cyclic mode, and the corresponding bit is judged whether it is set to 1. Position 1 means it is effective on the same day. For example, 0x42 means that the task will take effect on Saturday and Monday (note that the corresponding task switch must be turned on)|
|5| Start time| 2 |start_time| Value| Maximum value: 1439 Minimum value: 0 Step: 1 Multiple: 0| x10: hex code, 16%; Value range: 0~1439|
|6| End time| 2 |end_time | Value| Maximum value: 1439 Minimum value: 0 Step: 1 Multiple: 0| x10: hex code, 16%; Value range: 0-1439|
|7| Hue (hundreds)| 1| H_hundreds| Value| Maximum value: 3 Minimum value: 0 Step: 1 Multiple: 0 |0x03, 0x10: hex code. Big endian format, the first byte represents hundreds, the second byte represents tens, and the units. The actual value is 316, and the value range is: 0~360|
|8| Hue (tens and ones)| 1 H_tens_ones| Value| Maximum value: 99 Minimum value: 0 Step: 1 Multiple: 0| 0x03, 0x10: hex code. Big-endian format, the first byte represents hundreds, the second byte represents tens and ones. The actual value represents 316, and the range is 0-360|
|9| Saturation percentage| 1| S | Value | Maximum value: 100 Minimum value: 0 Step: 1 Multiple: 0| 0x10: hex code, 16%; Range: 0-100|
|10| Brightness percentage| 1| V| Value | Maximum value: 100 Minimum value: 0 Step: 1 Multiple: 0| 0x10: hex code, 16%; Range: 0-100|
|11 | Brightness percentage |1| B| Value | Maximum value: 100 Minimum value: 0 Step: 1 Multiple: 0| 0x10: hex code, 16%; Range: 0-100|
|12 | Color temperature percentage |1| T| Value | Maximum value: 100 Minimum value: 0 Step: 1 Multiple: 0| 0x10: hex code, 16%; value range: 0-100|

### How to develop
- Monitor, report and send DP according to UI interaction
  - [Specific monitoring and sending examples](/en/miniapp/solution-panel/ability#device-function-point-management)

### Notes

None

### Related materials
- [Function page]: 
  - None
- [Component]: 
  - None
- [Tutorial]: 
  - None
- [SDK]: 
  - None
- [API]: 
  - None