Unscheduling a schedule

I would like to get some feedback on whether what I have below is the correct approach or should I use some other methods. Basically the code is called (as if in a loop) each time with a new “somedevice.value” and might look similar to this:\

  def myvalue=somedevice.value
if (myvalue < thePrefsMinimumValue) {
	if (state.jobScheduled== false) {
		runIn(90, myHandlerMethod)
else { // myvalue > thePrefsMinimumValue therefore cancel any scheduled (runIn()) jobs previously set

my questions is:
Will unschedule terminate any previously submitted runIn()??
The whole idea is to call a function if the somedevice.value remains below a set value for an extended time. If the value rises above this set value before this time period expires cancel the scheduled job.

Feedback apprreciated

In theory, unschedule() without an argument will delete all Scheduled Jobs for that SmartApp.

1 Like

unschedule(myHandlerMethod) will unscheulde just that one schedule

1 Like