Announcement

Collapse
No announcement yet.

Trigger based on a device not changing

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

  • Trigger based on a device not changing

    Does anyone know of a way to have a trigger when a device doesn't change? Clearly if it is an on or off device, it is easy to trigger based on it being on or off for a certain period. But what if one wants a trigger based on a device with an unknown value not changing from that value for a certain period of time.
    I would use such a trigger to tell me if certain plug ins or devices are not working. For example, if a remote thermostat's battery is dying, the temperature may not update from 65. I would like an event that triggers if the thermostat value hasn't changed for 48 hours. But if that value is always changing, I'm not sure how to write the event.

  • #2
    Check out the EasyTrigger plugin. It has triggers that will do what you are looking for.
    HS 3.0.0.548: 1970 Devices 1149 Events
    Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

    Comment


    • #3
      Thank you for the idea and quick response

      Comment


      • #4
        For this kind of need, I run an event every 10 minutes that invokes a script that checks lots of things. Has the garage door been open for more than an hour? Has my battery status on some devices not updated for 24 hours, etc. I find it easier to update, expand, contract one script to accomplish lots of these things instead of maintaining a lot of individual events.
        tenholde

        Comment


        • #5
          Originally posted by tenholde View Post
          For this kind of need, I run an event every 10 minutes that invokes a script that checks lots of things. Has the garage door been open for more than an hour? Has my battery status on some devices not updated for 24 hours, etc. I find it easier to update, expand, contract one script to accomplish lots of these things instead of maintaining a lot of individual events.
          would you be willing to share the script?

          Comment


          • #6
            Originally posted by jono View Post

            would you be willing to share the script?
            Code:
            Public Sub Main(ByVal Parms As Object)
                    Dim d1 As Double
            
                    '' Basement Cedar Closet Door
                    'If hs.IsOnByName("Basement Cedar Closet Door") Then
                    '    '' Cedar Closet Open
                    '    If hs.DeviceTimeByName("Basement Cedar Closet Door") > 15 Then
                    '        hs.speakEx(37, "The cedar closet door is open")
                    '    End If
                    'End If
            
                    ' '' Basement Storage Room Doors
                    'If hs.IsOnByName("Basement Stor Door East") Then
                    '    '' East Door Open
                    '    If hs.DeviceTimeByName("Basement Stor Door East") > 90 Then
                    '        hs.speakEx(37, "The east basement storage door is open")
                    '    End If
                    'End If
                    'If hs.IsOnByName("Basement Stor Door West") Then
                    '    '' West Door Open
                    '    If hs.DeviceTimeByName("Basement Stor Door West") > 90 Then
                    '        hs.speakEx(37, "The west basement storage door is open")
                    '    End If
                    'End If
            
                    '' Jack and Jill Bathroom Fan and Ceiling Heat
                    If hs.DeviceValueByName("J and J Bath Ceiling Fan") > 0 Then
                        If hs.DeviceTimeByName("J and J Bath Ceiling Fan") > 45 Then
                            ControlDevice("J and J Bath Ceiling Fan", "Off")
                        End If
                    End If
                    If hs.DeviceValueByName("J and J Bath Ceiling Heat") > 0 Then
                        If hs.DeviceTimeByName("J and J Bath Ceiling Heat") > 45 Then
                            ControlDevice("J and J Bath Ceiling Heat", "Off")
                        End If
                    End If
            
                    '' Master Bathroom Fan
                    If hs.DeviceTimeByName("Master Bath Fan") > 45 Then
                        ControlDevice("Master Bath Fan", "Off")
                    End If
            
                    '' Basement Bathroom Fan and Heat
                    If hs.DeviceValueByName("Bsmt Bath Ceiling Fan") > 0 Then
                        If hs.DeviceTimeByName("Bsmt Bath Ceiling Fan") > 30 Then
                            ControlDevice("Bsmt Bath Ceiling Fan", "Off")
                        End If
                    End If
                    If hs.DeviceValueByName("Bsmt Bath Ceiling Heat") > 0 Then
                        If hs.DeviceTimeByName("Bsmt Bath Ceiling Heat") > 30 Then
                            ControlDevice("Bsmt Bath Ceiling Heat", "Off")
                        End If
                    End If
            
                    '' Guest Bathroom Fan
                    If hs.DeviceValueByName("Guest Bathroom Fan") > 0 Then
                        If hs.DeviceTimeByName("Guest Bathroom Fan") > 30 Then
                            ControlDevice("Guest Bathroom Fan", "Off")
                        End If
                    End If
            
                    '' Bsmt Bedroom Bath Fan
                    If hs.DeviceValueByName("Bsmt Bedroom Bath Center SW") > 0 Then
                        If hs.DeviceTimeByName("Bsmt Bedroom Bath Center SW") > 45 Then
                            ControlDevice("Bsmt Bedroom Bath Center SW", "Off")
                        End If
                    End If
            
                    '' UPS
                    'If hs.DeviceValueByName("tenHsPower AC Line Status") <> 1 Then
                    '    hs.SpeakEx(37, "UPS Offline, Battery Level is " & hs.DeviceValueByName("tenHsPower Battery Life Percent") & " Percent", False)
                    'End If
            
            
                    '' Garage Doors
                    If hs.DeviceValueEx(hs.GetDeviceRefByName("Elk M1 Zone UltraM1G3 Plugin Zone 066 [Garage Door SO]")) <> 1 Then
                        If hs.DeviceTimeByName("Elk M1 Zone UltraM1G3 Plugin Zone 066 [Garage Door SO]") > 60 Then
                            hs.SpeakEx(37, "the south garage door is open", True)
                        End If
                    End If
                    If hs.DeviceValueEx(hs.GetDeviceRefByName("Elk M1 Zone UltraM1G3 Plugin Zone 067 [Garage Door NO]")) <> 1 Then
                        If hs.DeviceTimeByName("Elk M1 Zone UltraM1G3 Plugin Zone 067 [Garage Door NO]") > 60 Then
                            hs.SpeakEx(37, "the north garage door is open", True)
                        End If
                    End If
            
                    '' Master Bath Floor Heat
                    Const TempMax As Double = 70.0, TempMin As Double = 69.0
                    Dim st As String
                    st = hs.CAPIGetStatus(hs.GetDeviceRefByName("RFXCOM RFXCOM Oregon01 Temperature")).Status
                    If st.ToUpper.Contains("FAILURE") Then
                        hs.WriteLogEx("LongLoop", "Master Bath Temperature Communications Failure", "#FF0000")
                        hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRefByName("Master Bath Floor"), True, "Off", False, False))
                    Else
                        d1 = hs.DeviceValueEx(hs.GetDeviceRefByName("RFXCOM RFXCOM Oregon01 Temperature"))
                        If d1 < TempMin Then
                            '' Turn on Floor Heat
                            If hs.DeviceValueEx(hs.GetDeviceRefByName("Virtual Virtual HouseOccupied")) = 1 Then
                                hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRefByName("Master Bath Floor"), True, "On", False, False))
                                hs.WriteLog("LongLoop", "Bath Floor Heat Turned ON")
                            End If
                        End If
                        If d1 > TempMax Then
                            '' Turn OFF Floor Heat
                            hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRefByName("Master Bath Floor"), True, "Off", False, False))
                            hs.WriteLog("LongLoop", "Bath Floor Heat Turned OFF")
                        End If
                    End If
                End Sub
                Private Sub ControlDevice(DeviceName As String, DeviceAction As String)
                    '' Do all CAPI stuff to control a device
                    Dim CC As HomeSeerAPI.CAPIControl, CCResp As HomeSeerAPI.CAPIControlResponse
                    Dim DevRef As Integer
            
                    DevRef = hs.GetDeviceRefByName(DeviceName)
                    If DevRef < 0 Then
                        hs.WriteLog("ControlDevice", "Error, Could Not Get Device Reference for: " & DeviceName)
                        Exit Sub
                    End If
                    CC = hs.CAPIGetSingleControl(DevRef, True, DeviceAction, False, False)
                    If IsNothing(CC) Then
                        hs.WriteLog("ControlDevice", "Error, Could Not Find Action: " & DeviceAction & "     for Device: " & DeviceName)
                        Exit Sub
                    End If
                    CCResp = hs.CAPIControlHandler(CC)
                End Sub

            As you can see, I comment out sections sometimes based upon WAF.
            tenholde

            Comment


            • #7
              To give more details about the EasyTrigger solution: The trigger is in the category "EasyTrigger: A device's value is" and is called "This device's value has NOT changed for exactly..."
              Here is a screenshot:
              Click image for larger version

Name:	valuehasnotchanged.png
Views:	12
Size:	10.5 KB
ID:	1273523

              Comment

              Working...
              X