im porting over from ST and trying to get my yale integration working
in ST i have this to update the token once a week
schedule(now() + 604800000, getToken) // once a week
it throws this
groovy.lang.MissingMethodException: No signature of method: user_app_Mark_C_uk_YaleApp_129.schedule() is applicable for argument types: (java.lang.Long, java.lang.String) values: [1579637199309, getToken] on line 398 (installed)
Schedule accepts a cron statement (wrapped in double quotes). You are trying to send it a number of miliseconds, which it won't accept. It can accept a validly formatted date/time format, but that only schedules it for that date/time. For once a week on sundays at 3am, you'd use: "15 0 3 ? * 1 *"
If you want to see others, you can look here.
That only runs it once though, right? If you want to run it once a week, wouldn't you rather schedule it? Also, I've been flagged off of using runInMillis by @mike.maxwell as it is more resource heavy, Especially when it is not needed.
You can use the runEvery commands but those are only in certain denominations, like runEvery1Minute, runEvery5Minutes, etc. If you want some thing to repeat on a regular schedule, you have to do it with Cron, You can pass a single date/time expression to schedule also, but that only schedules it once. So you would have to schedule it each week.
If it is required that the token be updated every week, you may want to have a token refresh check in your initialized method. If the hub is off during the scheduled time of the task, it doesn't run it when it reboots. There's not "catch-up" function. You'd have to build that into the app.driver yourself. But, if you're only doing it once a week out of safety, then you shouldn't need to do that.