How can i schedule a method with parameters?

I found an official SmartThings response which seems to confirm parameters cannot be used; only a string with the name of the method. Though you are not creating a new closure, I think that the same limitation of carrying the parameter values to that new “invocation” of the SmartApp is applicable here.

But I’ve thought of another possible, but perhaps lousy, solution:

  • Move the “schedule” effect inside the body of the method by using the “delay:” option to the Devices’s setCoolSetpoint Command?

e.g., setCoolSetpoint( temp, delay: < longtime_milliseconds calculated until the desired schedule time > )

NB: This is still a guess at this time. Old posts said that delay was limited to under 60 seconds, but newer posts said that restriction was removed. Still seems too awkward; but sharing my thoughts for now.


So…

Take a look at this example for how a complex scheduling of Thermostat Temperature setting was handled:

https://github.com/constjs/SmartThings-Apps/blob/5afe2cf3fd010305e4d84cd8bac3ef9bf3fb9242/Programmable_thermo.app.groovy