Announcement

Collapse
No announcement yet.

ADIOOCelot Plug-in Issues

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ADIOOCelot Plug-in Issues

    I am having a ton of troubles referencing my Ocelot interface devices in scripting.

    I can manually set the value
    <pre class="ip-ubbcode-code-pre">cpuxa.setpoint 1,8,1</pre>
    But if I attempt to use a variable
    <pre class="ip-ubbcode-code-pre">cpuxa.setpoint 1,9,SpZone2_o </pre>
    It fails with:
    <pre class="ip-ubbcode-code-pre">Script error in file: DoorBell.txt: 13:Type mismatch: 'cpuxa.setpoint' in line 59 </pre>

    I am at my wits end, I have tried everything...

    I really wish I didn't have to reference the cpuxa object. This would be 200% simpler just using the devicestatus, but that does not work at all.

    Any ideas? Is this perhaps an issue with this newer plug-in?

    Scott

    #2
    I can manually set the value
    Two things for you. The hs.DeviceValue and hs.SetDeviceValue functions are what I recommend when trying to script the ocelot points and variables. In your example it would be
    hs.setDeviceValue "[9",1 to set the SECU output to 1. Change the "[" to whatever the house code is for this SECU unit. Note that point 8 is device code 9. Devices are 1..16. Points are 0..15.

    All script variables are of type Variant. The setpoint function is expecting integers. So typecast the arguments. I did not want to change from the original plugin definitions so I left the integer typing alone.

    cpuxa.setpoint 1,8, cint(SpZone2_o)

    Comment


      #3
      I would love to use the devicestatus calls, but they just do not work. I try and read a status and I get nothing, I try to set the status and I also get nothing. I had actually posted this issue on another topic

      I will attempt to use the cint() function to hard set the variable.

      Scott

      Comment


        #4
        I was able to get the cint() to 'help' but I am having another issue. The 'invert inputs' setting appears to work only sometimes.

        For example:
        <pre class="ip-ubbcode-code-pre">
        If ucase(Data) = "SAVE" then
        SpZone1_o = cpuxa.getpoint(1,cint(SpZone1),TRUE)
        SpZone2_o = cpuxa.getpoint(1,cint(SpZone2),TRUE)
        SpZone3_o = cpuxa.getpoint(1,cint(SpZone3),TRUE)
        exit sub
        End if


        If ucase(Data) = "RESTORE" then
        cpuxa.setpoint 1,cint(SpZone1),cint(SpZone1_o)
        cpuxa.setpoint 1,cint(SpZone2),cint(SpZone2_o)
        cpuxa.setpoint 1,cint(SpZone3),cint(SpZone3_o)
        exit sub
        End If

        </pre>

        I want to save my previous interface settings, then restore them. The only problem is the value I recieve is 'inverted' from the value I need to set.

        So I can't use what I get from the getpoint call in the setpoint call, I need to invert it.

        this is getting rather frustrating...

        Comment


          #5
          Try DeviceValue rather than DeviceStatus.

          I do not think the SECU modules have bidirectional points. The SECU16 is 8 in and 8 out. The first out is point number 8. If you are using variables then they are bidirectional.

          Comment


            #6
            <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Michael McSharry:
            Try DeviceValue rather than DeviceStatus.
            <HR></BLOCKQUOTE>
            What would DeviceValue Return? DeviceStatus should return if it is on/off, if DeviceValue will give me the same I can use that. I tried IsOn and IsOff and they were empty as well.

            <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Michael McSharry:
            I do not think the SECU modules have bidirectional points. The SECU16 is 8 in and 8 out. The first out is point number 8. If you are using variables then they are bidirectional.<HR></BLOCKQUOTE>
            I don't understand this point?

            All I am trying to do is save the current settings and then place them back. I don't understand how they could be different?

            I can read if the relay is engaged as a status/value/variable. Then do some stuff and make sure I set it back to it's original setting. This is really not complicated stuff I am asking. I was able to get it to work, but I had to manually invert the bits from their read values.
            <pre class="ip-ubbcode-code-pre">
            'Read old value
            if cpuxa.getpoint(1,cint(SpZone1),TRUE) = 1 then SpZone1_o = 0 else SpZone1_o = 1
            ' Do some stuff
            '
            'Put it back
            cpuxa.setpoint 1,cint(SpZone1),cint(SpZone1_o)
            </pre>

            This seems a lot more complicated compared to:
            <pre class="ip-ubbcode-code-pre">
            'Read old value
            SpZone1_o = hs.DeviceStatus(SpZone1)
            ' Do some stuff
            '
            'Put it back
            hs.Setdevicestatus SpZone1,SpZone1_o
            </pre>

            Scott

            Comment


              #7
              A homeseer device has many properties. One is DeviceStatus which is typically used for ON/OFF indications. It also has a DeviceValue which can have numbers which take on any 32 bit value. It also has DeviceString which contains text/HTML etc.

              There are some actions via the GUI that can change or view DeviceStatus and DeviceValue, depending upon the device. An X10-like device is typically manipulated with DeviceStatus. An Plugin-like device is typically a DeviceValue. IsOn and IsOff are varints of DeviceStatus that return boolean rather than integer values. There are no hard and fast rules so there is some overlap with use of DeviceValue and DeviceStatus. The X10 devices use the DeviceValue for the Dim level. Some plugin use DeviceStatus for whatever the author elects. The ocelot plugins uses only the DeviceValue.

              The SECU16IR has 8 inputs and 8 outputs. The ocelot plugin will deliver the current status of the 8 inputs by reading the hardware interface. It does not make sense to output to one of the 8 inputs since there is no hardware to support it and if the command is accepted it will have a short life since the actual hardware status will replace whatever was sent as an output. It is reasonable to read the status of an output and restore it at a later time.

              CurrentValue = hs.DeviceValue("[8")
              'do some stuff
              hs.SetDeviceValue "[8", CurrentValue

              Comment


                #8
                So am I to understand that the devicestatus is just used by the GUI and I will need to read the actual values? (devicevalue)

                hmmm...

                I will try, but if it comes back inverted I will be right back here to complain.

                Thanks...

                Comment


                  #9
                  The only state information you see directly from the GUI for a SECU16 input is the DeviceString. You do not see status or value. If it is a SECU16 output then you will have controls to set the device value to on or off. I'm pretty sure that these are really devices values of 1=on and 0=off.

                  From the GUI you will not actually see the device value or the device status for the SECU16 output. Your script may elect to put someting in the device string so you will know if it is ON or OFF from the GUI.

                  I think the Invert logic comes into play only for the inputs. As I said before it does not make sense to write to the SECU16 input so you should not have any case where invert logic needs to be managed in this context.

                  Comment


                    #10
                    This is very strange, I seem to keep getting conflicting answers. Plus what I see is very different.

                    I can see the status from both the inputs and the relays on my SECU16. These show up exactly as expected in the GUI. I can also select ON/OFF and they do just that.

                    I am guess then I am not understanding EXACTLY how I am supposed to read their current settings and set their state in scripting.

                    Because with each message and attempt it seems to get more confusing...

                    Scott

                    Comment


                      #11
                      Read status: iStatus = hs.DeviceValue("[1")
                      Set Relay: hs.SetDeviceValue ("[8", 1)

                      iStatus = 0 or 1. 0 means OFF, 1 means ON. If inputs are inverted (plugin checkbox option) then an open on the input is OFF and a contact on the input is ON. Of course the physical interface can be changed based upon your external circuitry.

                      relay set with second parameter = 1, relay unset with it = 0.

                      You can also use the ByName versions of these method as well (e.g. iStatus = hs.DeviceValueByName("SECU Door Status"

                      Set the relay from the GUI to ON. With script read its Value. I believe it will be 1. Set it to OFF from the GUI. Read its value. It should be 0. From the GUI you cannot do anything with the inputs.

                      Comment


                        #12
                        I tried this, I reworked a script and tried this method and nothing happens.

                        I think there may be a missing link with the plug-in.

                        Scott

                        Comment


                          #13
                          I would have thought that someone out there would have used the SetValue methods for the SECU outputs. Looks like you are going to make me connect something to my SECU16 output and try it out. I was actually planning of doing this so the SECU16IR would illuminate an LED when the VR attention phrase has been recognized. When I'm in the family room that has the mic, I do not get any feedback of recognized VR attention phrase.

                          I do know it works for variables since I use those all the time in both directions.

                          Comment


                            #14
                            I only have inputs no relays or I would have helped out and did some testing. I bought a Secu16I instead of the Secu16.

                            Jim Doolittle
                            Jim Doolittle

                            My Twitter
                            My Hardware & Software

                            Comment


                              #15
                              I just tested several ways - the only one that worked was cpuxa.setpoint. Note that I'm running with the standard HS ocelot plugin 1.0.32 and not the ADIOcelot plugin. I don't know if this is something that broke recently or has never worked. I normally control the relays through Cmax code.

                              script used:
                              <pre class="ip-ubbcode-code-pre">
                              for i = 1 to 3
                              hs.waitsecs 5
                              ' hs.speak hs.devicevaluebyname ("Secu16 Unit 1 Relay Output 7 LED")
                              ' hs.speak hs.devicestatus ("[16")
                              hs.speak "Activating L E D " & i
                              hs.setdevicevalue "[16",1
                              hs.setdevicevalue "[16",100
                              hs.setdevicevaluebyname "Secu16 Unit 1 Relay Output 7 LED", 1
                              hs.setdevicevaluebyname "Secu16 Unit 1 Relay Output 7 LED", 100
                              hs.setdevicestatus "[16",2
                              hs.execX10 "[16", "on"
                              hs.execX10byname "Secu16 Unit 1 Relay Output 7 LED", "on"
                              cpuxa.setpoint 1,7,1
                              next
                              </pre>

                              Comment

                              Working...
                              X