Announcement

Collapse
No announcement yet.

Can't change thermostat SetPoint from scripting.

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

    #16
    The original versions of HS supported VBScript and then VB.NET so most scripts have been developed with that. Consequently few people use C# so there's a good chance you'll find some bugs as you may be the the first one trying something . I recall seeing some posts a few months ago where someone had figured out how to pass the parameters to a C# script. I'll see if I can find that threat. I don't think I was able to use quotation marks to pass parameters to vb.net scripts either, but it definitely does not cause HS to crash if you do.

    Cheers
    Al
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #17
      Yeah I found an earlier thread where main was specified as:

      Main(object parm)

      And the entire string specified was passed as a single param and the poster was suggesting to a Split() to separate the parameters, which would have been fine. It looks like it's been updated to now take a:

      Main(object[] parm)

      which is bit more traditional to how a command line C# app works. I was trying to pull indexes out of this array but was getting null exceptions even though I was passing plenty of arguments in, then the Zee bombed.

      Something was weird though, maybe it didn't like my uses of quotation marks.

      As an aside, how in the heck is it compiling C# on a Linux box? Are they using .Net Core or something entirely home grown? I was blown away when I saw a LINQ query usage in a script, but wasn't sure if that only worked on a Windows based HS box or also worked with the Linux variant.

      Comment


        #18
        It's all using mono on linux AFAIK.
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #19
          Oh there's just using Mono. Should have immediately realized that.

          Comment


            #20
            Finally got the wife to reboot the HS.

            Looks like the entire string you put into the command line field of the event is simply placed in array position 0. So this code gives your everything, spaces and all:

            Code:
            public Object Main(Object[] parm) 
            {
                 string Param1 = parm[0] as string;
            
                 hs.WriteLog("Param1", Param1);
            
                 return null;
            }

            Comment


              #21
              Yes, that's how it works for vb too. Pick your own separator and then put it into your own array, splitting the string on your separator. Don't use a " . I typically use a | or just a ,

              Cheers
              Al
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment

              Working...
              X