Sonos coordinator widget

Hello Openhab community,
today i’d like to share with you my sonos controller widget which, in combination with my Zero configuration sonos-coordinator rule , is capable of controlling your sonos system without the need for any configurations. Just copy the rule in the ./automation/js folder, place the widget onto your desired page and start controlling your sonos system.
The source code for the widget and for the rule can also be found on github: sonos-coordinator

Requirements:

  • At least OpenHAB 3.2 or higher
  • OpenHAB Sonos binding
  • The JSScripting plugin needs to be installed

Features

  • Automatically display all Zone Players within an oh-swiper card.
  • Control the volume of the zone as well as the individual volume of all grouped players within the zone.
  • Control the mute state of the zone as well as the individual mute state of all grouped players within the zone.
  • Add or remove players from/to the the current zone player
  • Control the state of the zone player (Play/Pause/Next/Previouse)
  • Display the cover art of the currently played track of the zone player
  • Display title, artist and album information of the currently played track of the zone player
  • If the title or artist information is lacking (e.g. when listening to a radio station), the widget tries to parse the information from the track item
    (although not 100% reliable, this works for the german radio stations i am listening to).
  • Change the caption for title, artist, album, volume configuration and group configuration (for internationalization) in the configuration of the widget (default is english)
  • Responsive design of the widget (works well on tablets, mobile phones and desktop browsers)
  • Display and select the favorites defined in the sonos app

Changelog

Version 0.1

  • initial release

Version 0.1.1

  • replaced hardcoded vinyl url with embedded image

Version 0.1.2

  • added favorites button to widget

Resources

https://raw.githubusercontent.com/sichelz1/sonos-coordinator/master/sonos_coordinator_widget.yaml

4 Likes

hello maybe a feature request ?? what would complete this widget is a sonos favorite list button to choose from and also the automatic creation of the proxy item for the favorite channel. Otherwise great work very nicely done.

To be honest, i never was aware of this Sonos feature since your post. But it sounds like a nice addon. I’ll try to add it to the widget next week (i already figured out, how to enumerate the favorites in openhab but honestly, i haven’t really understood how to add those favorites in the sonos app)

Great news. a little googling around found this on sonos website.
https://support.sonos.com/s/article/3547?language=en_US
Its very easy once you have all your favorites its much convenient to do it this way plus the favorite item can be used in automations to start something automagically :slight_smile:

I have added your feature request for a favorites button. The latest widget is able to display and select the favorites defined in the sonos app

1 Like

Hi. Thank you very much for this great looking widget. I tried to copy the sonos_coordinator_rule.js in the conf/automation/js folder. I’m using a MacBook and I tried id to open this folder in Finder with my openhabian-password. Unfortunately the permission to write in the folder is not given. How can I copy the .js-file in the folder? I have to say that I am a newby in using a Pi…

I assume that you are using openhabian on the Pi. The reason why you can’t copy the rule is that you are lacking permissions on the folder (this is default on linux). Login to the pi via ssh. In the commandline, navigate to the conf/automation/js folder via the “cd” command. The easiest thing now is to use the command “sudo chmod 777” (this will grant everyone full access to the folder). As you are using the command “sudo”, the commandline will prompt you for your admin password.
After this, you should be able to copy the file.

1 Like

Thank you very much! Now it works… Great widget!

HI @sichelz
I have slightly the same issue as @fabianschoeni but to behonest - and I feel quit stupid - but I do not find the folder :face_with_peeking_eye: to place the skript.

Same as before. Openhab is running as Openhabian on my Pi.

Best Regards
björn

Hi Björn

I used Terminal from my MacBook and logged into openhabian with ssh (ssh openhabian@IP-ADDRESS. Then I had to go to the main-folder with the command "cd … " twice. The folder is then in “srv” (cd srv) → cd openhab-conf → cd automation. Then I had to write “sudo chmod -R 777 /js”. Then it worked…

Best regards, Fabian

Hi @fabianschoeni
thanks, that helped

Best Regards