Announcement

Collapse
No announcement yet.

Need Assistance with Script

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

    Need Assistance with Script

    I need some assistance with this script. In addition to this script I would also like to add two zWave devices. I looked in the help file but saw no examples of how to turn on/off a zWave device in a script.

    I am trying to turn on some Christmas lights. I have a trigger at 10 min after sunset to trigger this script. At that time I want to ensure the number incount equals 2. If it equals 2 then turn on the outside Christmas Lights plus add zWave device codes Q6 & Q2

    Sub main()
    If hs.devicevalue("X8") = "2" Then
    hs.execx10 "B11","on",0
    hs.execx10 "B11","on",0
    hs.WaitSecs 5
    hs.execx10 "B13","on",0
    End If
    End Sub


    Cheers - gary

    #2
    I'm not sure how to do zwave in a script, but is there a particular reason you don't have this as an event? An event would execute even a bit quicker than a script.

    Comment


      #3
      Originally posted by jgary View Post
      I need some assistance with this script. In addition to this script I would also like to add two zWave devices. I looked in the help file but saw no examples of how to turn on/off a zWave device in a script.


      Cheers - gary
      You turn on a zwave device the same way you turn on an x10 device. I do so in most of my scripts. As an example

      hs.execX10 "Q6", "on"

      I know the execX10 is confusing because of the X10 but you should really interpret the execX10 as a "execHSDevice" instead.

      Let me know if I misunderstood your question.
      James

      Running HS 3 on Win10 .

      Comment


        #4
        Thanks I did not realize I could use the same for X10 in a script for zWave.

        Now if I could only get the if statement to work

        If hs.devicevalue("X8") = "2" Then


        X8 is the number in count at the house. If the value is 2 then I want to turn on the christmas lights

        I would do this in a HS Event If I knew how. I could not figure out how to do the device value or number incount which is the value of a virtual device.

        cheers

        Comment


          #5
          VBscript expects strings using the quotes and integers to be just the number so your code of
          If hs.devicevalue("X8") = "2"

          should read
          If hs.devicevalue("X8") = 2
          James

          Running HS 3 on Win10 .

          Comment


            #6
            Originally posted by jgary View Post
            Now if I could only get the if statement to work

            If hs.devicevalue("X8") = "2" Then
            The device value is an integer. I think all you need to do is remove the quotes around the 2.
            Mike____________________________________________________________ __________________
            HS3 Pro Edition 3.0.0.548, NUC i3

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

            Comment


              #7
              Thanks everyone - It now Works!!! ho ho ho

              Comment


                #8
                Originally posted by jasv View Post
                I know the execX10 is confusing because of the X10 but you should really interpret the execX10 as a "execHSDevice" instead.
                Another confusing scripting command is hs.PlayWavFile. You would have thought this would only play wave files but it plays other media types such as MP3 etc.

                Perhaps that one should be called hs.PlayMediaFile
                Jon

                Comment

                Working...
                X