Announcement

Collapse
No announcement yet.

tenScripting3 disconnect error

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

    tenScripting3 disconnect error

    Anyone out there using tenScripting3? I set up and successfully used it to run the demo scripts that come with it. Now I am trying to write my own scripts, and on the first one I've gotten a system error. When I try to run the following script

    Code:
    Imports HomeSeerAPI
    Public Class irrigationOff
        Public Sub Main()
            Dim DevRef As Integer
            Dim moistureLevel As Integer
            Dim threshold As Integer
            Dim surplus As Integer
            Dim Evref As Integer
            Dim Ok As Boolean
            Dim CC As CAPIControl
            Dim DeviceName As String = "Test Valve"
            threshold = 22 ' Plantlink determined threshold for this plant
            DevRef = hs.GetDeviceRefByName(DeviceName)
            moistureLevel = hs.DeviceValue(DevRef)
            'surplus = moistureLevel - threshold
            surplus = 2
            hs.WriteLog("Irrig Info", "Garden sensor reading = " & moistureLevel & " surplus = " & surplus)
            If surplus < 2 Then
                Dim logName As String = "Irrig Off Event"   'set log type for HS log
                Dim Debug As Boolean = True             'set to True if the script give you errors and it will provide additional info in the HS3 log to help troubleshoot
                Dim StopDateTime As Date = Now.AddMinutes(30)
                Evref = hs.NewEventEx("Vale Off " & CStr(DeviceName), "Irrigation", "")
                ' set the trigger time of the event 
                Ok = hs.EventSetTimeTrigger(Evref, CStr(StopDateTime))
                ' set the event to delete itself after it runs
                hs.DeleteAfterTrigger_Set(Evref)
                ' add a device action to the event
                CC = hs.CAPIGetSingleControlByUse(DevRef, ePairControlUse._Off)
                hs.AddDeviceActionToEvent(Evref, CC)
                hs.EnableEventByRef(Evref)
            End If
        End Sub
    End Class
    I get this in the tenScripting log
    03 Connected, waiting to be initialized...
    04 Homeseer connection successful
    05 tenScripting initialization complete
    06 Running irrigationOff.main
    07 >>Exception
    08 >>>Method tenScripting3 'irrigationOff.Main' not found
    09 irrigationOff.Main Finished

    Then in the VisualStudio output window it shows
    'tenScripting3.vshost.exe' (CLR v4.0.30319: tenScripting3.vshost.exe): Loaded 'Microsoft.GeneratedCode'.
    host connect result: False
    A first chance exception of type 'System.MissingMethodException' occurred in mscorlib.dll
    Connection to HS3 lost, tenScripting is exiting
    The thread 0xacc has exited with code 259 (0x103).
    The thread 0xb88 has exited with code 259 (0x103).
    The thread 0x1b90 has exited with code 259 (0x103).
    The thread 0x864 has exited with code 259 (0x103).
    tenScripting has been disconnected from HS3
    The program '[6688] tenScripting3.vshost.exe' has exited with code 0 (0x0).
    So it looks like it connects to HS3 ok, but then loses the connection in the course of running the script. Anyone know how to troubleshoot this?

    #2
    I'd start by changing the Sub line to,
    Public Sub Main(ByVal Parms As Object)
    and see if that fixes it.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

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

    Comment


      #3
      That did it, thanks. Strange that you would have to declare arguments if there are none, but there you have it.

      Comment

      Working...
      X