Announcement

Collapse
No announcement yet.

Scripting DelayTrigger error?

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

    Scripting DelayTrigger error?

    What am I doing wrong?
    hs.DelayTrigger(300, "Shower Fan Off")

    Throws:
    Exception in DelayTrigger: Object reference not set to an instance of an object.

    Event exists. Tried lower case as well.

    Thanks,
    Z

    #2
    I'm having the same issue with hs.DelayTrigger. Did you ever find a solution?
    Regards, Bob

    Comment


      #3
      Originally posted by itanic View Post
      I'm having the same issue with hs.DelayTrigger. Did you ever find a solution?
      That's so long ago I don't remember what fixed it
      Looking at the script, it works now. The only think I can think might have been the problem, is the delay is defined as a Long value not an integer.
      Of course the Event has to be named correctly as well.

      Z

      Comment


        #4
        I also have this problem.

        Does someone has an solution?

        My situation:
        within a script a use this function to execute another event.

        I looks like if i only use "events" and not within a script i don't have this problem.

        Comment


          #5
          Running into this now as well. I'm using the whole event name as Homeseer describes it in the log: Event Trigger "Whole House Auto Dim"

          I've tried just the tail end of the name as well. Tried making the delay a long as well and that didn't solve anything.

          Anyone?


          Running script /usr/local/HomeSeer/scripts/lights.vb :Exception has been thrown by the target of an invocation.->Does entry point wholeHouseAutoDim exist in script? at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at A.c17b105f989efe61e5979e67bec1ef734.cffd66cb0782c50126727e3f a75582d7a () [0x00000] in :0

          Comment


            #6
            Actually, n/m. I was an idiot and it was actually failing on the previous line.

            Comment


              #7
              Originally posted by holmes View Post
              Running into this now as well. I'm using the whole event name as Homeseer describes it in the log: Event Trigger "Whole House Auto Dim"

              I've tried just the tail end of the name as well. Tried making the delay a long as well and that didn't solve anything.

              Anyone?


              Running script /usr/local/HomeSeer/scripts/lights.vb :Exception has been thrown by the target of an invocation.->Does entry point wholeHouseAutoDim exist in script? at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at A.c17b105f989efe61e5979e67bec1ef734.cffd66cb0782c50126727e3f a75582d7a () [0x00000] in :0
              You're running on a PI (ie Mono)?. If so, which vers?
              What does your code look like, are you calling anything just before the Delay?

              Z

              Comment


                #8
                Originally posted by vasrc View Post
                What am I doing wrong?
                hs.DelayTrigger(300, "Shower Fan Off")

                Throws:
                Exception in DelayTrigger: Object reference not set to an instance of an object.

                Event exists. Tried lower case as well.

                Thanks,
                Z
                Did this get resolved or does anyone else have this problem? After upgrading to HS3, and converting my VB.net scripts over as well, most everything works. However, intermittently I will have a VB script that will trigger the following error:

                Exception in DelayTrigger: Object reference not set to an instance of an object

                It's weird, because it doesn't happen consistently - only sometimes. And it doesn't seem to matter whether the script with DelayTrigger is launched via an event or from another event. In either case, sometimes it works, and sometimes it fails with this error. (No mods to the script).

                The line in the script is:
                hs.DelayTrigger(2, "SCENE - ALL OFF AlexaGoToSleep")

                Appreciate the feedback or tips how to troubleshoot.

                Comment


                  #9
                  Originally posted by LeeIII View Post
                  Did this get resolved or does anyone else have this problem? After upgrading to HS3, and converting my VB.net scripts over as well, most everything works. However, intermittently I will have a VB script that will trigger the following error:

                  Exception in DelayTrigger: Object reference not set to an instance of an object

                  It's weird, because it doesn't happen consistently - only sometimes. And it doesn't seem to matter whether the script with DelayTrigger is launched via an event or from another event. In either case, sometimes it works, and sometimes it fails with this error. (No mods to the script).

                  The line in the script is:
                  hs.DelayTrigger(2, "SCENE - ALL OFF AlexaGoToSleep")

                  Appreciate the feedback or tips how to troubleshoot.

                  This continues to be an issue for me. Two of my mainstream scripts continue to pop this error. I have logged a Bugzilla ticket on this one. It sounds like there are some known anomole's going on with this.

                  Appreciate if anyone else is using DelayTrigger (or alternate way to fire an event from script) with recommendation on a workaround.

                  Thanks in advance!

                  Comment


                    #10
                    I was having this problem a while back. The workaround I used is to trigger a manual event that does the delay trigger. That won't work if you want a variable delay, but in my case I didn't need that.

                    Comment


                      #11
                      Originally posted by LeeIII View Post
                      This continues to be an issue for me. Two of my mainstream scripts continue to pop this error. I have logged a Bugzilla ticket on this one. It sounds like there are some known anomole's going on with this.

                      Appreciate if anyone else is using DelayTrigger (or alternate way to fire an event from script) with recommendation on a workaround.

                      Thanks in advance!
                      Take a look at the EventSetTimeTrigger command.

                      http://help.homeseer.com/help/HS3/st...settimetrigger

                      As an example, triggering the event in two minutes time could be achieved by something like this:


                      Code:
                      Sub Main (Byval parms as object)
                      
                      Dim d as Date = DateTime.Now.AddMinutes(2)
                      Dim EvRef As Integer = hs.GetEventRefByName("your event name")
                      Dim res As Boolean = hs.EventSetTimeTrigger(EvRef, d)
                      hs.SaveEventsDevices()
                      End Sub
                      Jon

                      Comment


                        #12
                        Originally posted by jon00 View Post
                        Take a look at the EventSetTimeTrigger command.

                        http://help.homeseer.com/help/HS3/st...settimetrigger

                        As an example, triggering the event in two minutes time could be achieved by something like this:


                        Code:
                        Sub Main (Byval parms as object)
                        
                        Dim d as Date = DateTime.Now.AddMinutes(2)
                        Dim EvRef As Integer = hs.GetEventRefByName("your event name")
                        Dim res As Boolean = hs.EventSetTimeTrigger(EvRef, d)
                        hs.SaveEventsDevices()
                        End Sub
                        jon00 thank you! This appears to be working as an acceptable workaround! Thanks all!

                        Comment


                          #13
                          I had the most interesting thing occur to me last night. I have a routine that maintains our basement temperature. I compare my setpoint to the current temperature, and based on the difference, I have my basement heat pump circulate hot water for a predetermined amount of time. I check my current temperature every 30 minutes to determine how long the heat should be applied to my basement floor. I use the following code snippet to do this:

                          hs.TriggerEvent("Turn Basement Heat On")
                          DeltaTemp = SetPointVal - CurrentTemp

                          if DeltaTemp > 1.0 then
                          hs.DelayTrigger(DurationValSeconds, "Turn Basement Heat Off")
                          elseif DeltaTemp > 0.5 then
                          hs.DelayTrigger(DurationValSeconds/2,"Turn Basement Heat Off")
                          else
                          hs.DelayTrigger( 15, "Turn Basement Heat Off")
                          end if

                          The default condition is to always circulate water for 15 seconds every 30 minutes. For the first time EVER (and I have been using this routine in both HS2 and HS3 for years), I started getting the following error when I called the delayed routine to turn off the heat.

                          Exception in DelayTrigger: Object reference not set to an instance of an object

                          It started out of the blue, the hs.DelayTrigger() failed 17 consecutive times (basically heat was on full for 8.5 hours) and out of the blue, started working again. I am doing a bit more investigation, and it appears that the same thing happened again this morning for two hours, and then started working again. Does anybody have any idea what might be causing this sporadic failure when trying to run a delayed event using the command; hs.DelayTrigger()?

                          In the meantime, I will change my code to use the method proposed by Jon00 and see if that resolves the issue that I am intermittently experiencing.

                          Comment


                            #14

                            I was having exactly the problem of others above, i.e., "Exception in DelayTrigger: Object reference not set to an instance of an object." I implemented the jon00 solution, which worked, so I wish to affirm that it does work for others who might come upon this thread. It is clearly a bug that should be fixed. I don't know how to notify the authorities of the issue though.

                            However, there was a glitch that held me up for a while, which, therefore, might be worth mentioning. It is sort of documented under hs.EventSetTimeTrigger, but I found that part of the documentation confusing. This function actually adds a date time trigger to the designated event (e.g. below: "DelayedAction Trigger Event"). I did not understand that it would be added to existing conditions with an "AND IF" clause, even if that condition was incomplete. As one would expect, when it comes time for executing the event, nothing happens. See attachment below. This is not a big deal unless you don't notice it, as I did not for several hours. The solution is simply to delete the "AND IF" and save.


                            Click image for larger version

Name:	Untitled.png
Views:	121
Size:	50.3 KB
ID:	1255606

                            Comment


                              #15
                              This is quite old, hoewever if anyone else experience this.

                              Sorted this error by renaming the event to something else and renaming it back. Then the hs.DelayTrigger worked fine again.

                              Comment

                              Working...
                              X