Announcement

Collapse
No announcement yet.

UPB Script Control

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

    UPB Script Control

    I'm sure this must have been covered, but don't see it and I've read the UPB Plug-in instructions.

    So, how do you programatically control this plug-in with script? For example, turn on a light or activate a link? I'm sure this must be documented somewhere.

    #2
    Ooo...ooo... I know! Pick me .

    There may be other ways to do this but:

    For lights, just use hs.ExecX10 using the device code that the plug-in uses for the light or use hs.ExecX10ByName using the name of the device that the plug-in uses. Personally, I prefer names. Then use "On", "Off", "Dim", "Bright", etc.

    For links, the plug-in creates devices for these so use hs.SetDeviceValue with a value of 1 for Activate and 2 for Deactivate. I did a little more with links and custom buttons in this thread.
    Jim Doolittle

    My Twitter
    My Hardware & Software

    Comment


      #3
      I cautiously say, O.K. I didn't realize that ExecX10 would work.

      I guess this gets me back to confustion that I and many Homeseer users have. What is the difference between device control, device status, and device value? Can I set a link to "ON" with ExecX10? Can I set a UPB device to 1 with SetDeviceValue?

      Comment


        #4
        I do not want to stretch too far here and should probably rely on Oman to comment but here is what I assume to be true.

        Support was made for hs.ExecX10 since the commands for UPB devices are very similar to those for X10. Using hs.ExecX10 controls a device by status using command strings such as "On", "Off", etc. Alternatively, you might (have not tested this) be able to use SetDeviceStatus but that would require the use of integers for the commands.

        Since links have a slightly different command structure, it appears that their control is handled by value and so the hs.SetDeviceValue command comes into play.

        I believe the term device control implies the changing of a device's value or status.

        BTW, commands could/may have been provided by the plug-in that would be more intuitive but since ExecX10 and SetDeviceValue work, I have not looked into doing it another way.
        Jim Doolittle

        My Twitter
        My Hardware & Software

        Comment


          #5
          The long story...

          ExecX10 is usually / used to be used to actually transmit an X10 command. Since X10 is considered one-way it also causes an immediate update to the status and value of any matching virtual device within HomeSeer to the new state that was just transmitted. Properly written plug-ins watch for these changes to their devices and will go "Hmmm, someone *wants* this light to go on so I'll turn it on."

          Therefore Exec10 will generally cause the expected thing to happen. This is more of a happenstance than what should be done. I suppose at any time HomeSeer could limit ExecX10 to work only on X10 range devices, but I bet they won't since people seem to rely on this behavior pretty heavily.

          Because of the way HomeSeer treats X10 like devices differently than "other" devices, the plug-in writer has to decide if the virtual device they create to represent the physical device should be X10-like or not. You get more commands with "other" devices and more triggers and conditions with X10 like devices. (This has changed some on the latest betas, "other" devices are finally getting fair treatment).

          Because of this different treatment the UPB plug-in sets up lighting devices as X10 like. Since links don't behave at all like actual lights the links are setup like custom devices.

          X10 like devices have a status. On/Off/Dim. If dimmed they also have a value - the dim level. You usually use SetDeviceStatus on these.

          Custom devices only have a value. The value is chosen by the plug-in author and generally matches (but not always) what is in the drop-list when you control the device. You usually use SetDeviceValue on these. (I've been pushing for a "SetDeviceValueText" command to set the textual name of the value, like "activate" rather than having to refer to a table of numbers.)

          In order to make this easier to manage from the user's perspective the plug-in tries to make everything live in perfect harmony by mapping Status to value and back. Therefore you can set a value of 0 on a light and it will be off. Set a value of 100 and it will be on. Set a value of 50 and it will be dim 50%.

          By the same token the link devices map on to activate. Off is mapped to decativate. Dim is mapped to... Hmmm, nothing I think.

          (I'm not getting into the device string yet, that's for another class)

          Think of it this way... the plug-in looks at what the virtual device in HomeSeer changed to and tries to send whatever commands need to be sent to make the real device match. When the real device changes state the plug-in tries to make the virtual device in HomeSeer match. It isn't so much a concept of "send this command". Good plug-ins will try to make sure the status and value of a device are in-sync with each other and the state of the actual physical device.


          I hope this helps.


          Jon


          Originally posted by anogee
          I cautiously say, O.K. I didn't realize that ExecX10 would work.

          I guess this gets me back to confustion that I and many Homeseer users have. What is the difference between device control, device status, and device value? Can I set a link to "ON" with ExecX10? Can I set a UPB device to 1 with SetDeviceValue?
          Jon Ort
          JonOrt@The--Orts.com
          (Remove the dashes in the address, spam is getting out of hand)

          Comment


            #6
            That seems logical, and since I'm converting all my scripts over from X-10, that makes it easy.

            Comment


              #7
              UPB script controls

              How would I script this using UPB devices and links for dim and blinking?

              Can I address a link and have it blink directly? Just for a period of 30 seconds?



              ' flash lights x number of times and speak message
              '
              '
              sub main()
              dim i
              dim j
              hs.speak "Attention Gates are Opening $time."
              for i = 1 to 3

              hs.execx10 "&23","off",0

              hs.WaitSecs 2

              hs.execx10 "&23","on",0

              hs.WaitSecs 5

              next
              hs.execx10 "&23","off",0
              hs.execx10 "&23","on",50
              hs.WaitSecs 30
              hs.execx10 "&23","off",0

              end sub
              HS3 Standard Edition 3.0.0.258

              Comment


                #8
                I have the outside light on my deck blink when the phone rings, but being one horrible scripter i do it with a HS event calling the blink command from the link from the event. I don't know if there is a way to call a blink command of a link from a script. This will probably be better answered by Oman.
                Marty
                ------
                XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
                Playing with HS3 a bit but it's just play at this point.

                Comment


                  #9
                  Blink

                  Blink is supported by links, so you can add a link to the device(s) you want to blink and use HomeSeer to set the link command to blink (16 if using SetValue).

                  Jon



                  Originally posted by nightwalker View Post
                  I have the outside light on my deck blink when the phone rings, but being one horrible scripter i do it with a HS event calling the blink command from the link from the event. I don't know if there is a way to call a blink command of a link from a script. This will probably be better answered by Oman.
                  Jon Ort
                  JonOrt@The--Orts.com
                  (Remove the dashes in the address, spam is getting out of hand)

                  Comment


                    #10
                    Script controls

                    Please could you give an example that shows syntax? Just can not figure out the syntax.

                    Something using a function for UPB?
                    Examples?


                    ' flash lights x number of times and speak message
                    '
                    '
                    sub main()
                    dim i
                    dim j
                    hs.speak "Attention Gates are Opening $time."
                    for i = 1 to 3

                    hs.execx10 "&23","off",0
                    hs.WaitSecs 2
                    hs.execx10 "&23","on",0
                    hs.WaitSecs 5

                    next
                    hs.execx10 "&23","off",0
                    hs.execx10 "&23","on",50
                    hs.WaitSecs 30
                    hs.execx10 "&23","off",0

                    end sub


                    Are there "Reference Functions" for the UPB features?

                    http://www.homeseer.com/support/home...stem_Functions

                    HS3 Standard Edition 3.0.0.258

                    Comment


                      #11
                      Any chance that....

                      Could you give an example that shows syntax? Just can not figure out the syntax. Something using a function for UPB?

                      - Blink is supported by links, so you can add a link to the device(s) you want to blink and use HomeSeer to set the link command to blink (16 if using SetValue).

                      - other function examples that the UPB plugin supports?
                      HS3 Standard Edition 3.0.0.258

                      Comment


                        #12
                        You don't need to talk to the plug-in directly. It uses standard HomeSeer commands.

                        hs.SetDeviceValue "]2",16

                        will set link "]2" to blink.

                        hs.SetDeviceValue "]2",1

                        will turn it on.





                        Originally posted by Richard View Post
                        Could you give an example that shows syntax? Just can not figure out the syntax. Something using a function for UPB?

                        - Blink is supported by links, so you can add a link to the device(s) you want to blink and use HomeSeer to set the link command to blink (16 if using SetValue).

                        - other function examples that the UPB plugin supports?
                        Jon Ort
                        JonOrt@The--Orts.com
                        (Remove the dashes in the address, spam is getting out of hand)

                        Comment

                        Working...
                        X