Run this in a recurring event as frequently as you like, and pass the parameters for device code and time window as noted below.
Suggestions for improvement are welcome! Thanks to other board members for code tips!
-BD
Code:
'Simple watchdog script to notify user when a device is not being updated in a certain period of time. 'Call using parameters for device code and time window in minutes, eg: ("Main","x50,60"), where x50 should 'be changed to the device code of your choice and 60 should be changed to the number of minutes to 'check since the device has been updated. In this example, the device is checked to see if it has been 'updated within the previous 'hour. Make sure to update your email addresses in the If block below. 'Submitted 7-24-12, BrunDog Sub Main(Parm as object) Dim LastUpdate as Date Dim RefNum Dim Device Dim DeviceCode Dim Parms() as String Dim Mins as Integer Parms = Split(Parm.ToString,",") DeviceCode = Parms(0) Mins = Parms(1) LastUpdate = hs.DeviceLastChange(DeviceCode) Device = hs.GetDeviceByRef(hs.GetDeviceRef(DeviceCode)) If DateDiff("n",LastUpdate,Now) > Mins then hs.WriteLog("Status Watchdog", "The " & Device.location & " " & Device.name & " status has not been updated since " & LastUpdate & ".") hs.SendEmail("[EMAIL="youremail@yourISP.com%22,%22youremail@yourISP.com"]youremail@yourISP.com","youremail@yourISP.com[/EMAIL]","** HomeSeer Notice **","The " & Device.location & " " & Device.name & " status has not been updated since "& LastUpdate & ".") Else hs.WriteLog("Status Watchdog", "The " & Device.location & " " & Device.name & " status has been updating normally.") End If End Sub