I’m working on a smartapp that on a subscribed event will poll a device i.e. event “on” poll every minuet, event “off” poll every hour. My current code works fine as long as it only manages 1 device and i think this is dumb.
Currently where i’m stuck is passing the variable to the scheduled function and i’m using pollster to work it out.
def poll(Integer min) {
log.debug "${min}"
}
schedule(“0 0/1 0 0 * * *”, poll(device)) passes the variable but fails horribly in this case device = 1
cb78b73d-7a93-4c18-afcc-946e1848639d 11:03:52 AM CDT: error
groovy.lang.MissingMethodException: No signature of method: physicalgraph.scheduling.CassandraInstalledSmartAppSchedulerService.schedule() is applicable for argument types: (physicalgraph.app.InstalledSmartApp, java.lang.Integer, sun.util.calendar.ZoneInfo, java.lang.String, java.util.LinkedHashMap) values: [Pollster, 1, sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]], ...]
Possible solutions: schedule(java.lang.Object, java.lang.String, java.util.TimeZone, java.lang.String), schedule(java.lang.Object, java.lang.String, java.util.TimeZone, java.lang.String, java.util.Map) @ line 153
cb78b73d-7a93-4c18-afcc-946e1848639d 11:03:52 AM CDT: debug 1
I also tried schedule(“0 0/1 0 0 * * *”, “poll(${device})”) and it fails less horribly, device still = 1
cb78b73d-7a93-4c18-afcc-946e1848639d 11:13:10 AM CDT: error groovy.lang.MissingMethodException: No signature of method: script14341255901071042041037.poll(1)() is applicable for argument types: () values: []
Possible solutions: poll(java.lang.Integer)
What am i missing?