RunIn not working in Simulator

(zraken) #1

I’m using one of the samples that I modified a bit but for some reason the RunIn part of it is not firing the handler. Here’s the code snippet:

    if (isOpen && isNotScheduled) {
        runIn(maxOpenTime * 60, takeAction)
        state.status = "scheduled" "Scheduled action in $maxOpenTime minutes"

def takeAction(){
log.debug “Running takeAction”

I get the “Scheduled action in 1 minutes” message in the log but I never get the message from within takeAction(). BTW maxOpenTime is set to 1.
Is this supposed to work in the Simulator environment ?, if yes, what could I be doing wrong?, any debugging help would be appreciated.

(Brian Steere) #2

Yes it should work. From reading other forum posts, it seems ST may be have some schedule related issues. I would guess you’re running into that.

(zraken) #3

I tested a bit more and found out that for values of 30 seconds and lower it fires, 40 seconds and higher it does not. I haven’t figured out the exact cut off between 30 and 40 seconds where it starts to fail.
This is a bug, I’m hoping this is only a simulator issue and is not a problem on the Hub. Can anyone confirm this?
Also, is there a work around?

BTW: here’s a simple app to test this out…

 *  Garage Door Monitor
 *  Author: SmartThings
    name: "Test RunIn",
    namespace: "smartthings",
    author: "SmartThings",
    description: "Test RunIn",
    category: "Safety & Security",
    iconUrl: "",
    iconX2Url: ""

preferences {
    section("When the door is open...") {
        input "contsensor", "capability.contactSensor", title: "Which?"

def installed()
    subscribe(contsensor, "", contactHandler)

def updated()
    subscribe(contsensor, "", contactHandler)

def contactHandler(evt) {
    log.debug "Scheduling takeAction"
    runIn(30, takeAction) //vary the number to test out where it fails
def takeAction(){
    log.debug "Running takeAction"

(zraken) #4

Unfortunately this bug is not isolated to the simulator. Confirmed that the problem exists on the Hub too.

(zraken) #5

Looks like this got fixed sometime over the last couple of days.