Error on runIn()


#1

Hi Guys,

As stated as this doc -> http://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html#runin

i tried to run the examble but i got this error…

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method physicalgraph.scheduling.SchedulerFactory#getSchedulerForRunIn.
Cannot resolve which method to invoke for [null, class java.lang.Integer, class java.util.LinkedHashMap] due to overlapping prototypes between:
[class physicalgraph.app.InstalledSmartApp, int, interface java.util.Map]
[class physicalgraph.device.cache.DeviceDTO, int, interface java.util.Map]

Anyone know why?


Aeon Home Energy Meter v1 -- Read Clamps Separately
(Jim Anderson) #2

Hi @Cety, I’ll take a look at this today.


(Jim Anderson) #3

Can you provide more context for this? Please provide at least the line where you are calling runIn() and the handler method definition. Even better, create a gist of the whole SmartApp and link to it. Thanks!


#4

Hi Jim,

Here’s the context…

preferences {
section(“Title”) {
// TODO: put inputs here
}
}

def installed() {
log.debug “Installed with settings: ${settings}”

initialize()

}

def updated() {
log.debug “Updated with settings: ${settings}”

unsubscribe()
initialize()

}

def initialize() {
// TODO: subscribe to attributes, devices, locations, etc.
}

// TODO: implement event handlers

runIn(300, myHandlerMethod)
runIn(400, “myOtherHandlerMethod”)

def myHandlerMethod() {
log.debug “handler method called”
}

def myOtherHandlerMethod() {
log.debug “other handler method called”
}

Basically I just copy paste from http://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html#runin
to new App.

I want to execute runIn() method in interval without any action triggered.


(Jim Anderson) #5

Looks like you have the runIn() calls outside of a method. Place them inside your initialize() block and it should work.


#6

Thanks, It works :smile: