Inactive Scheduler actions are triggered after Time Set

Hello.

I am experiencing an issue in Bluetooth Mesh where a Schedule entry that is set to "Inactive" is triggered when the time is updated.

Steps to reproduce:

  1. Register a new schedule using the Scheduler Action Set.
  2. Set the registered schedule to "Inactive".
  3. Update the time using Time Set.

In my application, I call bt_mesh_scheduler_srv_time_update within the callback for the Time Set message.

I found that the issue is resolved by modifying bt_mesh_scheduler_srv_time_update in scheduler_srv.c as shown below.
It seems that when rescheduling during a time update, the code was not checking whether the action was active or not.

Could you please confirm if this is the correct fix?

int bt_mesh_scheduler_srv_time_update(struct bt_mesh_scheduler_srv *srv)
{
	if (srv == NULL) {
		return -EINVAL;
	}

	for (uint8_t idx = 0; idx < BT_MESH_SCHEDULER_ACTION_ENTRY_COUNT; ++idx) {
#if 0
		schedule_action(srv, idx);
#else
		if ( is_entry_defined(srv, idx) ) {
			schedule_action(srv, idx);
		}
#endif
	}

	run_scheduler(srv);
	return 0;
}

Best regards,

a.da

Related