Announcement

Collapse
No announcement yet.

Last Echo question

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

    #76
    Last Echo

    I cannot make this script to work ....

    My need is very simple:
    I have a DSC sensor (that switch to ON for a few seconds when the sensor detects a move).
    What I would like to do is :
    When the Last Echo has been the same for X seconds, then trigger Event Y
    That's all .....
    what would be the script that would do that ?
    Thanks

    Comment


      #77
      Last Echo

      Any help on this ?
      Thanks

      Comment


        #78
        For example:

        You have a sensor called A1. If it detects motion (ON) then you want to check the Last ON and do something?

        Tell me exactly what you want to do and give me an example
        Cheers,
        Bob
        Web site | Help Desk | Feature Requests | Message Board

        Comment


          #79
          LastEcho

          Blade,
          I have several motion sensors in the home. The last one being activated can be seen looking at the Last Echo device.
          What I would like to do is, when the motion sensor at the exit is the one that Last echo is mentionning, I would like to trigger an event if no other motion sensors have been activated during 30mn ..
          Can you write the small script doing that ?
          Many thanks in advance

          Comment


            #80
            OK I see what you want now.
            This is different than the other script.
            Let me think of the best way to do it
            Cheers,
            Bob
            Web site | Help Desk | Feature Requests | Message Board

            Comment


              #81
              Hi Blade,
              These are great scripts that if implemented in your plug-in would be great to use and access. I like the way you implemented the zone event, great job there, it saved me lot of time and scripts.
              Aldo

              Comment


                #82
                You will need to create an event with a BLRadar sensor change trigger for your exit motion sensor ECHO
                For this example, let's say your exit sensor code is A1
                This event will run when your exit motion sensor goes ON

                Set the event action to run this script and pass in the parameters like this:

                ("A1|30|Event Name")

                Here is the script to try out:

                Parameter 1 - exit sensor device code
                Parameter 2 - number of minutes for all other motion sensors to be off
                Parameter 3 - Event Name to run

                Code:
                Sub Main(ByVal info As String)
                
                'Array 0 - Last Echo Device Code for trigger
                'Array 1 - number of minutes for all other motion sensors to be off
                'Array 2 - Event Name 
                
                    Dim splitArray As String() = info.Trim.Split("|")
                    If splitArray.Length = 3 Then
                            If hs.IsOn(hs.DeviceExistsCode(splitArray(0))) Then
                                Dim currentDate As Date = DateTime.Now
                            	Dim anySensorsOn As Boolean = False
                            	For Each s As Object In hs.PluginFunction("BLRadar", "", "MotionSensors", Nothing)
                            	    If Not s Is Nothing Then
                			Dim diffMinutes As Long = DateDiff(DateInterval.Minute, s.LastOn, currentDate)
                			If diffMinutes <= Integer.Parse(splitArray(1)) Then
                            	    	    anySensorsOn = True
                            	    	    Exit For
                			End If
                			diffMinutes = Nothing
                            	    End If
                            	Next
                                hs.writelog("Info", "anySensorsOn : " & anySensorsOn )
                	        If anySensorsOn = False Then
                		    hs.TriggerEvent(splitArray(2))
                	        End If
                                currentDate = Nothing
                	        anySensorsOn = Nothing
                            End If
                    End If
                    splitArray = Nothing
                End Sub
                I am sure this will take some work getting going but we will get it.
                Let me know what happens
                Last edited by Blade; February 1, 2015, 04:32 PM.
                Cheers,
                Bob
                Web site | Help Desk | Feature Requests | Message Board

                Comment


                  #83
                  LastEcho

                  Thanks a lot for your support Blade !!

                  Comment


                    #84
                    LastEcho

                    I am getting an error when running the script :

                    Compiling script C:\Program Files\HomeSeer HS3\scripts\LastEcho.vb: String constants must end with a quotation mark.

                    Any idea?

                    Comment


                      #85
                      My bad, I updated it. Try it again
                      Cheers,
                      Bob
                      Web site | Help Desk | Feature Requests | Message Board

                      Comment


                        #86
                        I am stepping out for a bit but will fix anything once I get back if it is not too late
                        Cheers,
                        Bob
                        Web site | Help Desk | Feature Requests | Message Board

                        Comment


                          #87
                          LastEcho

                          Blade,
                          No more errors .....but the event does not trigger .
                          I passed "Z3|1|TestEcho" ....then the Z3 sensor (Only) was activated for some seconds ....but nothing happens after 1 mn

                          Comment


                            #88
                            I updated it again
                            You should see a line in your HS log giving the value of anySensorsOn

                            By using "Z3|1|TestEcho", this means that all other sensors must have not been on in the last minute
                            Cheers,
                            Bob
                            Web site | Help Desk | Feature Requests | Message Board

                            Comment


                              #89
                              LastEcho

                              Still no luck.
                              I tried with Z3 (the DSC sensor) and V3 (the virtual device that you recommended to create) and I see nothing in the log. (I get no errors though)

                              What is strange again is that the virtual device V3 and the DSC sensor Z3 are both indicating in the last change the correct time BUT the last ECHO device is mentionning the correct sensor activated but not the correct time .

                              Any idea?

                              Comment


                                #90
                                You are getting no logging in the HS log at all?
                                It should be displaying sensor device code
                                The hs.Writelog calls in the script should show in the log (at least some of them)

                                I am wondering if the trigger is not firing.
                                Can you capture a debug log from BLRadar and attach it for a sensor when you trigger it
                                Cheers,
                                Bob
                                Web site | Help Desk | Feature Requests | Message Board

                                Comment

                                Working...
                                X