runPeriodically(), runEvery1Hour() scheduler questions

I’ve had some questions on these in open forum and not gotten answers so thought I would try here…

(1) runPeriodically() is in Weather Station Tile but not documented, is it deprecated?

(2) can the runEvery1Hour() methods be used in Device Handler to poll something (like Weather Underground)?

(3) what/where is the best place to call them in a Device Handler so that we don’t have to re-install the device to re-execute runEvery1Hour()? Okay to do this in order to easily reschedule if it stops running…
def refresh() {

(4) what happens if runEvery1Hour() is called again while it is already scheduled? Or… do we need to unschedule() first (doc’s say this is expensive and not to be called frequently)?

  1. As far as I’m concerned, unless there’s several “good” examples in the SmartThings GitHub repo of a certain command being used, my motto is that if it is not Documented, it does not exist.

  2. runEvery1Hour() and all the other scheduling methods, AFAIK, are only usable in SmartApps, they are not applicable to Device Type Handler code. You need to run a companion SmartApp which uses such scheduling methods and have them call the “refresh()”, “poll()” or whatever Command(s) are appropriate for the Device. Notice what section of the Docs that method is in! – smartapp-ref.html ?highlight=runevery1hour


While technically it does work in the DH and I have used it for housekeeping activites however do note it will not initiate any outbound connections like REST calls or Z-Wave functions etc. The DH architecture requires a user or device initiated context to allow for outbound communication, so that why you would need a SA (like pollster or the one I posted here [RELEASE] Smart Weather Station Tile Updater - Fix Broken Modes) for it to work.

1 Like

@Jim … is this true? Does "runEvery1Hour() and/or other scheduling methods work from within a DTH? If so, is a Documentation update pending? Thanks!

I don’t know about runEveryXXX(), but surprisingly, runIn() works in a DTH! I don’t think it used to, but it does now!

How would I implement runIn() for a DTH Im using? Ive tried the two following codes, but it doesnt refresh:

def installed() {
	runPeriodically(600, poll)
def installed() {

I strongly recommend only using Documented functionality… i.e., if you want to use runPeriodically(), add a SmartApp that calls your poll method for the selected device(s), since that method is only documented for use in a SmartApp.