Announcement

Collapse
No announcement yet.

Check device if still working based on the date changed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Check device if still working based on the date changed

    Hi,
    I would like to monitor for devices to make sure they still updating. An example would be monitor z-wave devices, temperature sensors, motion sensors especially if they monitor conditions and powered by batteries. How do you monitor such devices?

    Thanks,
    Aldo

    #2
    EasyTrigger excels at doing this. You can find devices that have not changed for hh:mm:ss.
    Here's an event that makes sure my energy device is updating:
    Attached Files
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Like Rob wrote Easy Trigger will do it. Before Easy Trigger I used a simple script with an array of device Reference IDs to check and the hs.DeviceTime function. In the script I go through the array of temperature sensors looking for one that hasn't changed in 45 minutes. The function returns an integer which is the time since a device was updated in minutes. The script acts on it if the minutes are greater than 45. Here, the script simply generates a log message, and a Pushover message is triggered based on the log message using an UltraLog3 Log Match trigger.

      Code:
      Sub Main(ByVal Parm As Object)
      
          Try
              Dim ListOfDevices() As Integer = {280, 278, 270, 269, 137, 89, 136, 134, 122, 125, 134, 133, 124}
      	'Boiler Supply, Boiler Return, BP S, BP R, LR S, LR R, MBR S, MBR R, RO S, RO R, MO S, MO R
      
              For Each Device As Integer In ListOfDevices
      
                  ' hs.writelog("DeviceLastChange", "Device Reference: " & Device & " Minutes Since Last Changed State: " & hs.DeviceTime(Device))
      
                  If hs.DeviceTime(Device) > 45 Then
      
      
                      'do something here, trigger an event, send an email, etc.
      
                       hs.writelog("Sensor Error", & hs.DeviceName(Device) & " has not updated in over " & hs.DeviceTime(Device) & " minutes")
      
                  End If
              Next
      
          Catch ex As Exception : hs.writelog("DeviceLastChange", "Error: " & ex.message)
          End Try
      
      End Sub
      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        Perfect, this is what I was looking for. I did not realized that it had this function build in.

        Thank you,
        Aldo

        Originally posted by rmasonjr View Post
        EasyTrigger excels at doing this. You can find devices that have not changed for hh:mm:ss.
        Here's an event that makes sure my energy device is updating:

        Comment


          #5
          Thanks, I like this script as well, I could use both easytrigger on a specific sensor and this one for multiple sensors.

          Thank you,
          Aldo

          Originally posted by rprade View Post
          Like Rob wrote Easy Trigger will do it. Before Easy Trigger I used a simple script with an array of device Reference IDs to check and the hs.DeviceTime function. In the script I go through the array of temperature sensors looking for one that hasn't changed in 45 minutes. The function returns an integer which is the time since a device was updated in minutes. The script acts on it if the minutes are greater than 45. Here, the script simply generates a log message, and a Pushover message is triggered based on the log message using an UltraLog3 Log Match trigger.

          Code:
          Sub Main(ByVal Parm As Object)
          
              Try
                  Dim ListOfDevices() As Integer = {280, 278, 270, 269, 137, 89, 136, 134, 122, 125, 134, 133, 124}
          	'Boiler Supply, Boiler Return, BP S, BP R, LR S, LR R, MBR S, MBR R, RO S, RO R, MO S, MO R
          
                  For Each Device As Integer In ListOfDevices
          
                      ' hs.writelog("DeviceLastChange", "Device Reference: " & Device & " Minutes Since Last Changed State: " & hs.DeviceTime(Device))
          
                      If hs.DeviceTime(Device) > 45 Then
          
          
                          'do something here, trigger an event, send an email, etc.
          
                           hs.writelog("Sensor Error", & hs.DeviceName(Device) & " has not updated in over " & hs.DeviceTime(Device) & " minutes")
          
                      End If
                  Next
          
              Catch ex As Exception : hs.writelog("DeviceLastChange", "Error: " & ex.message)
              End Try
          
          End Sub

          Comment

          Working...
          X