DEPRECATED – Connecting Sonos with KNX via Gira HomeServer – inception

This project occupies my mind for some time and recently I got closer to a working solution. Actually I already have something working in place but at this stage the solution looks quite ugly and I would not recommend it but only for the very enthusiastic users of KNX, Sonos and Gira HomeServer. You should have a Windows based computer in your network to run the solution.

Credit: most of the code is reused from the following sources:

If you want to replicate the solution you should follow these steps:

on the Gira HomeServer

  • in Experte software create some group addresses to control your Sonos zone players. Mark Send communication object for those group addresses so values will be sent through the KO Gateway (in the IP network)
    • type 1 bit for transport commands: play(1)/stop(0), pause(1), next(1)/previous(0), mute(1)/unmute(0)
    • type 8bit-EIS6 – percent (0-100%) for volume commands
  • If you use QuadClient you can place new controls for audio commands in the rooms coresponding to zone player locations. I used the Set Value – percent control to adjust the volume. You can also assign in ETS3 any pushbuttons to change the group address value for volume control. Remember to note which group address corresponds to which zone player – you need it later to build the UniqueDeviceNames.ini file
  • do not forget to enable the Communication Gatweway in Project settings and to use the default port 7003

on your Windows machine

  • download Olser’s code from http://www.cebotics.com/forums/viewt…856041&start=0 and install the wshell scripts ZonePlayerController.wsc and ZonePlayerFinder.wsc (update: now I included them in the zip archive)
  • Download and place ZPCMD.exe file in the root folder (C:\).
  • Follow Olser’s instructions to detect the zone players in your installation. You will get a file named UniqueDeviceNames.txt in your root folder. This is how this file looks like:

Portable: uuid:RINCON_000E5851565201400
Dining Room: uuid:RINCON_000E5830093201400
Patio: uuid:RINCON_000E58133EE401400
Guest Room: uuid:RINCON_000E58233A4601400
Living Room: uuid:RINCON_000E58234DF001400
Master Bedroom: uuid:RINCON_000E5821CE0001400

  • Create a file named UniqueDeviceNames.ini in the root folder by editing the UniqueDeviceNames.txt file with the following structure

[HS]
IP=192.168.104.10
port=7003
key=
[player_status]
uuid:RINCON_000E5851565201400=Playing
uuid:RINCON_000E5830093201400=Stopped
uuid:RINCON_000E58133EE401400=Paused
uuid:RINCON_000E58233A4601400=Muted
uuid:RINCON_000E58234DF001400=Unmuted
uuid:RINCON_000E5821CE0001400=Stopped
[volume_command]
6/2/1=uuid:RINCON_000E5851565201400
6/2/2=uuid:RINCON_000E5830093201400
6/2/3=uuid:RINCON_000E58133EE401400
6/2/4=uuid:RINCON_000E58233A4601400
6/2/5=uuid:RINCON_000E58234DF001400
6/2/6=uuid:RINCON_000E5821CE0001400
[play_stop_command]
6/2/11=uuid:RINCON_000E5851565201400
6/2/12=uuid:RINCON_000E5830093201400
6/2/13=uuid:RINCON_000E58133EE401400
6/2/14=uuid:RINCON_000E58233A4601400
6/2/15=uuid:RINCON_000E58234DF001400
6/2/16=uuid:RINCON_000E5821CE0001400
[pause_command]
6/2/21=uuid:RINCON_000E5851565201400
6/2/22=uuid:RINCON_000E5830093201400
6/2/23=uuid:RINCON_000E58133EE401400
6/2/24=uuid:RINCON_000E58233A4601400
6/2/25=uuid:RINCON_000E58234DF001400
6/2/26=uuid:RINCON_000E5821CE0001400
[mute_unmute_command]
6/2/31=uuid:RINCON_000E5851565201400
6/2/32=uuid:RINCON_000E5830093201400
6/2/33=uuid:RINCON_000E58133EE401400
6/2/34=uuid:RINCON_000E58233A4601400
6/2/35=uuid:RINCON_000E58234DF001400
6/2/36=uuid:RINCON_000E5821CE0001400
[next_previous_command]
6/2/41=uuid:RINCON_000E5851565201400
6/2/42=uuid:RINCON_000E5830093201400
6/2/43=uuid:RINCON_000E58133EE401400
6/2/44=uuid:RINCON_000E58233A4601400
6/2/45=uuid:RINCON_000E58234DF001400
6/2/46=uuid:RINCON_000E5821CE0001400
  • Please note that the [HS] section states your HomeServer IP address, port and secret key in order to communicate with the Gira HomeServer. Then the other sections relate your KNX group addresses to the Sonos zone players IDs found in the UniqueDeviceNames.txt file
  • Place the SonosHS.exe (REMOVED, see newer posts) file in a place of convenience (if you want use root folder as well)
  • Make sure you have installed the .NET framework v4 and open a cmd prompt windows as an administrator
  • Run this command: C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe c:\sonoshs.exe in order to install the windows service named SonosHS
  • Go and start the windows service (this is only necessary after installation, it will start automatically after any reboot)
  • Go ahead and control your zone players from your KNX devices. Please keep an eye for firewall warnings and allow SonosHS to connect and access the disk system. Save those confirmations in your firewall rules.

Please note this is a very incipient implementation and is not very well tested. There is a limitation that you need to provide audio content for your player beforehands, from this solution you can only control the volume and the transport commands of the player. You can use the project posted at the end of the article to modify it and get your own implementation.

This is my current TODO list for next versions:

  • integrate the ZonePlayerController.wsc code inside the C# project and remove the need to register a separate component
  • integrate the ZonePlayerFinder.wsc into a proper setup solution and generate automatically the UniqueDeviceNames.ini file
  • place all files in an appropriate location into the computer program files
  • integrate the watch functionality for automated feedback to the HS (now the communication is only unidirectional)

Please note that this would be a less desired solution at least for the visualisation part. The best solution would be to generate a whole new plugin for QuadClient in order to control all Sonos installation from the HomeServer itself. Gira already provides such plugins for several multiroom audio systems and may have plans to add Sonos on the list. Or not. Until then I will stick with this solution. Update: I just tested the new Expert 2.5 plus 2.5 firmware and it appears the UPnP plugins in Quad Client work just fine with the Sonos system. I will post a new article about that. Still the project presented here is useful if you want to control the Sonos zone players from the KNX devices through group addresses and integrate music in scenes and so on.

The source code

The source code can be found here (REMOVED, see newer posts). I cannot provide any support at this stage, posted information is just for community preview.

UPDATES

The solution as a windows form application (REMOVED, see newer posts)(using Dacom’s HSMonitor interface)

The complete setup package (REMOVED, see newer posts) for the Windows service: installs, starts, generates device names – read the comments for more info

Tags:

  1. Richard’s avatar

    Here is a Windows application version for debugging purposes. You can look at the communication between KNX and IP worlds and check if your commands are transported to the windows box. http://richardconsulting.ro/downloads/SonosHSapp.zip

  2. Richard’s avatar

    UPDATE 2:
    I have created a setup package that delivers all components and runs some scripts. Steps to use it:
    1. Download this archive: complete setup package at the end of the article
    2. Scan it with your antivirus to make sure all is clean
    3. run setup.exe file
    4. Confirm all security dialogs
    5. Follow the instuctions (not necessary to change anything)
    6. Check C:\ folder for the created UniqueDeviceNames.txt file that will show the uuid numbers in your Sonos network
    7. Edit the UniqueDeviceNames.ini file found in the installation folder and replace your Sonos uuid IDs, Gira HomeServer IP, port and key and your KNX group addresses as necessary. Note that you will need and elevated account to edit files in Program Files folder.
    8. At this stage, all should be up and running

Reply

Your email address will not be published. Required fields are marked *

* Bifa GDPR este necesară

*

Sunt de acord

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recommended Articles