Announcement

Collapse
No announcement yet.

Increase or decrease device's value

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

    Increase or decrease device's value

    I would like to create a virtual device or button to control devices like dimmers or volume controls. However I would prefer to not use sliders. Is it possible to create something that can increase or decrease a device's value by ten points? For example my volume control is at 40%, and I want to hit a button twice to change it to 60%. How would I do this?

    #2
    You could create an HSTouch button that runs a script like this one (untested). ('Ref' is the reference number of your device.)

    Code:
    Public Sub Main(ByVal Parms As Object)
    
    hs.SetDeviceValueByRef(Ref, hs.DeviceValueEx(Ref) + 10)
    
    End Sub
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Originally posted by Uncle Michael View Post
      You could create an HSTouch button that runs a script like this one (untested). ('Ref' is the reference number of your device.)

      Code:
      Public Sub Main(ByVal Parms As Object)
      
      hs.SetDeviceValueByRef(Ref, hs.DeviceValueEx(Ref) + 10)
      
      End Sub
      Is it possible to accomplish the same thing with an event or with JSON? Or is it only possible through scripting?

      The reason I ask is because I have zero experience with scripts.

      Comment


        #4
        Originally posted by jogentry View Post
        Is it possible to accomplish the same thing with an event or with JSON? Or is it only possible through scripting?

        The reason I ask is because I have zero experience with scripts.
        have a look at the EasyTrigger plugin and the actions:
        Set Device to Variable
        Set Device to another Device

        http://board.homeseer.com/showthread...27#post1182227

        Comment


          #5
          Originally posted by spud View Post
          have a look at the EasyTrigger plugin and the actions:
          Set Device to Variable
          Set Device to another Device

          http://board.homeseer.com/showthread...27#post1182227
          Looks awesome. I will definitely give that a try.

          Comment


            #6
            I'm trying to run a script to increase or decrease the value of a device (Dev Ref 9696) by using Uncle Michael's method, however when I run it I am getting an error Running script(2) &Temperature Up.vb, init error: Syntax error

            Any ideas where I am going wrong? I am using HSTouch and HS4 to run the script..

            Public Sub Main(ByVal Parms As Object)

            hs.SetDeviceValueByRef(9696 hs.DeviceValueEx(Ref) + 1)

            End Sub

            Comment


              #7
              You're missing a comma:

              Code:
              hs.SetDeviceValueByRef(9696[B][COLOR=#c0392b],[/COLOR][/B] hs.DeviceValueEx(Ref) + 1)

              Comment


                #8
                I'm still receiving an error when trying to send this command

                &hs.SetDeviceValueByRef(9704, hs.DeviceValueEx(Ref) - 1)

                Running script(2) &hs.SetDeviceValueByRef(9704, hs.DeviceValueEx(Ref) - 1), init error: Invalid procedure call or argument: 'hs.SetDeviceValueByRef'

                I can set the value of the device with this command, however I just want to increase/reduce the Value by one

                &hs.SetDeviceValueByRef(9704, 100, True)

                Any ideas?

                Comment


                  #9
                  Try this:

                  Code:
                  &hs.SetDeviceValueByRef(9704, hs.DeviceValueEx(9704) - 1)
                  Jon

                  Comment


                    #10
                    Hi Jon,

                    I am now getting the following error

                    Running script(2) &hs.SetDeviceValueByRef(9704, hs.DeviceValueEx(9704) - 1), init error: Invalid procedure call or argument: 'hs.SetDeviceValueByRef'

                    Comment


                      #11
                      Ah yes, you are missing a third parameter.

                      Try:


                      Code:
                      &hs.SetDeviceValueByRef(9704, hs.DeviceValueEx(9704) - 1,True)
                      Jon

                      Comment


                        #12
                        Jon, you are a legend, thank you so much

                        Comment


                          #13
                          Jon, you have helped me out numerous times with scripts, so I'll see if I can try this one on you (if anyone else knows of a solution please feel free to chip in)

                          I have created a touch screen for my central heating, hence the reason above where I needed to increase/decrease the value of a device

                          So I now have a House Temperature Device (Device Ref 6960) which polls every 5 minutes and sets the temperature to a Device, along with a House Target Temperature (Device 9704) which is adjustable up or down using your script above

                          The last link is a script where a reoccurring event takes place every 5 minutes and checks the House Temp against the Target Temperature and once it is reached it switches off the heating, and alternatively if it drops below the Target Temp can switch on the heating

                          Hope this makes sense..

                          Thanks in advance

                          Comment


                            #14
                            Scrap that idea, I've just realised that what I have in place will already do what I'm requesting!!

                            Comment


                              #15
                              Originally posted by DaveMunn View Post
                              Jon, you have helped me out numerous times with scripts, so I'll see if I can try this one on you (if anyone else knows of a solution please feel free to chip in)

                              I have created a touch screen for my central heating, hence the reason above where I needed to increase/decrease the value of a device

                              So I now have a House Temperature Device (Device Ref 6960) which polls every 5 minutes and sets the temperature to a Device, along with a House Target Temperature (Device 9704) which is adjustable up or down using your script above

                              The last link is a script where a reoccurring event takes place every 5 minutes and checks the House Temp against the Target Temperature and once it is reached it switches off the heating, and alternatively if it drops below the Target Temp can switch on the heating

                              Hope this makes sense..

                              Thanks in advance
                              It sounds like you are implementing a virtual thermostat in events. You might want to give my free SDJ-VStat plug-in a try. You can create multiple virtual thermostats with 7 day schedules using any sensors and control devices on your system.

                              https://forums.homeseer.com/forum/th...al-description

                              Steve

                              Comment

                              Working...
                              X