I am trying to use the runIn command to create a "heartbeat" function. My code is:
// parse events into attributes
def parse(String description) {
// will run "watchdogAlarm" in 310 seconds, gets reset if command is run within 310 sec
runIn(310, watchdogAlarm, overwrite: true)
log.debug "Parsing '${description}'"
the logs show an error:
2019-01-26 05:02:32.428 pm errorgroovy.lang.MissingMethodException: No signature of method: dev1548539168694219342782.runIn() is applicable for argument types: (java.util.LinkedHashMap, java.lang.Integer, java.lang.String) values: [[overwrite:true], 310, watchdogAlarm]
I know I don't need the "overwrite = true" but I included it for my better understanding of the syntax.
Its hard to read but runIn is all lower case except for the "I" in "in"
I've looked at ST documentation and can't see what I'm doing wrong.
My only thought is that is cannot be in the above locateion in the parse function, but I'm not sure where I else would put it.
You don't need the[overwrite: true], as that is the default. You only need to include it when you want [overwrite: false]. Overwrite true means that only one such runIn can be pending at one time. Any new one would overwrite any previous timer.
You didn't define the default condition. You omitted the brackets that must surround the third parameter to runIn(). That parameter is a map, and you didn't have a map.
I'm having a similar problem. I have a command which is returning a variable. This is how i have the command defined:
command "delayedOff", ["number"]
Then I have the function delayedOff defined as follows:
def delayedOff(delay){
on()
if (logEnable) log.debug "Turning off in"+delay+"seconds."
runIn(delay, off, )
}
No matter what I define the delayedOff to return it gives me an error. I've tried string, number, integer. It keeps giving me a no signature method error. I have looked high and low and I cannot find an answer to this anywhere. PLEASE HELP before I throw my keyboard out a window!
dev:16972019-02-03 05:06:42.949 pm errorgroovy.lang.MissingMethodException: No signature of method: dev1549231593798278521127.runIn() is applicable for argument types: (java.lang.String, java.lang.String) values: [10, off] Possible solutions: run(), run(), run(java.io.File, [Ljava.lang.String;), println(), on(), println() on line 49 (delayedOff)
THANK YOU!!!!! This is what I get for not being a coder. LMAO
I tried setting the command to return an integer with:
command "delayedOff", ["integer"]
But I guess that wasn't enough. UGH!
What I'm trying to do is to finally move the last of my webCoRE pistons back over to ST cloud. I have it set up so that I can engage override switches for a specific amount of time via Google Home. So, I can say, "Turn on office override for 1 hour" and it will turn the office override on for 1 hour and then turn it off. I was trying to see if that would be easier to do with the driver than via the piston. Since the function requires the internet, i'm not worried about the internet being down because I wouldn't be able to use it anyway. But if the internet goes down in between I still want the switch to turn off after the hour. Rather than call it from ST I was trying to do it in the driver by passing the value through the Maker API.
I have been trying to figure this out for at least 2 hours. OMG...you don't know how much I appreciate the help.
Not a problem. As an Fyi, I remember @mike.maxwell mentioning that the parameter for commands are always Strings. That's why it had to be converted to an Integer. The ["number"] is really just a label for the input box, so you could change it to ["delay"] and it would now show the word "delay" next to the input box.
I couldn't find the post but it's out there somewhere.
EDIT: see a few posts down is not completely accurate.
Well....while hunting down the post (which may or may not exist ) I came across this one. Forgot about this. It actually details the command documentation...where in fact you can pass a numerical value as well as other options. Check it out