Announcement

Collapse
No announcement yet.

Help with intermittent VB.NET script error

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

    Help with intermittent VB.NET script error

    I hope someone can help with this... Feel free to rip the code apart. I am new to to VB.NET :-)

    I have some code that runs fine and does as intended and then after an unspecified amount of time (this example took 50 mins based on log time) or tries it goes throwing the error below. Here is the Code, then the Log when it is fine and the Log when it tanks. Rebooting HS3Pro server fixes it temporarily.

    And it wasn't doing this all along, this just started a few days ago. Granted some code changes were made but I am stumped.

    Code:
    Public Sub Main(pParms As Object)
    
            Dim SecStatus As Boolean
            Dim P0 As String
            Dim P1 As String
            'For Y = 0 To UBound(pParms)
            '    hs.WriteLog("DebugCode", pParms(Y))
            'Next
            SecStatus = False
            P0 = pParms(0).ToString()
            P1 = pParms(1).ToString()
    
            If P1.Length <= 0 Then
                hs.PlayWavFile("C:\Program Files (x86)\HomeSeer HS3\Wave\LCARSDenied.wav", "Automation-SVR:" & P0, False)
                hs.WriteLog("Debug", "No Code entered")
                Exit Sub
            End If
    
            If P1 = "2264" Then
    
    
                SecStatus = True
    
                hs.TriggerEvent("LCARSUnlock-" & P0)   'Three Events cause 3 possible devices could trigger it. Only want the event to fire for the device that triggered it. 
    
    
    
    
    
            Else hs.PlayWavFile("C:\Program Files (x86)\HomeSeer HS3\Wave\LCARSDenied.wav", "Automation-SVR:" & P0, False)
                hs.WriteLog("Debug", "Code is wrong :" & P1)
            End If
            
        End Sub



    Here is the log when it is AOK

    Jul-18 7:40:09 PM Event Event Trigger "System LCARSUnlock"
    Jul-18 7:39:19 PM Event Event Trigger "System LCARSUnlock"
    Jul-18 7:38:59 PM Event Event Trigger "System HSTouch-WaterWorld-ClientSetName"
    Jul-18 7:38:59 PM HSTouch Server This client was already connected, removing old connection.
    Jul-18 7:38:59 PM Speaker Speaker host added, Name: Automation-SVR Instance: WaterWorld IP address: 10.0.0.37
    Jul-18 7:38:59 PM HSTouch Server Connecting speaker client to HomeSeer IP 10.0.0.17
    Jul-18 7:38:59 PM HSTouch Server Client WaterWorld (10.0.0.37/3270) named WaterWorld has CONNECTED.
    Jul-18 7:38:58 PM HSTouch Server Opening connection from:10.0.0.37/3270
    Jul-18 7:38:56 PM Event Event Trigger "System HSTouch-LCARS_MAIN-ClientSetName"
    Jul-18 7:38:56 PM Speaker Speaker host added, Name: Automation-SVR Instance: LCARS_MAIN IP address: 10.0.0.31
    Jul-18 7:38:56 PM HSTouch Server Connecting speaker client to HomeSeer IP 10.0.0.17
    Jul-18 7:38:56 PM HSTouch Server Client LCARS_MAIN (10.0.0.31/50646) named LCARS_MAIN has CONNECTED.
    Jul-18 7:38:55 PM HSTouch Server Opening connection from:10.0.0.31/50646
    Jul-18 7:38:46 PM HSTouch Server Client WaterWorld named WaterWorld has DISCONNECTED.
    Jul-18 7:38:46 PM ASR Speaker Client speech recognition stopped
    Jul-18 7:38:46 PM Speaker Speaker host disconnected, Name: AUTOMATION-SVR IP address: 10.0.0.37
    Jul-18 7:38:46 PM HSTouch Server Client WaterWorld:WaterWorld (10.0.0.37/3192) has raised LineDisconnected or was forced closed.
    Jul-18 7:38:45 PM EnvisaLink DEBUG CommandAcknowledge 000
    Jul-18 7:38:45 PM EnvisaLink DEBUG Request: Poll
    Jul-18 7:38:39 PM HSTouch Server Client LCARS_MAIN named LCARS_MAIN has DISCONNECTED.
    Jul-18 7:38:39 PM ASR Speaker Client speech recognition stopped
    Jul-18 7:38:39 PM Speaker Speaker host disconnected, Name: AUTOMATION-SVR IP address: 10.0.0.31
    Jul-18 7:38:39 PM HSTouch Server Client LCARS_MAIN:LCARS_MAIN (10.0.0.31/50644) has raised LineDisconnected or was forced closed.
    Jul-18 7:38:24 PM Event Event Trigger "System HSTouch-LCARS_MAIN-ClientSetName"
    Jul-18 7:38:24 PM Speaker Speaker host added, Name: Automation-SVR Instance: LCARS_MAIN IP address: 10.0.0.31



    Here it is when it goes south.


    Jul-18 8:29:59 PM Event Event Trigger "System HSTouch-WaterWorld-ClientSetName"
    Jul-18 8:29:59 PM Event Event Trigger "System HSTouch-WaterWorld-ClientSetName"
    Jul-18 8:29:58 PM Error Calling HSEvent in plugin tenScripting, Instance T081408:Object reference not set to an instance of an object.
    Jul-18 8:29:34 PM Error 3 Running script LavallieHA.vb :Exception has been thrown by the target of an invocation.->Does entry point Main exist in script? at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Obj ect obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Scheduler.clsRunVBNetScript.ExecuteScript()

    Jul-18 8:28:45 PM EnvisaLink DEBUG CommandAcknowledge 000
    Jul-18 8:28:45 PM EnvisaLink DEBUG Request: Poll
    Jul-18 8:28:27 PM Event Event Trigger "System LCARSUnlock-LCARS_MAIN"
    Jul-18 8:28:27 PM Event Event System LCARSUnlock-LCARS_MAIN triggered by the event page 'Run' button.
    Jul-18 8:28:00 PM Event Event Trigger "System LCARSUnlock-LCARS_MAIN"
    Jul-18 8:28:00 PM Event Event System LCARSUnlock-LCARS_MAIN triggered by the event page 'Run' button.
    Jul-18 8:27:46 PM Event Event Trigger "System LCARSUnlock-LCARS_MAIN"
    Jul-18 8:27:46 PM Event Event System LCARSUnlock-LCARS_MAIN triggered by the event page 'Run' button.
    Jul-18 8:26:45 PM EnvisaLink DEBUG CommandAcknowledge 000
    Jul-18 8:26:45 PM EnvisaLink DEBUG Request: Poll
    Jul-18 8:26:39 PM Event Event Trigger "System LCARSUnlock-WaterWorld"

    System as it is now - Will eventually get it in my Signature.....
    HomeSeer Version: HS3 Pro Edition 3.0.0.435 (Windows)
    HomeSeer: Is Registered
    Operating System: Microsoft Windows 7 Professional - Work Station

    HSTouch clients are 3.0.0.55 on Win10 Pro Tablets and one Win7 Pro x64 PC


    Thanks
    -Nac
    Last edited by Nacman; July 18, 2018, 07:43 PM. Reason: remove SecStatus twice due to CutnPaste error

    #2
    It looks like a call to tenScripting is causing the error. It might be useful to get Ed's input on this.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Originally posted by Uncle Michael View Post
      It looks like a call to tenScripting is causing the error. It might be useful to get Ed's input on this.
      Thanks, I pinged him.

      Comment


        #4
        Are you running the script under tenScripting when the posted log entries were created?

        The HsEvent error that references tenScripting usually occurs some time after you have run tenScripting, especially if you have run it several times.

        There has been a bug in HS3 since its release: it does not apparently clean up references to plugins that have registered for HsEvents and have disconnected and terminated properly. Some time after the plugin (tenScripting in this case) has disconnected and terminated, HS3 tries to call its HsEvents routine that no longer exists. There has been an open and acknowledged bugzilla open on this since the early days of HS3, but I have not been able to get HS3 to give any priority to resolving this.

        The latest release of tenScripting now has the option to turn off HS Event and Log notifications, to circumvent this HS3 bug if it is effecting you.

        I do not think that tenScripting is the cause of your error, but the HS3 error referencing tenScripting is a coincidence. The easy way to determine this is to install most recent version of tenScripting. Run tenScripting. Turn off tenScripting registration for HS3 events. Reboot.

        The HS3 error referencing the tenScripting HsEvent routine shoud disappear.

        In the mean time, I will look at you code and see if I can see anything.

        tenholde
        tenholde

        Comment


          #5
          How is this script being called? Is it from an HS3 Event, or via HsTouch in some way? Or, from tenScripting debugging session?


          If this script is being run from an Hs3 Event, then the references to the passed parameters is wrong. If HsTouch, could be correct.

          tenholde
          tenholde

          Comment


            #6
            Originally posted by tenholde View Post
            How is this script being called? Is it from an HS3 Event, or via HsTouch in some way? Or, from tenScripting debugging session?


            If this script is being run from an Hs3 Event, then the references to the passed parameters is wrong. If HsTouch, could be correct.

            tenholde
            An hstouch button push passing two parameters. The unlock code as entered and the device name that is sending the code to be validated.

            Thanks for the info. I am going to investigate further. I agree with you that I do not believe it is tenscripting. I rebooted the server running the HS3 software and I never launched tenscripting and I got the error again but it did not have a reference to your script. I will post that error later today. I believe it to be one in the same error after The tenscripting reference in the one posted here.

            It is still strange that it works and works and then goes toes up. Most times, and I discovered this after my initial post, Restarting HS3, reconnect clients is the only way to get it back working....However on a few sessions, after errors it recovers and processes again just fine....but that is rare.

            -Nacman

            Comment

            Working...
            X