Schedule can not be inactive

Hello.

I am developing using nRF5340DK and nRF Connect SDK v2.9.0.
I am checking the operation of "Scheduler Server".
The registered schedule was changed to inactive, but the schedule was executed.
I will extract the logs in chronological order.

  1. Receive "Scheduler Action Set" message from smartphone app
    Schedule Index 0, turn on lights(action: 1) at 13:00:00 every day.
    [00:01:04.802,764] <dbg> bt_mesh_scheduler_srv: action_set: Rx: scheduler server action index 0 set, ack 1
    [00:01:04.802,825] <dbg> bt_mesh_scheduler_srv: schedule_action: Current uptime 64802
    [00:01:04.802,856] <dbg> bt_mesh_scheduler_srv: schedule_action: Current time:
    [00:01:04.802,856] <dbg> bt_mesh_scheduler_srv: schedule_action:         year: 125
    [00:01:04.802,886] <dbg> bt_mesh_scheduler_srv: schedule_action:        month: 0
    [00:01:04.802,886] <dbg> bt_mesh_scheduler_srv: schedule_action:          day: 8
    [00:01:04.802,886] <dbg> bt_mesh_scheduler_srv: schedule_action:         hour: 12
    [00:01:04.802,917] <dbg> bt_mesh_scheduler_srv: schedule_action:       minute: 58
    [00:01:04.802,917] <dbg> bt_mesh_scheduler_srv: schedule_action:       second: 10
    [00:01:04.802,978] <dbg> bt_mesh_scheduler_srv: schedule_action: Scheduled time:
    [00:01:04.803,009] <dbg> bt_mesh_scheduler_srv: schedule_action:           year: 125
    [00:01:04.803,039] <dbg> bt_mesh_scheduler_srv: schedule_action:          month: 0
    [00:01:04.803,039] <dbg> bt_mesh_scheduler_srv: schedule_action:            day: 8
    [00:01:04.803,070] <dbg> bt_mesh_scheduler_srv: schedule_action:           hour: 13
    [00:01:04.803,070] <dbg> bt_mesh_scheduler_srv: schedule_action:         minute: 0
    [00:01:04.803,070] <dbg> bt_mesh_scheduler_srv: schedule_action:         second: 0
    [00:01:04.803,131] <dbg> bt_mesh_scheduler_srv: run_scheduler: Scheduler started. Target uptime: 174043. Current uptime: 64803.
    [00:01:04.828,765] <dbg> bt_mesh_scheduler_srv: encode_action_status: Tx: scheduler server action status:
    [00:01:04.828,765] <dbg> bt_mesh_scheduler_srv: encode_action_status:         index: 0
    [00:01:04.828,796] <dbg> bt_mesh_scheduler_srv: encode_action_status:          year: 100
    [00:01:04.828,796] <dbg> bt_mesh_scheduler_srv: encode_action_status:         month: 0xfff
    [00:01:04.828,796] <dbg> bt_mesh_scheduler_srv: encode_action_status:           day: 0
    [00:01:04.828,826] <dbg> bt_mesh_scheduler_srv: encode_action_status:          wday: 0x7f
    [00:01:04.828,826] <dbg> bt_mesh_scheduler_srv: encode_action_status:          hour: 13
    [00:01:04.828,857] <dbg> bt_mesh_scheduler_srv: encode_action_status:        minute: 0
    [00:01:04.828,857] <dbg> bt_mesh_scheduler_srv: encode_action_status:        second: 0
    [00:01:04.828,857] <dbg> bt_mesh_scheduler_srv: encode_action_status:        action: 1
    [00:01:04.828,887] <dbg> bt_mesh_scheduler_srv: encode_action_status:    transition: 0
    [00:01:04.828,887] <dbg> bt_mesh_scheduler_srv: encode_action_status:         scene: 0
    [00:01:04.828,918] <dbg> bt_mesh_scheduler_srv: encode_action_status: Tx: scheduler server action status:
    [00:01:04.828,918] <dbg> bt_mesh_scheduler_srv: encode_action_status:         index: 0
    [00:01:04.828,948] <dbg> bt_mesh_scheduler_srv: encode_action_status:          year: 100
    [00:01:04.828,948] <dbg> bt_mesh_scheduler_srv: encode_action_status:         month: 0xfff
    [00:01:04.828,948] <dbg> bt_mesh_scheduler_srv: encode_action_status:           day: 0
    [00:01:04.828,979] <dbg> bt_mesh_scheduler_srv: encode_action_status:          wday: 0x7f
    [00:01:04.828,979] <dbg> bt_mesh_scheduler_srv: encode_action_status:          hour: 13
    [00:01:04.829,010] <dbg> bt_mesh_scheduler_srv: encode_action_status:        minute: 0
    [00:01:04.829,010] <dbg> bt_mesh_scheduler_srv: encode_action_status:        second: 0
    [00:01:04.829,010] <dbg> bt_mesh_scheduler_srv: encode_action_status:        action: 1
    [00:01:04.829,040] <dbg> bt_mesh_scheduler_srv: encode_action_status:    transition: 0
    [00:01:04.829,040] <dbg> bt_mesh_scheduler_srv: encode_action_status:         scene: 0

  2. Receive "Scheduler Action Set" message from smartphone app
    Schedule Index 0, change inactive(action: 15) .
    [00:01:22.203,155] <dbg> bt_mesh_scheduler_srv: action_set: Rx: scheduler server action index 0 set, ack 1
    [00:01:22.204,162] <dbg> bt_mesh_scheduler_srv: encode_action_status: Tx: scheduler server action status:
    [00:01:22.204,193] <dbg> bt_mesh_scheduler_srv: encode_action_status:         index: 0
    [00:01:22.204,223] <dbg> bt_mesh_scheduler_srv: encode_action_status:          year: 100
    [00:01:22.204,223] <dbg> bt_mesh_scheduler_srv: encode_action_status:         month: 0xfff
    [00:01:22.204,254] <dbg> bt_mesh_scheduler_srv: encode_action_status:           day: 0
    [00:01:22.204,254] <dbg> bt_mesh_scheduler_srv: encode_action_status:          wday: 0x7f
    [00:01:22.204,284] <dbg> bt_mesh_scheduler_srv: encode_action_status:          hour: 13
    [00:01:22.204,284] <dbg> bt_mesh_scheduler_srv: encode_action_status:        minute: 0
    [00:01:22.204,284] <dbg> bt_mesh_scheduler_srv: encode_action_status:        second: 0
    [00:01:22.204,315] <dbg> bt_mesh_scheduler_srv: encode_action_status:        action: 15
    [00:01:22.204,315] <dbg> bt_mesh_scheduler_srv: encode_action_status:    transition: 0
    [00:01:22.204,345] <dbg> bt_mesh_scheduler_srv: encode_action_status:         scene: 0

  3. Schedule execution at 13:00:00
    All ”Generic OnOff Server” were instructed to be turned on.
    Additionally, the schedule for tomorrow has been reserved.
    [00:02:54.043,243] <dbg> bt_mesh_scheduler_srv: scheduled_action_handle: Scheduler action fired: 15
    [00:02:54.043,304] <dbg> bt_mesh_scheduler_srv: scheduled_action_handle: Onoff srv addr: 519 set: 15
    [00:02:54.043,426] <dbg> bt_mesh_scheduler_srv: scheduled_action_handle: Onoff srv addr: 520 set: 15
    [00:02:54.043,457] <dbg> bt_mesh_scheduler_srv: scheduled_action_handle: Onoff srv addr: 521 set: 15
    [00:02:54.043,518] <dbg> bt_mesh_scheduler_srv: schedule_action: Current uptime 174043
    [00:02:54.043,518] <dbg> bt_mesh_scheduler_srv: schedule_action: Current time:
    [00:02:54.043,548] <dbg> bt_mesh_scheduler_srv: schedule_action:         year: 125
    [00:02:54.043,548] <dbg> bt_mesh_scheduler_srv: schedule_action:        month: 0
    [00:02:54.043,579] <dbg> bt_mesh_scheduler_srv: schedule_action:          day: 8
    [00:02:54.043,579] <dbg> bt_mesh_scheduler_srv: schedule_action:         hour: 13
    [00:02:54.043,609] <dbg> bt_mesh_scheduler_srv: schedule_action:       minute: 0
    [00:02:54.043,609] <dbg> bt_mesh_scheduler_srv: schedule_action:       second: 0
    [00:02:54.043,701] <dbg> bt_mesh_scheduler_srv: schedule_action: Scheduled time:
    [00:02:54.043,731] <dbg> bt_mesh_scheduler_srv: schedule_action:           year: 125
    [00:02:54.043,731] <dbg> bt_mesh_scheduler_srv: schedule_action:          month: 0
    [00:02:54.043,762] <dbg> bt_mesh_scheduler_srv: schedule_action:            day: 9
    [00:02:54.043,762] <dbg> bt_mesh_scheduler_srv: schedule_action:           hour: 13
    [00:02:54.043,762] <dbg> bt_mesh_scheduler_srv: schedule_action:         minute: 0
    [00:02:54.043,792] <dbg> bt_mesh_scheduler_srv: schedule_action:         second: 0
    [00:02:54.043,853] <dbg> bt_mesh_scheduler_srv: run_scheduler: Scheduler started. Target uptime: 86574043. Current uptime: 174043.

I found something concerning in the nRF Connect SDK.

  • When inactive was received, delayable work was not canceled.
    scheduler_srv.c / action_set()
  • When the scheduled time arrives, All "Generic OnOff Server" are instructed to be turned on.
    scheduler_srv.c / scheduled_action_handle()
    When the "action" is "BT_MESH_SCHEDULER_NO_ACTIONS", it behaves the same as "BT_MESH_SCHEDULER_TURN_ON" or "BT_MESH_SCHEDULER_TURN_OFF" in terms of control.
    	uint16_t model_id = srv->sch_reg[srv->idx].action ==
    				BT_MESH_SCHEDULER_SCENE_RECALL ?
    		BT_MESH_MODEL_ID_SCENE_SRV : BT_MESH_MODEL_ID_GEN_ONOFF_SRV;

    Since "bt_mesh_onoff_set::on_off" is of type bool, when the "action" is "BT_MESH_SCHEDULER_NO_ACTIONS", assigning a value will result in 1 (Turn on).
    			struct bt_mesh_onoff_set set = {
    				.on_off = srv->sch_reg[srv->idx].action,
    				.transition = &transition
    			};

Thanks for reading.

Related