No announcement yet.

Sonos HStouch one controler for all speakers (Solution!)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Sonos HStouch one controler for all speakers (Solution!)

    I found a solution to have a single controller which you could switch between all your devices to control. What I did was write a script for the action for that button which take a value from a drop down box in hstouch allowing me to switch which device is being controlled via what is selected in the drop down menu. Ideally you could pass a 2nd value indicating what button was pushed so you would only need a single script but honestly I just got tired of trying to get this working with hstouch and it was simpler to just duplicate made code changing a single line of code for each. i tried to make this as user friendly as possible so people could modify it for their own use. Scripts and screen shots attatched for multiple actions including (Play, Pause, vol up, vol down, next track, previous track and mute). It would be easy to add additional ones as needed. Ultimately as you can see on my slide i ended up not using the volume controls as I decided I wanted immediate access to all volume controls, but it could be done in exactly the same way scripts for that already attached.

    Sub Main(ByVal parm As Object)

    'Replace room names below within the "" with the names of the rooms you wish to use and teh device values with the value for that device -------
    Dim R1 as String = "Adams Office" ' Room 1
    Dim DV1 as Integer = 430 'Device Value for Room 1
    Dim R2 as String = "living Room" ' Room 2
    Dim DV2 as Integer = 95 'Device Value for Room 2
    Dim R3 as String = "Foyer" ' Room 3
    Dim DV3 as Integer = 96 'Device Value for Room 3
    Dim R4 as String = "Master Bedroom" 'Room 4
    Dim DV4 as Integer = 637 'Device Value for Room 4
    Dim R5 as String = "Master Bath" 'Room 5
    Dim DV5 as Integer = 98 'Device Value for Room 5
    Dim R6 as String = "Garage" ' Room 6
    Dim DV6 as Integer = 714 'Device Value for Room 6
    Dim R7 as String = "Media Room" ' Room 7
    Dim DV7 as Integer = 821 'Device Value for Room 7
    Dim R8 as String = "Patio" ' Room 8
    Dim DV8 as Integer = 618 'Device Value for Room 8
    '-----------------------------------------------No changes needed below this point------------------------------------------
    Dim CR As String
    Dim CV As Integer = 99

    CR = Parm(0)
    CR = CR.Trim

    Select Case True
    Case CR.Contains(R1)
    CV = DV1
    Case CR.Contains(R2)
    CV = DV2
    Case CR.Contains(R3)
    CV = DV3
    Case CR.Contains(R4)
    CV = DV4
    Case CR.Contains(R5)
    CV = DV5
    Case CR.Contains(R6)
    CV = DV6
    Case CR.Contains(R7)
    CV = DV7
    Case CR.Contains(R8)
    CV = DV8
    Case Else
    CV = 99
    End Select
    if CV <> 99 then
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(CV,True,"Play" ,False,False))
    hs.writelog("Invalid Room", "Invalid Room or device value: " & CR & " " & CV)
    end if
    End Sub
    Attached Files

  • #2
    It would only allow me to include 6 files here are the rest of the scripts. Also note these need to be changed to the .VB extension to use them
    Attached Files