Announcement

Collapse
No announcement yet.

Scripting - Linux

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

    Scripting - Linux

    I copied this example from the documentation:
    Code:
    Sub GetLastValue(strRef As String)
    Dim dblValue as Double
    dblValue = hs.PluginFunction("Device History", "", "GetLastValue", {strRef})
    hs.WriteLog("Device History", "Last value for " & strRef & ": " & dblValue)
    End Sub
    Trying to run with "GetLastValue" as "Sub or Function" and "947" as "parameter".
    This just results in an error in the log:
    Jan-08 19:10:40 Error Compiling script /usr/local/HomeSeer/scripts/CreateHSTgraph.vb: http://mono-project.com/Bugs)
    Jan-08 19:10:40 Error Compiling script /usr/local/HomeSeer/scripts/CreateHSTgraph.vb: The import 'System.Core' could not be found.
    Isn't scripting against "Device History" supported on Linux?
    Running on Ubuntu with Mono 5.18 (newest).

    #2
    See if the solution from this thread helps: https://forums.homeseer.com/forum/ul...g-error-solved

    I thought I'd updated my documentation examples after that, but will review again to see if I didn't or missed one.

    Comment


      #3

      Try:
      Code:
      dblValue = hs.PluginFunction("Device History", "", "GetLastValue", New Object(){strRef})
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Originally posted by sparkman View Post
        Try:
        Code:
        dblValue = hs.PluginFunction("Device History", "", "GetLastValue", New Object(){strRef})
        That worked, thanks!

        What would be the correct syntax for the "CreateChartEx"-function? I'm getting the same error there...
        Code:
        hs.PluginFunction("Device History", "", "CreateChartEx",{"947","{'Title': 'Fukt hovedsoverom', 'Y1Label': '% RH','Y2Label': '','XLabel': 'Dato/Tid', 'ShowLegend': false, 'DurationType': 2, 'PeriodType': 1, 'Periods': 24, 'Style': 2, 'UseMarkers': false, 'Width': 460, 'Height': 310}", "", ""})

        Comment


          #5
          Originally posted by ZoRaC View Post
          What would be the correct syntax for the "CreateChartEx"-function? I'm getting the same error there...
          Code:
          hs.PluginFunction("Device History", "", "CreateChartEx",{"947","{'Title': 'Fukt hovedsoverom', 'Y1Label': '% RH','Y2Label': '','XLabel': 'Dato/Tid', 'ShowLegend': false, 'DurationType': 2, 'PeriodType': 1, 'Periods': 24, 'Style': 2, 'UseMarkers': false, 'Width': 460, 'Height': 310}", "", ""})
          I belive I figured it out:
          Code:
          hs.PluginFunction("Device History", "", "CreateChartEx",New Object(){"947","{'Title': 'Fukt hovedsoverom', 'Y1Label': '% RH','Y2Label': '','XLabel': 'Dato/Tid', 'ShowLegend': false, 'DurationType': 2, 'PeriodType': 1, 'Periods': 24, 'Style': 2, 'UseMarkers': false, 'Width': 460, 'Height': 310}", "", ""})

          Comment


            #6
            Likely this:

            Code:
             
             hs.PluginFunction("Device History", "", "CreateChartEx",New Object(){"947","{'Title': 'Fukt hovedsoverom', 'Y1Label': '% RH','Y2Label': '','XLabel': 'Dato/Tid', 'ShowLegend': false, 'DurationType': 2, 'PeriodType': 1, 'Periods': 24, 'Style': 2, 'UseMarkers': false, 'Width': 460, 'Height': 310}", "", ""})
            Typically anything passed within {} needs the New Object() in linux so you may need a second one:

            Code:
             
             hs.PluginFunction("Device History", "", "CreateChartEx",New Object(){"947","New Object(){'Title': 'Fukt hovedsoverom', 'Y1Label': '% RH','Y2Label': '','XLabel': 'Dato/Tid', 'ShowLegend': false, 'DurationType': 2, 'PeriodType': 1, 'Periods': 24, 'Style': 2, 'UseMarkers': false, 'Width': 460, 'Height': 310}", "", ""})
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              Originally posted by ZoRaC View Post

              I belive I figured it out:
              Great!

              Windows is a bit more forgiving, so they are not required in Windows, but still recommended there too, so ideally shill would update the documentation to reflect that so that it works in both Windows and linux.
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment


                #8
                I've updated the documentation to reflect this in 1.3.6. I also discovered that the thread I linked to above (where someone had already found this solution) didn't make the migration from the old forums correctly (turns out it REALLY didn't like posts that had been edited) so it was missing the actual solution part... sorry about that!

                Comment

                Working...
                X