Announcement

Collapse
No announcement yet.

Issues with calling plugin(s) - Works in Windows, fails in Linux

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

  • Issues with calling plugin(s) - Works in Windows, fails in Linux

    Im trying to list Google Calendar events to a virtual device using script found under the BLGData thread.
    I've tried the same script against two different Google Calendar plugins, both script work in Windows, but both fails on my main Linux install running Mono 5.18.0.240.
    A lot of people use this script successfully in Windows.

    Both Blade and the other plugins author believe this is a mono/linux issue.

    Any suggestions? Workarounds? Really appreciate any help.

    Searched everywhere for a solution, and tried a bunch of different stuff, nothing solves the errors.
    I've scratched most of the lines from both scripts, and added one by one line, to see where it fails.
    The script runs without error without the,
    allEvents = hs.PluginFunction line, so it seems the problem is with the plugin(s) call.


    BLGData Plugin:

    Code:
    Sub Main(ByVal Parms As Object)
        Dim ParmArray() as String
        ParmArray = Parms.tostring.split(",")
        Dim tDevice as string = ParmArray(0)
        Dim tCalendar as string = ParmArray(1)
        Dim tDays as integer = cint(ParmArray(2))
        Dim allEvents As Object()
            Dim myemail as string="thisismyusers@gmail.com"
            Dim msg as string = ""
    
            allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){myemail,tCalendar, tDays})
            msg="<table>"
        For Each ev As Object In allEvents
               msg = msg & "<tr><td> " & ev.StartTime & " - " & ev.Name & "." & "</td></tr>"
        Next
            msg=msg & "</table>"
            if msg="" then msg="No Events Scheduled"
            hs.SetDeviceString(tDevice, msg.Trim, true)
    End Sub
    Return error:
    Feb-26 21:35:13 Error Compiling script /opt/HomeSeer/scripts/BLGData_Calendar.vb: Value of type 'Object' cannot be converted to 'System.Object[]'.
    Feb-26 21:35:13 Error Compiling script /opt/HomeSeer/scripts/BLGData_Calendar.vb: The import 'System.Core' could not be found.

    GCalseer Plugin:

    Code:
    Sub Main(ByVal Parms As Object) 
    Dim msg as string = "" 
    Try    
        Dim ParmArray() as String 
        ParmArray = Parms.tostring.split(",") 
        Dim tDevice as string = ParmArray(0) 
        Dim tCalendar as string = ParmArray(1)
        Dim tDays as integer = cint(ParmArray(2))
        Dim allEvents As Object()
    
    
        allEvents = hs.PluginFunction("GCalSeer", "", "GetItemsForCalendar", new Object(){tCalendar ,tDays }) 
    
        For Each ev As Object In allEvents 
               msg = msg & "<br>" & ev & "</br>"   
        Next 
    
        hs.WriteLog("test","events found: " & msg)    
    
        if msg="" then msg="No Events Scheduled"        
        hs.SetDeviceString(tDevice , msg, true) 
    
    Catch ex As Exception        
        hs.WriteLog("", "Exception in script: " & ex.Message)    
    End Try
    hs.WriteLog("test","---=== DONE ===---")
    
    End Sub
    ​​​​​​​
    Feb-26 21:41:38 Error Compiling script /opt/HomeSeer/scripts/GCalScript.vb: Value of type 'Object' cannot be converted to 'System.Object[]'.
    Feb-26 21:41:38 Error Compiling script /opt/HomeSeer/scripts/GCalScript.vb: The import 'System.Core' could not be found.

  • #2
    Does it work if you change "Dim allEvents As Object()" to "Dim allEvents As Object"?
    HS 3.0.0.548: 1990 Devices 1172 Events
    Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

    Comment


    • #3
      Originally posted by sparkman View Post
      Does it work if you change "Dim allEvents As Object()" to "Dim allEvents As Object"?
      WOW! Yes that works perfect!

      Thank you so much, spent so many hours back and forth with this!

      Comment


      • #4
        Glad that worked for you!
        HS 3.0.0.548: 1990 Devices 1172 Events
        Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

        Comment

        Working...
        X