Announcement

Collapse
No announcement yet.

Numeric values for 'virtual device'

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

    Numeric values for 'virtual device'




    #2
    Any device can hold a value, you can create a virtual device and then issue the immediate script command &hs.setdevicevalue("X13", 2) which will set the value to 2.

    To increment/decrement the value in HSTouch then you can use the following script command, theres no 'native' action to do it - just need to be creative.

    &hs.setdevicevalue("X13", (hs.devicevalue("X13") + 1))

    To compare the values you will need either a couple of events or a recurring script which checks the two values for whatever comparison you want and then performs an action.

    I think I may do something similar to you, I have three temp sensors coming into HS, then inside HS these are represented as devices. I have another virtual device that holds the desired temperature (have buttons on the device to set this value up/down) and also a control in HSTouch. Every minute I check the value of the temp sensors and compare this to the desired temperature - setting the heating on/off accordingly.

    Comment


      #3



      &hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1))

      But my problem is, if I place this command in a .txt file in the script folder, and I try to run it, I get an error.
      I hope someone can help me.

      Comment


        #4
        Let me see if i can give mrhappy a hand here.

        It would need something like this if you're going to run it from a txt file.

        PHP Code:
        sub main()

        hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1))

        end sub 
        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


          #5
          Originally posted by jaco View Post


          &hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1))

          But my problem is, if I place this command in a .txt file in the script folder, and I try to run it, I get an error.
          I hope someone can help me.
          no problems...if you are placing it inside a script then you can drop the '&' just leaving hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1)), the & is for immediate script commands outside of the script...

          Comment


            #6
            Remove the & when using this in a script file:

            ie hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1))
            -Rupp
            sigpic

            Comment


              #7

              If I place this text in test.txt:

              sub main()
              hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1))
              end sub



              11-3-2011 21:36:59 - Error - Running script, script run or compile error in file: test.txt1044:Kan geen aanhalingstekens gebruiken bij het aanroepen van een Sub-waarde in line 3 More info: Kan geen aanhalingstekens gebruiken bij het aanroepen van een Sub-waarde

              Comment


                #8
                Originally posted by jaco View Post
                If I place this text in test.txt:

                sub main()
                hs.setdevicevalue("v1", (hs.devicevalue("v1") + 1))
                end sub



                11-3-2011 21:36:59 - Error - Running script, script run or compile error in file: test.txt1044:Kan geen aanhalingstekens gebruiken bij het aanroepen van een Sub-waarde in line 3 More info: Kan geen aanhalingstekens gebruiken bij het aanroepen van een Sub-waarde
                Sorry, my fault - the above is a vb.net script line, rather than for VBScript which you are using, try;

                hs.setdevicevalue "v1", hs.devicevalue("v1") + 1

                Comment


                  #9
                  Thanx.... it's working now.

                  I have only a little problem left; if i increase of decrease the value of "v1" it doenn't change in the 'status culumn' in the 'device list'.

                  Comment


                    #10
                    Originally posted by jaco View Post
                    Thanx.... it's working now.

                    I have only a little problem left; if i increase of decrease the value of "v1" it doenn't change in the 'status culumn' in the 'device list'.
                    Try adding this line;

                    hs.setdevicestring "V1", hs.devicevalue("V1"), True

                    Comment


                      #11
                      Yes......this is also working perfectly....thanx.

                      Do you know if there is a list with this kind of hs.-commands?

                      Comment


                        #12
                        Originally posted by jaco View Post
                        Yes......this is also working perfectly....thanx.

                        Do you know if there is a list with this kind of hs.-commands?
                        All of the hs. commands are listed in the help file either here http://www.homeseer.com/support/home...2/homeseer.htm (click Using Scripts then Scripting Functions) or it should be on your HS PC.

                        Comment


                          #13
                          The help file has all of the script commands. It is installed by default when you install HomeSeer. Updates are then available through the updater. On your HomeSeer system, click the Help button/link, or if you do not have it, go to this page: http://(address)host)/help

                          There it will list the help for some of your plug-ins as well as the HomeSeer help file, video tutorials, and other help resources.
                          Regards,

                          Rick Tinker (a.k.a. "Tink")

                          Comment


                            #14


                            Comment

                            Working...
                            X