Announcement

Collapse
No announcement yet.

Increase/decrease volume using a button instead of slider?

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

  • Increase/decrease volume using a button instead of slider?

    Hello,

    I would like to use buttons to increase/decrease the volume in a zone, but there is no such option, only the ability to go to a specific volume setting. Can this be achieved in some other way, perhaps by reading the current value and adding 1 or 5 to it?

    Also, I noticed the following strange behavior when using HSTouch to control my Lync system, wondering if it has to do with the plugin. If I leave the HSTouch tablet (Yoga Tab 3) and the screen goes blank from inactivity, when I unlock it again it opens back up to the HSTouch screen i was using prior, but sometimes the status tracking of the Volume will not work, just remains at the previous value, even tough the actually volume slider does work. So, to summarize, I can change the volume but it does not show the new value on the screen. To fix it I need to go to another screen (weather or whatever) and come back to music, and then it works fine. Any thoughts on this?

    Thanks.
    Amit

  • #2
    I use a plugin for my Denon, but I have an 'Increase/decrease' commands I use for the button, but those could possibly be commands the author put into the plugin.
    You're using status tracking for the volume right? It sounds like something fishy going on like two boxes stacked on top of each other and interfering with the updating. I'd delete that box, triple check there's no hidden duplicate boxes, and rebuild it.

    Comment


    • #3
      Yeah increase/decrease options are definitely options that were written into the plugin. I am trying to figure out how to achieve the same thing using a script, but I have no experience in VB let alone using scripts in Homeseer. I was doing some reading and playing around with scripts this afternoon and it took a little time to realize that I need to use CAPIControl in order to make a change to an actual device. I was using get/set DeviceValue functions and later realized that they only modify a copy of the object, not the actual device object. I still have no idea how to use CAPIControl, so perhaps Ultrajones or anyone else can provide some input on how a script can achieve this?

      As far as the other issue, I did some more investigating and it seems to be related to Tasker. I am using it to overlay a button to get back into Homeseer when calling Spotify. It appears that the issue I described above only happens when using the Tasker button, otherwise the buttons status tracking work just fine when I switch between the apps using the native abilities of the tablet.

      Comment


      • #4
        nuttynet - I am trying to do something similar. My goal is to increase the volume on a HTD Zone by using a script. The script is triggered by a Z-Wave device.

        With the script (see below), I am able to read the current Volume Value of Zone1, increase it and then write it back to the device. All that seems to work fine, the value is updated in the HS Device but the HTD doesn't increase the actual volume. Help would be appreciated.

        AL

        Sub Main(Parm As Object)
        Dim CurrentVolume as Double
        Dim NewVolume as Double

        'Get current volume of Zone 1(Device 235)
        CurrentVolume = hs.DeviceValue(235)
        'Increase volume level by 2
        NewVolume = CurrentVolume + 2

        'Check Limits and Reset volume
        if NewVolume < 60 and NewVolume > 0 then hs.SetDeviceValueByRef(235, NewVolume, True)

        End Sub

        Comment


        • #5
          Hi Alan,
          Thanks for the reply. I was able to figure it out and write a small VB script to achieve my goal. I appreciate you replying however!
          Cheers.

          Comment


          • #6
            nuttynet - are you willing to share your VB script? Maybe it will work for me too. Thanks.

            Comment


            • #7
              Ohh sorry, I guess I read your post too quickly and missed the part about it not ultimately working. I'll dig it up and post it here later tonight. I stopped using it since I switched to Logitech Media Server.

              Comment


              • #8
                So here is the script I used. You pass the script 3 parameters. The reference ID of the device, the string "inc" or "dec", and the integer which is the incremental amount of volume you want to change i.e. 1, 2, 5 etc.

                Imports System.IO, System.Net
                Public Sub Main(ByVal Parms As Object)
                Dim ParmArray(10) As String
                '' Retrieve parameters
                '' Parms(0) Device ID
                '' Parms(1) String representing action type (i.e. inc or dec)
                '' Parms(2) Integer indicating incremental step (i.e. 1, 2, 5 etc)
                Dim strDeviceRef As String
                Dim strAction As String
                Dim strIncrement As String
                Dim index As Integer = 0
                For Each param As String In Parms
                ParmArray(index) = param
                index += 1
                Next
                strDeviceRef = ParmArray(0)
                strAction = ParmArray(1)
                strIncrement = ParmArray(2)

                '' Get the current device volume level
                Dim deviceValue As Integer = hs.DeviceValueEx(strDeviceRef)
                '' Check requested command and incremental level and perform requested action
                If strAction.Contains("inc") Then
                deviceValue += strIncrement
                hs.CAPIControlHandler(hs.CAPIGetSingleControl(strDeviceRef, True, "Vol " & deviceValue, False, False))
                Else
                deviceValue -= strIncrement
                hs.CAPIControlHandler(hs.CAPIGetSingleControl(strDeviceRef, True, "Vol " & deviceValue, False, False))
                End If
                End Sub

                Comment


                • #9
                  nuttynet - That did it! Looks like I will need to read up on the CAPIControlHandler to understand it better. Anyway, I did have to mess around with the parsing code a bit but it now works and I really appreciate you sharing your script.
                  Thanks again,
                  AL

                  Comment


                  • #10
                    Here is the final script after some modifications:

                    'Pass the script 3 parameters separated by commas:
                    '1-Device ID
                    '2-The string "inc" or "dec" for increment or decrement
                    '3-The integer of incremental amount of volume change 1 or 2 or 5 etc.

                    Imports System.IO, System.Net
                    Public Sub Main(ByVal Parms As Object)
                    Dim LineOfText As String
                    Dim ParmArray() As String
                    Dim i As Integer
                    Dim strDeviceRef As String
                    Dim strAction As String
                    Dim strIncrement As String

                    LineOfText = Parms
                    ParmArray = LineOfText.Split(",")

                    if UBound(ParmArray) <> 2 then Exit Sub
                    strDeviceRef = Trim(ParmArray(0))
                    strAction = UCase(Trim(ParmArray(1)))
                    strIncrement = Trim(ParmArray(2))


                    'Get the current device volume level
                    Dim deviceValue As Integer = hs.DeviceValueEx(strDeviceRef)
                    'Check requested command and incremental level and perform requested action
                    If strAction.Contains("INC") Then
                    deviceValue += strIncrement
                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(strDeviceRef, True, "Vol " & deviceValue, False, False))
                    ElseIf strAction.Contains("DEC") Then
                    deviceValue -= strIncrement
                    hs.CAPIControlHandler(hs.CAPIGetSingleControl(strDeviceRef, True, "Vol " & deviceValue, False, False))
                    End If
                    End Sub

                    Comment


                    • #11
                      Alan@Leitko.com can you post some of your event logic with this scripting loaded so that we have an example. I want to be able to use a homeseer switch such that if I do a double-tap up I can trigger the volume up on my HTD Lync 6 zone for that room. As I am not a scripting person at all, this information appears to be what I am looking for and would allow not only event triggers but audible ones possible with Homeseer Alexa Smartskill.

                      Please advise

                      Comment


                      • #12
                        supergolfstick, the script that I posted above does exactly what you are trying to do. You just have to develop a few events to implement it along with sending it the the proper Parameters. I'll do my best to explain.

                        I have a HTD Lync12 System which I am controlling using a Z-Wave light switch located our Master Bath. Our Master Bath is my HTD Zone1. I installed a HomeSeer Z-Wave light switch in our Master Bath that has Scene Capability (i.e. double-tap, triple-tap, etc on the Up-Scene1 and DOWN-Scene2 toggle switch.

                        I use a Double-Tap on the Up toggle (Scene 1) to turn Zone 1 Power ON and set Airplay as the input. Similarly a Double-Tap on the Down toggle (Scene 2) to turn Poer OFF. The ON event is shown in the first attachment. No script is needed for these actions.

                        Next, I use a 4-Tap on the UP toggle (Scene 1) to increase volume five levels and a 4-Tap on the bottom toggle (Scene 2) to lower the volume five levels. This is where the script comes in. The second attachment illustrated this. The important part of the script is to feed it with 3 parameters that are listed in the Parameters box, separated by commas. The first parameter is the Device ID you want to control. In my case it is 235 which is the Device ID of my HTD Zone1 Volume device. You can find yours on the Advanced Tab of the Zone X Volume device you want to control. The second parameter is either increase or decrease and the third parameter is the amount you want to increase or decrease the volume.

                        In summary I had to create 4 events:
                        1 - Event to turn ON the HTD Zone x Power (Double Tap UP on the Z-Wave Switch) - See attachment 1
                        2 - Event to turn OFF the HTD Zone x Power (Double Tap DOWN on the Z-Wave Switch)
                        3 - Increase volume by 5 units (4-Tap UP on the Z-Wave Switch) - See attachment 2
                        4 - Decrease volume by 5 units (4-Tap DOWN on the Z-Wave Switch)

                        I hope this helps.
                        AL
                        Click image for larger version

Name:	Power On.JPG
Views:	64
Size:	71.9 KB
ID:	1365941Click image for larger version

Name:	VolumeUp.JPG
Views:	58
Size:	105.8 KB
ID:	1365940
                        Attached Files

                        Comment


                        • #13
                          Alan@Leitko.com thanks for the attached detail on this script. I have 2 questions

                          1. I am running a ZEE S2 (Linux) do you have a script that can be leveraged for this? if so, how to I apply and load
                          2. Assume that you have the script, I am not a scripting expert at all but how would I Load this on the ZEE S2 and in what directory structure.

                          thanks!
                          Ultrajones

                          Comment


                          • #14
                            Originally posted by Alan@Leitko.com View Post
                            Here is the final script after some modifications:
                            Thanks for sharing, I modified it slightly to work for me
                            Code:
                            'Pass the script 3 parameters separated by commas:
                            '1-Device ID
                            '2-The string "inc" or "dec" for increment or decrement
                            '3-The integer of incremental amount of volume change 1 or 2 or 5 etc.
                            
                            Imports System.IO, System.Net
                            Public Sub Main(ByVal Parms As Object)
                            Dim LineOfText As String
                            Dim ParmArray() As String
                            Dim i As Integer
                            Dim strDeviceRef As String
                            Dim strAction As String
                            Dim strIncrement As String
                            
                            LineOfText = Parms
                            ParmArray = LineOfText.Split(",")
                            
                            if UBound(ParmArray) <> 2 then Exit Sub
                            strDeviceRef = Trim(ParmArray(0))
                            strAction = UCase(Trim(ParmArray(1)))
                            strIncrement = Trim(ParmArray(2))
                            
                            
                            'Get the current device volume level
                            Dim deviceValue As Integer = hs.DeviceValueEx(strDeviceRef)
                            'Check requested command and incremental level and perform requested action
                            If strAction.Contains("INC") Then
                            deviceValue += strIncrement
                            ElseIf strAction.Contains("DEC") Then
                            deviceValue -= strIncrement
                            End If
                            Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(strDeviceRef, True, "(value)", False, False)
                            cc.ControlValue = deviceValue
                            Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
                            End Sub

                            Comment

                            Working...
                            X