Announcement

Collapse
No announcement yet.

Linux - Errors running simple VB scripts - Imports 'System.Core'

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

  • Linux - Errors running simple VB scripts - Imports 'System.Core'

    I have some simple VB scripts that I distribute with my plugin for calling public functions to obtain values.

    The small script below works on windows.
    Code:
    Sub Main(Parm As Object)
    	
        Dim thermostatName As String = "pump"
    
        Dim pluginName As String = "Insteon Thermostat"
        Dim Instance As String = ""
        Dim plugin As Object = New HomeSeerAPI.PluginAccess(hs, pluginName, Instance)
    
        '
        ' TSTAT Query Scripting API
        '
        Dim mode As String = plugin.PluginFunction("GetMode", {thermostatName})
        hs.WriteLog(pluginName, "GetMode(" & thermostatName & ") = " & mode)
    
    End Sub
    When running this under Linux most is ok except for this line where the plugin is actually called.

    Code:
    Dim mode As String = plugin.PluginFunction("GetMode", {thermostatName})
    The error I receive is:

    07:26:09:3172:[Error]->Compiling script /opt/HomeSeer/scripts/tstat.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
    Has anyone seen this type of issue? I have tried to call other public functions on my plugin and receive a similar error no matter which I try. Any help or pointers to Linux / mono script compatibility tips would be greatly appreciated.

    Thanks
    Nathan
    HS 3.0.0.435 (PRO)
    Hardware: Napco GEM-P9600 | VenstarT1800 w/Insteon 2441V adapter | Insteon PLM
    Plugins HS3: Napco Gemini (mine) | Insteon Thermostat (mine) | Insteon Plug-in (mnsandler) | HSTouch Server (HST)
    Platform: Windows 10 Pro 64bit, core2 duo 2.0Ghz, 4GB memory
    http://www.kazteel.com/

  • #2
    Hi Nathan,

    Looks like you are using the HS2 syntax. See here for the HS3 syntax: http://www.homeseer.com/support/home...infunction.htm

    Cheers
    Al
    HS 3.0.0.548: 1990 Devices 1172 Events
    Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

    Comment


    • #3
      Thanks for the suggestion Sparkman. I did try it and arrived at the same result. That's good actually, knowing both styles of access work.

      Further experimentation led me to call PluginFunction with (Nothing, Nothing) which produced different behavior. This time it confirmed my plugin was actually being called and that it couldn't find a null method name to call. A bit more experimentation and I found a solution. The array parameter being passed in works as-is on windows but mono doesn't like it. I was able to fix it by changing:

      Code:
      Dim mode As String = plugin.PluginFunction("GetMode", {thermostatName})
      to

      Code:
      Dim mode As String = plugin.PluginFunction("GetMode", New Object() {thermostatName})
      That simple little fix and now the VB script is working on Linux.

      The method declaration for my HSPI.vb function PluginFunction() is below. This was originally from HS3 plugin examples long ago. I can only assume other plugins may have a different method signature or don't pass in parameters and that's how they didn't encounter this issue? That HS3 example Sparkman pointed me to didn't use an array in the arguments list. Looks like it just called a method with no parameters to get a response.

      Code:
      Public Function PluginFunction(ByVal proc As String, ByVal parms() As Object) As Object Implements IPlugInAPI.PluginFunction
      HS 3.0.0.435 (PRO)
      Hardware: Napco GEM-P9600 | VenstarT1800 w/Insteon 2441V adapter | Insteon PLM
      Plugins HS3: Napco Gemini (mine) | Insteon Thermostat (mine) | Insteon Plug-in (mnsandler) | HSTouch Server (HST)
      Platform: Windows 10 Pro 64bit, core2 duo 2.0Ghz, 4GB memory
      http://www.kazteel.com/

      Comment

      Working...
      X