Announcement

Collapse
No announcement yet.

Last Echo question

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

    Last Echo question

    Can you use the "Last Echo" device as a condition in a event that uses a "has been off at least" option? What I want to accomplish is when there is no Echo for at least 30 min. Fire event. Can I use this device for that?
    Hector
    ____________________________________
    Win.2003 OS, HS3
    BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
    BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
    MyTrigger,ACRF2,W800,Zwave
    AP800,Honeywell Stat

    #2
    You could probably do it using a recurring event every minute or so and then write a script to check the last On for the sensor and if it is greater than 30 minutes then run your event in the script.
    Cheers,
    Bob
    Web site | Help Desk | Feature Requests | Message Board

    Comment


      #3
      Try something like this (not tested)
      This uses M1 as the sensor and triggers an event called Test1
      Run this from a recurring event
      This is a vb.net script

      Code:
      Sub Main(ByVal parms As Object)
          Dim mySensor As Object = Nothing
          mySensor = hs.Plugin("BLRadar").GetSensorByDeviceCode("M1")
          If Not mySensor Is Nothing Then
              Dim diffMinutes As Long = DateDiff(DateInterval.Minute, mySensor.LastOn, DateTime.Now)
              If diffMinutes >= 30 Then
                  hs.TriggerEvent("Test1")
              End If
              diffMinutes = Nothing
          End If
          mySensor = Nothing
      End Sub
      Cheers,
      Bob
      Web site | Help Desk | Feature Requests | Message Board

      Comment


        #4
        You could even do something like this so you could reuse the same script for multiple sensors
        You would need to call this from your recurring event and pass the parameter info for the sensor

        Parameter info should be passed like this:
        sensorDeviceCode|minutes|eventName|occupancyDeviceCode

        Example:
        M1|30|Test1|M99



        Code:
        Sub Main(ByVal info As String)
            Dim splitArray As String() = info.Trim.Split("|")
            If splitArray.Length = 4 Then
                Dim mySensor As Object = Nothing
                mySensor = hs.Plugin("BLRadar").GetSensorByDeviceCode(splitArray(0))
                If Not mySensor Is Nothing Then
                    Dim diffMinutes As Long = DateDiff(DateInterval.Minute, mySensor.LastOn, DateTime.Now)
                    If diffMinutes >= Integer.Parse(splitArray(1)) Then
                        If hs.IsOn(splitArray(3)) Then
                            hs.TriggerEvent(splitArray(2))
                        End If
                    End If
                    diffMinutes = Nothing
                End If
                mySensor = Nothing
            End If
            splitArray = Nothing
        End Sub
        Last edited by Blade; June 5, 2012, 03:41 PM.
        Cheers,
        Bob
        Web site | Help Desk | Feature Requests | Message Board

        Comment


          #5
          Thanks Bob, I will try it and let u know.
          Hector
          ____________________________________
          Win.2003 OS, HS3
          BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
          BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
          MyTrigger,ACRF2,W800,Zwave
          AP800,Honeywell Stat

          Comment


            #6
            Hi Bob,
            I'm also interested in this script. What I would like to accomplish is the following:
            Check the last echo, if the last echo was more then 10 minutes then set the status on "vacancy" .
            These are my screen shoots of what I have done so far. Your script is a vb script.
            This is what I get so far
            6/2/2012 2:03:15 PM Error 3 Running script BLRadarLastEcho.vb :method not found6/2/2012 2:03:15 PM Event Running script in background: BLRadarLastEcho.vb("main", "#1|2|Test1")

            Please see attached print screens.
            Attached Files

            Comment


              #7
              Try with a capital M on Main

              If you want 10+ minutes then you would want to use this:

              "#1|10|Test1"
              Cheers,
              Bob
              Web site | Help Desk | Feature Requests | Message Board

              Comment


                #8
                Thanks Bob, almost, right now I'm getting this message, I changed few codes with the same results.
                6/3/2012 10:46:22 AM BLRadar Error GetSensorByDeviceCode(): Device Code (A6) was NOT found in the Sensor Collection!6/3/2012 10:46:22 AM Event Running script in background: BLRadarLastEcho.vb("Main", "A6|2|Test1")

                Comment


                  #9
                  Are you sure A6 is a sensor in the plugin?
                  It should work if A6 is a sensor in BLRadar. It must be the actual sensor and not a virtual device assigned to the sensor.
                  Cheers,
                  Bob
                  Web site | Help Desk | Feature Requests | Message Board

                  Comment


                    #10
                    Bob, you are correct, I assumed that I could use the other devices from BLRadar as the last echo sensor. I can still work around this issue by creating other virtual sensors.

                    Thank you very much,
                    Aldo

                    P.S. in the future if you could, would it be possible to create a trigger using the same concept?

                    Comment


                      #11
                      Hi Bob,
                      I created an active zone that includes all the occupancy sensors, I would like to use it to trigger your script so when there is no occupancy it will set the the device vacancy, it seems like it is not working, it always trigger the event, any suggestions?

                      Comment


                        #12
                        Originally posted by aldo View Post
                        Hi Bob,
                        I created an active zone that includes all the occupancy sensors, I would like to use it to trigger your script so when there is no occupancy it will set the the device vacancy, it seems like it is not working, it always trigger the event, any suggestions?
                        This is something that I can use myself, can you post the script to see how you made it?
                        Hector
                        ____________________________________
                        Win.2003 OS, HS3
                        BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
                        BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
                        MyTrigger,ACRF2,W800,Zwave
                        AP800,Honeywell Stat

                        Comment


                          #13
                          I used the script that Bob made below. Unfortunately I have issues so far with it but it could be me.

                          Comment


                            #14
                            Which one did u used the 1 or the 2?
                            Hector
                            ____________________________________
                            Win.2003 OS, HS3
                            BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
                            BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
                            MyTrigger,ACRF2,W800,Zwave
                            AP800,Honeywell Stat

                            Comment


                              #15
                              I used the second script, it has more features. If you have any success, please let me know.

                              Comment

                              Working...
                              X