Habpanel Sonos Widgets

Tags: #<Tag:0x00007f386e14a200> #<Tag:0x00007f386e14a070> #<Tag:0x00007f386e149e90>

Hi All
I’ve been playing with Habpanel widgets to create a Dashboard for Sonos. Attached are 3 widgets which link to my Sonos system of 7 rooms. All are extensively reworked from other people’s versions for similar things and I’m no expert at coding so I’m quite sure they can be improved on!

There are three widgets:
SonosControlWithArt shows AlbumArt and does player controls and volume
SonosControlWithArt.widget (2).json (10.1 KB)

SonosAlbumSelect shows 8 slots which link to Sonos favourite playlists (or stations etc) with a link to png for Album cover
SonosAlbumSelect.widget (1).json (7.0 KB)

SonosSystemVolume groups different speakers (I use the one called SN_DiningRoom as a master) and controls the volume. The top right master one runs buttons called Chill and Loud which run rules which set all speakers to a pre-determined volume for background music and party mode. This one is a bit more complicated and I can post more detailed instructions if helpful to people!
SonosSystemVolume.widget (2).json (18.3 KB)

Hopefully of use to someone - improvements and code tips helpful as learnt from scratch through copying and guesswork!!

4 Likes

Nice work, gonna try this some time

1 Like

Great let me know your thoughts!

Could you please explain how to start Sonos favourite playlists or stations.

Last time I got trouble by playing my favorite tunein radio stations. So I decided to switch to radio.net.
There are no problems using them via sonos app, but for me it is absolutely impossible to start them via openhab.

Hi

You need a favourite item:

String SN_DiningRoom_Faves "DiningRoom Faves"  {channel="sonos:CONNECTAMP:RINCON_000000:favorite"}

And then you need to pass the name of a Sonos favourite as a string, e.g. in a sitemap button:

Switch item=SN_DiningRoom_Faves label="" mappings=["Chill"="Chill"]

Note that the playlist must be set up as a Sonos favourite (this confused me for ages). The favourite can be anything - a radio station, playlist etc. As long as the word match.

1 Like

Hello,

i need help.
i install and config the Widget 2 but i cant see the music/volume control icons.
They are control the music but i cant see them.


thx for help
Heiko

Thanks for trying this! Bit of a guess but it looks like the widget isn’t big enough - on mine it covers a whole page. Click edit and make the widget taller and wider.

The Widget looks great. But I don’t see the control neither. I tried to resize the widget but the never appear.

Do I have to put the control images like Play.png into the folder /static/sonos/? Where do I get them from? Is it located at /etc/openhab2/html?

Regards, Fred

Hmm, thanks for the feedback @Fred_H

I’m no expert at this but will try and get it to work!

I think you are absolutely right - you need the icons in the conf\html\sonos folder

Sorry, should have referenced these! Would love to know if it works after this

@kalki this is probably what you had going wrong too? Sorry I never replied to this

You can use any icon I guess but the ones attached work very nicely

Fwd

Play VolDown Back

Thanks. That was the problem.

Put the Files
Back.png
Fwd.png
Pause.png
Play.png
VolDown.png
VolUp.png
in the folder /etc/openhab2/html/sonos and it’s working.

Excellent!