Public Sub Main(parms As Object) 'Enter the device references of the nodes you wish to check. The "do not update changed status" box on the device config should be unchecked for devices like battery life. 'NOTE: the number of references needs to be entered below in devCount declaration. Dim devRef() As Integer = { 87, 47, 25, 7} 'Number of references Dim devCount As Integer = 4 'max delta time in minutes allowed per device Dim maxChangeTime As Integer = 720 'Internal device reference value to store the number of nodes that did not respond (0 means all nodes have changed in the last x minutes) Dim warnFlagDev As Integer = 89 'Declare required variables and objects Dim lastChange As DateTime Dim currentTime As DateTime = DateTime.now Dim deltaM As Integer Dim warnFlag As Integer Dim dev As Object Dim devName As String Dim devLocation As String 'Log message that script is running hs.WriteLog("Dev Health", "Checking the selected devices have changed in the last " & maxChangeTime & " minutes.") 'Step through the array of devices. NOTE! as mentioned above, the second number of For i As Integer = 0 To (devCount -1) lastChange = hs.DeviceLastChangeRef(devRef(i)) deltaM = currentTime.Subtract(lastChange).TotalMinutes dev = hs.GetDeviceByRef(devRef(i)) devName = dev.Name(hs) devLocation = dev.Location(hs) 'If device has NOT reported in x minutes, increment the flag and print a warning message in the log If deltaM > maxChangeTime Then hs.WriteLog("Warning", "Device '" & devLocation & " " & devName & "' (Ref: " & devRef(i) & ") Last Changed: " & deltaM & " minutes ago") warnFlag+=1 Else 'If device has reported in x minutes, increment print a message in the log hs.WriteLog("Dev Health", "Device '" & devLocation & " " & devName & "' (Ref: " & devRef(i) & ") Last Changed: " & deltaM & " minutes ago") End If Next 'Once all devices have been read, set the internal device to the number of timed out nodes hs.SetDeviceValueByRef(warnFlagDev, warnFlag, True) End Sub