Announcement

Collapse
No announcement yet.

Turn Device "On" with Script

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

    Turn Device "On" with Script

    I'm trying to figure out the best way to turn a device "on" using a script. I had thought that setting the DeviceValue to 100 would be the best way until I read the following in the scripting documentation:

    "for example, an X-10 device may have an "On" value of 100, but a Z-Wave device is "On" at values 99 (dimmable device) or 255 (non-dimmable)."

    I also see that the "ExecX10" type functions are no longer supported. This is what I had used in HS2 to turn devices on. I'd like my script to be able to turn on both X10 and Z-Wave devices, preferrably without needing to know ahead of time which type of device it is...

    Have I missed a simple function to do this? Any help or suggestions would be appreciated.

    Thanks,

    --Doug

    #2
    I found this thread very useful. It explains how to interrogate and control devices using the CAPI interface.

    http://board.homeseer.com/showthread.php?t=161009

    Comment


      #3
      Thanks for the replies.

      Chrisgo - I had read through the CAPI stuff in the scripting manual and was hoping to avoid it. Looks like that won't be possible. Thanks for pointing me to that thread. I will have to take the time to incorporate that CAPI logic into my scripts.

      It looks like with increased functionality comes increased complexity.

      Hopefully everyone creating controllable devices will use "On", "Off", and "Dim XX%" for the CAPIControl.Label when appropriate...


      --Doug

      Comment


        #4
        Originally posted by Fuddy
        Are you sure? I've been all over that doc and can't find that function!

        Regards
        Michaek
        Are you running HS2 or HS3?
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          HS3

          Regards
          Michael
          Regards,
          Michael

          HS3, W10 Home, HSTouch, W800, Z-Stick+

          Comment


            #6
            CAPI is the only way to do this with HS3.
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            Comment


              #7
              Blinking a light

              Thanks to the pointer above to the sample CAPI scripts by bdickhaus, I was able to muddle through and "blink" an outside light which is what I did in HS2 as an indicator when I armed or disarmed the security system from the car.

              Regards
              Michael
              Regards,
              Michael

              HS3, W10 Home, HSTouch, W800, Z-Stick+

              Comment


                #8
                Check out some of the example vb scripts that I recently posted.

                http://board.homeseer.com/showthread...04#post1099404

                Comment


                  #9
                  I'm just converting from hs2 to hs3 and working on some scripts. I have a script that turns on a virtual indicator (so I know its running) and the code looked like this: hs.ExecX10("A2","On",0). Apparently that no longer works. What do I put in its place?
                  HS4Pro on Windows 10
                  One install with 2 Ethernet Z-nets
                  2nd install with 1 Ethernet Z-net
                  300 devices, 250 events, 8 scripts
                  6 CT-100 tstats
                  Serial IT-100 interface to DSC Panel with 8 wired zones
                  18 Fortrezz water sensors & two valve controls

                  Comment


                    #10
                    Something like this will work:
                    Code:
                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,true ,"on",false,true))
                    Replace theDevice with the reference ID of your device. It's shown on the Advanced tab of the device.

                    Cheers
                    Al

                    Edit: since it's a virtual device, you may be able to use SetDeviceValue
                    Last edited by sparkman; November 27, 2015, 08:11 PM.
                    HS 4.2.8.0: 2134 Devices 1252 Events
                    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                    Comment


                      #11
                      Thank you sparkman, it worked. Could I trouble you for an explanation of the parameters so that I know how to use it for other things?
                      HS4Pro on Windows 10
                      One install with 2 Ethernet Z-nets
                      2nd install with 1 Ethernet Z-net
                      300 devices, 250 events, 8 scripts
                      6 CT-100 tstats
                      Serial IT-100 interface to DSC Panel with 8 wired zones
                      18 Fortrezz water sensors & two valve controls

                      Comment


                        #12
                        Originally posted by Sheriff View Post
                        Thank you sparkman, it worked. Could I trouble you for an explanation of the parameters so that I know how to use it for other things?
                        Here's the help page link for each major function:
                        http://homeseer.com/support/homeseer...dler&criteria=


                        http://homeseer.com/support/homeseer...trol&criteria=
                        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                        Comment


                          #13
                          Originally posted by Sheriff View Post
                          Thank you sparkman, it worked. Could I trouble you for an explanation of the parameters so that I know how to use it for other things?
                          Since the help file is a bit cryptic for CAPIGetSingleControl command and no examples are shown, here's a bit of an explanation based on how I understand it. The command will return the proper CAPI command to be executed by the CAPIControlHandler command. The parameters are to find the matching value for the device.

                          Code:
                          Public Function CAPIGetSingleControl(ByVal dvRef As Integer, _
                                                               ByVal SingleRangeEntry As Boolean, _
                                                               ByVal Label As String, _
                                                               ByVal ExactCase As Boolean, _
                                                               ByVal Contains As Boolean) As CAPIControl
                          The parameters are:

                          1. dvRef: The device's reference id. Pass it as an integer.
                          2. SingleRangeEntry: If the value you are looking for is not in a range, then set this to True. If it is in a range, such as a dim value, set it to False.
                          3. Label: This is a string that contains the value you are looking for. Examples are "on", "off", "50", etc.
                          4. ExactCase: Set this to True to only find the CAPI command that matches the exact case of the label provided. So if the value is "On" but you have the label parameter as "on", and this is set to True, then it won't return the command. I usually leave this as False.
                          5. Contains: Set this to True if the label provided only has the partial value and set it to False if it matches exactly. Be careful with this one, especially with ranges. As an example if the label parameter you provide is "10", and Contains is set to True, then it could return the command for "100" rather than '"10". Therefore for ranges, it's best to provide the complete label parameter and set this to False.

                          Hope that helps.

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

                          Comment


                            #14
                            Thank you so much Al. This is very helpful.
                            HS4Pro on Windows 10
                            One install with 2 Ethernet Z-nets
                            2nd install with 1 Ethernet Z-net
                            300 devices, 250 events, 8 scripts
                            6 CT-100 tstats
                            Serial IT-100 interface to DSC Panel with 8 wired zones
                            18 Fortrezz water sensors & two valve controls

                            Comment


                              #15
                              For help determining how to code CAPI functions (or any device related script functions), I've developed a simple utility that displays a lot of info about the selected HS3 Device, including the available CAPI commands, and generates the script code to access these functions, placing the code on the clipboard so you can paste it into your code.

                              tenScriptAid


                              tenholde
                              tenholde

                              Comment

                              Working...
                              X