runIn(...) Never fired in SmartApp but logs show it did


(Matt) #1

Hi guys,

I have a few fairly simple SmartApps working well for me but one issue I just can’t seem to figure out.

I have an evening routine SmartApp that does a bunch of things to turn lights off, turns on soft lighting near the bed, and then schedules a job to turn it off in a few minutes. That job never appears to happen.

Here’s the relevant code:

runIn(60, concludeEveningRoutine, [data : [test : 5]])

And it’s defined:

def concludeEveningRoutine(data)
{
	log.debug "Evening Routine Concluded"
	sendNotificationEvent("Evening Routine Concluded")
	softLighting*.off()
}

Here’s the issue:

  1. Scheduled Job logs show that it did execute
  2. That log message never gets printed
  3. Notification event never appears in SmartThings iOS app
  4. Worst of all, the lights never turn off :slight_smile:

Here’s an image showing SmartThings thinks it executed:

But no print statements or logs anywhere, looks like the function never fired.

Been debugging off and on for a few days, tried a bunch of different things. Any ideas?

Thanks in advance,
Matt


(www.rboyapps.com - Make your home your butler!) #2

I’ve seen this happen before and it’s usually because of a bad statement causing the platform to throw an exception which almost never shows up on the logs these days. It’s crazy hard to figure out.

Start by removing the data, just call the routines, then remove all statements and add them back in 1 by 1.


(Matt) #3

@RBoy thanks for the reply. Appreciate it.

I will do that. Sounds like the only option.

I was just curious if others hit this, too. Sounds like yes.

I have another runIn() statement in another SmartApp that works just fine. That supports your theory.

Will report back if I discover anything useful.

Matt