Announcement

Collapse
No announcement yet.

activate device script button from a txt script

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

    activate device script button from a txt script

    I have made a device with device script buttons.
    When I push the buttons, the script that has to be run is running.
    But if I change the state of the device by an other script (.txt) with

    hs.SetDeviceValueByRef devref, 100, True
    hs.setdevicestring devref, "On", True

    The device goes on, but the script of the device button does not run.
    What am I doing wrong?
    Peter

    http://ohh.pcgsm.nl

    #2
    Hi Peter,

    You need to use CAPI commands. Search the board for "capigetsinglecontrol" for some examples.

    Cheers
    Al

    PS Here's on recent thread. See post #10 and later. http://board.homeseer.com/showthread.php?t=163760
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      For help with constructing CAPI script statements, take a look at tenScriptAid.

      tenholde
      tenholde

      Comment


        #4
        Originally posted by tenholde View Post
        For help with constructing CAPI script statements, take a look at tenScriptAid.
        Wow, that is awesome!
        If that can't get people to understand CAPI, then nothing will!
        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
        Running on Windows 10 (64) virtualized
        on ESXi (Fujitsu Primergy TX150 S8).
        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

        Comment


          #5
          hs.CAPIControlHandler(hs.CAPIGetSingleControl(cv,true ,"On",false,true))
          is working perfect!
          Peter

          http://ohh.pcgsm.nl

          Comment


            #6
            Originally posted by tenholde View Post
            For help with constructing CAPI script statements, take a look at tenScriptAid.

            tenholde
            When I want to connect to HS, I get this error:
            Error retrieving Devices from HS3: Object reference not set to an instance of an object.
            Peter

            http://ohh.pcgsm.nl

            Comment


              #7
              Could you select the debug box before connecting?

              The HS log will show you where the tenScriptAid log is written.

              Please post log contents here.

              Thanks,

              tenholde
              tenholde

              Comment


                #8
                Originally posted by peterpc View Post
                hs.CAPIControlHandler(hs.CAPIGetSingleControl(cv,true ,"On",false,true))
                is working perfect!
                Is there also a command to read if a module is on or off?
                Like replacement for hs.IsOn?
                Peter

                http://ohh.pcgsm.nl

                Comment


                  #9
                  Look at the Capi Status value, it should show current status from the CapiControls available for that device:

                  Code:
                  if hs.CAPIGetStatus(924).Status.ToUpper.Contains("ON") then    xxxxxxxxxxx
                  tenholde

                  Comment


                    #10
                    Originally posted by peterpc View Post
                    Is there also a command to read if a module is on or off?
                    Like replacement for hs.IsOn?
                    Since you are not controlling a device, you can also get the device's value using hs.devicevalue. However, you'd have to know what the specific values are for on and off as this is not consistent across all types of devices/plugins. Off is typically 0, but On could be 1, 99, 100, 255.

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

                    Comment


                      #11
                      Originally posted by tenholde View Post
                      Could you select the debug box before connecting?

                      The HS log will show you where the tenScriptAid log is written.

                      Please post log contents here.

                      Thanks,

                      tenholde
                      This is the log:
                      12/5/2015 23:01:41 | tenScriptAid started
                      12/5/2015 23:01:41 | Clipboard set to:
                      12/5/2015 23:01:41 | tenScriptAid Startup Complete
                      12/5/2015 23:01:47 | Attempting to connect to: 192.168.1.20
                      12/5/2015 23:01:47 | HS3 connection successful
                      12/5/2015 23:01:47 | HS version: 3.0.0.208
                      12/5/2015 23:01:47 | Retrieving HS3 Devices
                      12/5/2015 23:02:47 | Exception retrieving Devices: Object reference not set to an instance of an object.

                      Can it be that the device Reference ID of the latest device is too high?
                      Latest device has Reference ID 2451.
                      I have done a lot of testing creating devices and delete them.
                      I now have 687 devices
                      Peter

                      http://ohh.pcgsm.nl

                      Comment


                        #12
                        That helps. Did the log not show any devices that it found?
                        tenholde

                        Comment


                          #13
                          Originally posted by tenholde View Post
                          That helps. Did the log not show any devices that it found?
                          No, that is all in the log file.
                          Peter

                          http://ohh.pcgsm.nl

                          Comment


                            #14
                            Originally posted by peterpc View Post

                            Can it be that the device Reference ID of the latest device is too high?
                            Latest device has Reference ID 2451.
                            I have done a lot of testing creating devices and delete them.
                            I now have 687 devices
                            Not likely as my latest reference is quite a bit higher than that and so is my latest device count and it's working fine for me.

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

                            Comment


                              #15
                              The error you are getting is before it successfully retrieves even the first HS3 device while enumerating.

                              Please try version 1.14, adds more debug info during Device Retrieval.

                              Please post debug results.

                              Thanks for your patience,

                              tenholde
                              tenholde

                              Comment

                              Working...
                              X