Announcement

Collapse
No announcement yet.

CAPI for scripts

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

    #16
    Originally posted by Heychristian View Post


    I was able to use the above 3-line solution to dim HS devices created by DonMor's Lutron RadioRA 2 plugin that control Lutron RadioRA 2 dimmers. i would like a 1-line solution.

    the below have not worked to dim device 308 to 50%
    a. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"Dim (50)%",False,False))
    b. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"Dim( 50)%",False,False))
    c. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"Dim 50%",False,False))
    d. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"Dim 50",False,False))
    f. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"50%" ,False,False))
    g. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"(50) %",False,False))
    h. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,True,"50", False,False))

    as others previously mentioned, using "On" and "Off" for the 3rd parameter does work.

    thanks for any help
    The typical syntax for Z-Wave and other devices is "Dim 50%" but it is defined in the Status Graphics tab of the device. Look for the range value, that has a Start and End. In the next section over there are Prefix, Suffix and Decimal Places values. For the typical on/off device, Prefix=Dim, Suffix=% and Dec. Places=0 which results in "Dim 50%". As an alternative, Prefix could be defined as "Level", in which case the resulting value would be "Level 50%". I'm tweaking the script I posted above many years ago, that dumps out all the controls for a device. I'll post it when I get it working.

    Bill

    Comment


      #17
      Thanks Bill--changing Prefix from blank to the value of "Dim "--including the required trailing space--solved the problem. I'm still surprised that using value of "50%" did not work when Prefix was blank, but regardless, now the 1-line solution works.


      Click image for larger version

Name:	200521 Prefix solves CAPI control.png
Views:	310
Size:	154.8 KB
ID:	1387363

      Comment


        #18
        Any idea why using the parameter "Dim 10%" would work with DeviceID but fail with Device Code?

        ie A and B work. C fails. I've tried a few devices.

        in my case Device ID 308 has Device Code "D32"

        A. hs.CAPIControlHandler(hs.CAPIGetSingleControl(308,false,"Dim 50%",true,true))

        B. hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.DeviceExist sCode("D32"),True,"On",False,False))

        C. hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.DeviceExist sCode("D32"),True,"Dim 50%",False,False))

        ie the combination of using the Device Code and Dim 50% fails.

        thanks

        Comment


          #19
          The code is a subset of a device address and normally includes a dash when it is appended to the end of the address. Try using hs.DeviceExistsAddressFull("D32") instead.
          Jon

          Comment

          Working...
          X