Set the scientific sleep switch
Function: setScientificSleepSwitch
Flutter Example:
/// Set the scientific sleep switch event number
setScientificSleepSwitch(
evtBase: _VBusEvtBase.base_app_set,
evtType: _VBusEvtType.app_set_scientific_sleep_switch),
/// Set the scientific sleep switch
libManager.send(evt: CmdEvtType.setScientificSleepSwitch, json: jsonEncode(json));
JSON fields sent by the app:
| Field Name | Field Type | Field Description |
|---|---|---|
| mode | int | Mode 2: Scientific sleep 1: Normal sleep |
| start_hour | int | Start time (hours) |
| start_minute | int | Start time (minutes) |
| end_hour | int | End time (hours) |
| end_minute | int | End time (minutes) |
| sleep_remind_switch | int | Sleep reminder switch (1 on, 0 off). (Effective when supportSetSleepRemind is enabled) |
| sleep_remind_hour | int | Sleep reminder time (hours). (Effective when supportSetSleepRemind is enabled) |
| sleep_remind_minute | int | Sleep reminder time (minutes). (Effective when supportSetSleepRemind is enabled) |
| repetitions | int | Repeat period. Bit 0 is reserved, bits 1 to 7 are Monday to Saturday, respectively. 1 means repeat, 0 means no repeat. (Effective when supportSetSleepRemind is enabled) |
Example:
{
"mode": 1,
"start_hour": 23,
"start_minute": 0,
"end_hour": 9,
"end_minute": 0,
"sleep_remind_switch": 1,
"sleep_remind_hour": 22,
"sleep_remind_minute": 11,
"repetitions": 127
}
JSON fields received by the app:
| Field Name | Field Type | Field Description |
|---|---|---|
| is_success | int | 0 for failure, 1 for success |
Example:
{
"is_success": 1
}