Announcement

Collapse
No announcement yet.

Basic Question re: Capi Control of Devices

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

  • Basic Question re: Capi Control of Devices

    Finally making the conversion from HS2 to HS3.
    A lot of work ahead but right now I could use a bit of help using CAPI for control o some appliance and light dimmer Z-Wave devices
    On/Off doesn't seem to be too difficult but I'm running into road blocks with setting Dim values.

    Dealing with more complex devices like thermostats, the HSTouch and the Way2Call modem (HSPhone) can wait. I think i'm looking at a months long project.

    Any help at all with CAPI (ie. examples) would be greatly appreciated. Thanks.
    Real courage is not securing your Wi-Fi network.

  • #2
    Just to vent. The HS Help files are, as usual, bleeping useless.
    Real courage is not securing your Wi-Fi network.

    Comment


    • #3
      On the CAPI stuff, check out tenScriptAid. A great tool.
      Don

      Comment


      • #4
        Originally posted by donstephens View Post
        On the CAPI stuff, check out tenScriptAid. A great tool.
        +1

        Also check out: https://forums.homeseer.com/forum/de...306#post789306
        Jon

        Comment


        • #5
          Originally posted by donstephens View Post
          On the CAPI stuff, check out tenScriptAid. A great tool.
          Perhaps later on. Right now I have my head completely full dealing with the most basic deficiencies of HS3 without having to install and learn something else.
          Real courage is not securing your Wi-Fi network.

          Comment


          • #6
            Greg, I was in the same place as you when I migrated. TenScriptAid is a great tool and in the end, you'll be much happier with HS3.

            Robert
            HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

            Comment


            • #7
              Originally posted by jon00 View Post
              Thanks. I knew of that thread, and spent most of the morning (4AM until now) looking for it.
              I see though, skimming thru it, that Rick still refuses to include a simple routine we could call with one line to set a light to a specific dim level. It's a shame that HST's attitude is still "Our way or the highway"

              Anyway, I've managed to get this done using trial and error (16 hours yesterday and from 4AM today so far. Not in a great mood.
              My biggest frustration is that the HS help files have always been either incomplete or inaccurate. If I or anyone else ever posted a script or plugin with such deficient documentation we'd never hear the end of it.

              Now, having converted two of my motion scripts so far (now twice the size they were originally, it's on the the other 39, then on to the other functions (343 scripts in all).

              And Rick, if you're listening, yes I know I could do all this with conditional events but, rather than one event/script to control a light based on multiple sets of conditions to execute multiple sets of results, I'd need no less than six events. Not very efficient IMO. This is the biggest reason I stuck with HS2 so far... That and the "Fisher Price" Web interface.

              </End Rant>
              Real courage is not securing your Wi-Fi network.

              Comment


              • #8
                Originally posted by Wadenut View Post
                Perhaps later on. Right now I have my head completely full dealing with the most basic deficiencies of HS3 without having to install and learn something else.

                Now, having converted two of my motion scripts so far (now twice the size they were originally, it's on the the other 39, then on to the other functions (343 scripts in all).
                I understand that you are frustrated. (Been there.) HS3 has a huge learning curve when converting form HS2. Scripting is impacted significantly as well.

                I know you don't want to install and learn something else, but not only is tenScriptAid an invaluable resource, but if you are converting scripts, then tenScripting is even more valuable (in conjunction with tenScriptAid). I found that with tenScripting3 I was able to convert my HS2 scripts to HS3 relatively quickly and achieved much better results. I encourage you to step back and invest some time in those tools. A few days now will save you weeks or months later.

                PS. And Ed's documentation is first rate too.
                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

                Comment


                • #9
                  CAPI can be a one liner if you know what you are doing:

                  To turn off a device:

                  hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"off",false,true))

                  To Turn on a device

                  hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"on",false,true))

                  To Dim 50%

                  hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"50",false,true))

                  Assumes device has a device reference of 1234.
                  Jon

                  Comment


                  • #10
                    Originally posted by jon00 View Post
                    CAPI can be a one liner if you know what you are doing:

                    To turn off a device:

                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"off",false,true))

                    To Turn on a device

                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"on",false,true))

                    To Dim 50%

                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"50",false,true))

                    Assumes device has a device reference of 1234.
                    Yes thanks, I've gotten that far already with this routine I've had to add to every script so far (dealing with motion events for now):
                    Device here is the DeviceName and Level is "On","Off", or "0-99"

                    Sub DeviceAction(Device As String, Level As String)
                    Dim objCAPIControl As CAPIControl
                    Dim DvRef As Integer = hs.GetDeviceRefByName(Device)
                    If Level.ToUpper = "ON" Or Level.ToUpper = "OFF" Then
                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(DVRef, True, Level, False, False))
                    Else If IsNumeric(Level) Then
                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(DVRef, False, Level, False, True))
                    Else
                    hs.Writelog("Error","Level ' " & Level & " ' for " & Device & " is invalid.")
                    End If
                    End Sub

                    It's just a pity the HS documentation is so light on examples.
                    Real courage is not securing your Wi-Fi network.

                    Comment


                    • #11
                      Just curious - what are you trying to do with CAPI -- i.e., what types of "examples" are you looking for?

                      It seems that some of the things you are looking to do (i.e., "a simple routine we could call with one line to set a light to a specific dim level.") are easily done with the Easy Trigger plugin - if you are just moving to HS3 and weren't aware of it, I highly recommed you give that a look - I find it tremendously useful (particularly in the beta 3.0.0.61 now that dynamic groups and push / pop device state functions have been added).

                      Comment


                      • #12
                        Originally posted by jvm View Post
                        Just curious - what are you trying to do with CAPI -- i.e., what types of "examples" are you looking for?

                        As a guy who is currently trying to learn how this scripting works.... especially with having a lot of experience with various scripting languages, though not with this sort of thing.... I can say this has nothing to do with scripting. This is just flat out "programming," with no useful or user friendly documentation in sight. For example: I can kinda grasp what is written in post #9, above. If nothing else, I can certainly cut and paste "hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"on",false,true))" to turn on a light. (That's a pretty good example to follow.) What I don't understand is what the boolean values do and I haven't the wildest clue how I'm supposed to get from the gobbledygook below, that Homeseer offers as "end user documentation", to anything that is understandable or useful.... or even understang how "hs.CAPIControlHandler(hs.CAPIGetSingleControl(1234,true ,"on",false,true))" came to be created What little I have been able to teach myself is due to the labors of Ed Tenholder and his software, which I *highly* recommend.

                        "End User Documentation"

                        CAPIControl

                        The CAPIControl object holds information about a control state for a device. Generated from value/status, value/graphic pairs, and buttons, CAPIControl
                        objects are used by other plug-ins to render control options for a device properly, and to invoke a control method on a device.Here are the members of CAPIControl:

                        PublicClass
                        CAPIControl Inherits MarshalByRefObject
                        Public Do_Update As Boolean
                        Public SingleRangeEntry As Boolean
                        Public Property CCIndex As Integer
                        Public Property Range As clsValueRange
                        PublicReadOnly Property Ref As Integer
                        Public Property Label As String
                        Public Property Control Type As Enums.CAPIControlType
                        Public Property Control Location As Enums.CAPIControlLocationScripting
                        Public Property Control Loc_Row As IntegerPublic Property ControlLoc_Column AsInteger
                        Public Property
                        Control Value As DoublePublic Property ControlString AsString = ""
                        Public Property Control StringList() As String()
                        Public Property Control Flag As Boolean
                        Public Property Control Use As ePairControlUse
                        EndClass

                        I'd really like "The Missing Manual - The book that should have been in the box." folks to take this on as a project....
                        HomeSeer Version: HS3 Pro Edition 3.0.0.500
                        Operating System: Microsoft Windows 10 Pro - Work Station

                        Enabled Plug-Ins:
                        2.1.0.119: AmbientWeather | 3.0.21.0: BLLock | 2.0.24.0: BLUPS | 1.3.6.0: Device History | 3.0.0.56: EasyTrigger | 3.1.0.7: MeiHarmonyHub | 3.0.6681.34300: UltraCID3 | 3.0.6644.26753: UltraLog3 | 3.0.6554.33094: UltraMon3 | 3.0.0.91: weatherXML | 3.0.1.245: Z-Wave | 3.0.51: HS Touch Designer | 3.0.0.40 Z-Seer+

                        Comment


                        • #13
                          ewkearns. Agreed that CAPI "scripting" is quite difficult. That was, in part, why I asked what it was needed for and suggested Easy Trigger. I had tried CAPI scripting / programming for a few functions and then realized that I could do 95% of what I wanted using Easy Trigger to do the heavy lifting (and where it isn't sufficient, I sometimes use it along with some greatly simplified CAPI scripting).

                          Comment


                          • #14
                            Originally posted by jvm View Post
                            ewkearns. Agreed that CAPI "scripting" is quite difficult. That was, in part, why I asked what it was needed for and suggested Easy Trigger. I had tried CAPI scripting/programming for a few functions and then realized that I could do 95% of what I wanted using Easy Trigger to do the heavy lifting (and where it isn't sufficient, I sometimes use it along with some greatly simplified CAPI scripting).
                            I certainly don't disagree with anything you have written and I, too, use Easy Trigger. However, we are still using the event engine which finally becomes a huge collection of sentences and short paragraphs that obscures the bigger picture of the overall task, which is not viewable as a whole. I'm much better with a single document that I can view in total and annotate as needed. Thus, for me, that is the force driving my need for "scripting."
                            HomeSeer Version: HS3 Pro Edition 3.0.0.500
                            Operating System: Microsoft Windows 10 Pro - Work Station

                            Enabled Plug-Ins:
                            2.1.0.119: AmbientWeather | 3.0.21.0: BLLock | 2.0.24.0: BLUPS | 1.3.6.0: Device History | 3.0.0.56: EasyTrigger | 3.1.0.7: MeiHarmonyHub | 3.0.6681.34300: UltraCID3 | 3.0.6644.26753: UltraLog3 | 3.0.6554.33094: UltraMon3 | 3.0.0.91: weatherXML | 3.0.1.245: Z-Wave | 3.0.51: HS Touch Designer | 3.0.0.40 Z-Seer+

                            Comment


                            • #15
                              Originally posted by ewkearns View Post

                              I certainly don't disagree with anything you have written and I, too, use Easy Trigger. However, we are still using the event engine which finally becomes a huge collection of sentences and short paragraphs that obscures the bigger picture of the overall task, which is not viewable as a whole. I'm much better with a single document that I can view in total and annotate as needed. Thus, for me, that is the force driving my need for "scripting."
                              Since you are already using Easy Trigger, you might want to take a look at the enhanced group control functions added in 3.0.0.61 beta . See #2 in this posting: https://forums.homeseer.com/forum/ul...80#post1292780 as well as Posting # 511, 516. This allows some simple "If" conditional processing individualized for each member of a group. At least for me, this has reduced some scripting that I used where I wanted to set each member of a group and each group gets set separately depending on its current value. The author of Easy Trigger is really reasponsive about adding functionality if you request something that has general applicability and fits in with the plugin's design.

                              Comment

                              Working...
                              X