Announcement

Collapse
No announcement yet.

cpuxa.setvar

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

  • cpuxa.setvar

    HomeSeer: 2.102
    Plugin setUp: "ADIOcelot"

    Hello

    This script is OK:

    sub main()
    Set cpuxa = hs.Plugin("ADIOcelot")
    cpuxa.SetVar 34, 5000
    end sub


    this one returns:
    "...type incompatible: 'cpuxa.SetVar' in line XX ..."

    sub main()
    Variable=InputBox("Variable")
    Value=InputBox("Value")
    Set cpuxa = hs.Plugin("ADIOcelot")
    cpuxa.SetVar Variable, Value
    end sub

    What am I doing wrong ???
    Is there a way to modify variables in Ocelot without using a script ??

    Thanks for your help

    Yves

  • #2
    I dont have access to source now, but likely a type casting issue.

    cpuxa.SetVar cstr(Variable),cLng(Value)

    or perhaps

    cpuxa.SetVar cstr(Variable), cInt(Value)

    Without a script, each event has a DeviceAction option where the device can be set ON/OFF or 0/1

    Comment


    • #3
      Thanks Michael

      I will give it a try to morrow morning, and let you know the outcome

      yves

      Comment


      • #4
        Originally posted by Michael McSharry
        I dont have access to source now, but likely a type casting issue.

        cpuxa.SetVar cstr(Variable),cLng(Value)

        or perhaps

        cpuxa.SetVar cstr(Variable), cInt(Value)

        Without a script, each event has a DeviceAction option where the device can be set ON/OFF or 0/1
        Michael

        Interesting results:

        Both
        cpuxa.SetVar cstr(Variable),cLng(Value)
        and
        cpuxa.SetVar cstr(Variable), cInt(Value)

        are accepted without error message, but the variable is set to Zero whatever the Value


        hard coding the value:
        cpuxa.SetVar cstr(Variable), 5400
        does the job
        Any clue ?
        Would hs.SetDeviceValue be as efficient ?


        It is a pity that in HS, Ocelot variables can only set to 0 or 1
        We definitively live in a digital world

        Thanks for your help

        yves

        Comment


        • #5
          For HS2 the ADIOceot setup page needs to have the Interface Property set to ADIOcelot and not Applied Digital Ocelot. This will allows HS to output via ADIOcelot.

          I think I'm wrong on the 0/1. I was thinking of setting the SECU IO Point.

          I would suggest not using the cpuxa object and use the hs.SetDeviceValue DC,Value syntax. You can put values other than 0 and 1.

          Comment


          • #6
            No, you are correct- setting the device on/off sets the value to 1/0 for variables.

            In device actions setup there should also be the commands "set value", "increment value" and "decrement value" in addition to "on" and "off" for the ocelot variables.

            If those choices aren't present then this thread might help
            jim

            Comment


            • #7
              Originally posted by Michael McSharry
              For HS2 the ADIOceot setup page needs to have the Interface Property set to ADIOcelot and not Applied Digital Ocelot. This will allows HS to output via ADIOcelot.

              I think I'm wrong on the 0/1. I was thinking of setting the SECU IO Point.

              I would suggest not using the cpuxa object and use the hs.SetDeviceValue DC,Value syntax. You can put values other than 0 and 1.
              Thank Michael

              As mentioned in my 1st post, ADIOcelot property is set
              I can actually output fixed hard coded values via ADIOcelot, not variables

              I do not beleave that Ocelot variables can be directly set in HS; please correct me if I am wrong

              For the futur, I will use hs.SetDeviceValue

              Thanks again for your help

              Greetings from Grenoble, France

              Yves

              Comment


              • #8
                Originally posted by jsteed
                No, you are correct- setting the device on/off sets the value to 1/0 for variables.

                In device actions setup there should also be the commands "set value", "increment value" and "decrement value" in addition to "on" and "off" for the ocelot variables.

                If those choices aren't present then this thread might help
                jim
                Jim

                Should these values setting commands appear in the status page?
                yves

                Comment


                • #9
                  No, only the on/off buttons appear on the status page. The value commands are some of the available device commands when setting up an event.
                  jim

                  Comment


                  • #10
                    Originally posted by jsteed
                    No, only the on/off buttons appear on the status page. The value commands are some of the available device commands when setting up an event.
                    jim
                    Thanks Jim
                    yves

                    Comment

                    Working...
                    X