Homey Community Forum

The Sonos Bathroom project

#1

I have had a Sonos Play:1 in my bathroom for years. I noticed though, that I found it was a lot of work to get my music started on it. I need to take my phone, open Spotify, go to the library, select my “Favorites” playlist, press Shuffle, open up the “Currently playing”, press the “Devices” button, select my Bathroom Sonos, wait for it to connect and then I can put away my phone. Ofcourse, it can also be done from the Sonos app, but I rarely use that.
Too much work and that resulted in me only using it once or twice a week. My girlfriend only used it once or twice a month.

However, I am always thinking of new ways to use Homey to make stuff easier. And this is one perfect example.

I had a KAKU AWST-8802 available, which has 4 buttons (left button ON, left button OFF, right button ON, right button OFF) and costs only around 15 euros (https://www.praxis.nl/gereedschap-installatiemateriaal/elektra/domotica/klikaanklikuit-draadloze-dubbele-wandschakelaar-awst-8802/5205723)
4 buttons is enough for starting my playlist, starting my girlfriends playlists, having a “Next” and a “Stop” function. Which is all I need (okay, perhaps volume + and volume - would be even better).

So I hooked up the KAKU to Homey in about 5 seconds. Left button Off, I wanted to start my Spotify favorites playlist on the Sonos with shuffle on. I had my Spotify and Sonos apps installed, devices and account linked.
I was, however, unable to find my playlist. I found that if you “share” your Spotify playlist from the app on your phone or PC, you can find the ID:
For example:
https://open.spotify.com/user/{username}/playlist/{uniqueID}?si={somecodehere}
You need the uniqueID. If you search for that in Homey, you can find the playlist.

However, this worked once, next I got an error:


I decided to abandon the “spotify playlist” starting from Homey for now, and used an old Raspberry Pi with “Bronos” on it. Find it here: http://www.bronos.net/
I flashed that to the Raspberry Pi and in just a few minutes I had a “cloud” web API available, which I can control with http from Homey.
I found that if I open the URL that is available through Bronos, I can just add the name of my speaker to the URL and then use the node-sonos-http-api functionality (more info at https://github.com/jishi/node-sonos-http-api).

So to find out which playlists are available: {bronos URL}/Badkamer/favorites
and to play: {bronos URL}/Badkamer/favorite/{name of playlist}

I added that to a http GET card in Homey.

Next thing, I looked up a picture of me and one of my girlfriend, simplified it and made it black & white, then had my dad print it on a transparant sticker together with a “next” and a “stop” icon.

stickers

I had my girlfriend add her playlist to the Sonos favorites as well, and repeated the playlist http GET routine for her playlist.
I used the Homey stop & next track functions, these seem to function fine, for the “left button ON” and “right button ON” buttons on the KAKU device.

I placed the stickers:
3FCEE30D-DCB5-47C7-9B4F-D5462F8D68DC

I showed my girlfriend and she loved it. It works flawlessly. I already noticed that she uses it way more, and so do I. It’s a lot less hassle than doing the same through the Sonos or Spotify app. Power of Homey :heart:

Now if the Homey Spotify/Sonos playlist function starts working well, I can get rid of the Raspberry Pi and it’ll be even easier & cleaner.

10 Likes
#2

What an awesome way! Shame of the playlist function. Same with the Spotify app. The api sometimes breaks. But still. Cool solution!
Is the Kaku not 433 hz? :o
And the pi? You use a wife module for it or how do you keep it connected to the web?

#3

Thanks!

The KAKU is 433Mhz I think.

I have a Pi without wifi module, placed it in my “hardware closet” where the router is also located, had a free port on it so I could just connect it with a network cable.

#4

I am using IFTTT as a workaround since the option for choosing URL schemes for personal playlists on Spotify in the Homey Sonos app doesn’t work (already informed Support).

No additional devices needed, unless you want to press buttons. In that case you could even create a widget for Siri Opdrachten which can start your ‘Play Sonos badkamer’- flow

Very nice setup though @Jorden !!! :ok_hand:t4::ok_hand:t4:

#5

Never even thought of going through IFTTT, that would have been a good option as well (although in my experience IFTTT often adds a delay of 3-7 seconds).

Once those personal playlists in Homey work, I can phase out the Raspberry Pi (and use it for other things)

#6

Very nice idea!
As an alternative to Bronos you can also use Sonos http node which I’m using . This has an almost instant response and stable.

[IN DEVELOPMENT] Homey DLNA
#7

Using this one as well. Another cool thing I’ve built is ‘follow me Sonos’. I’ve got motion sensors all around my place. Whenever there’s music playing in the living room and I enter the bathroom, it automatically groups the bathroom sonos to the living room sonos and automatically ungroups when I leave the bathroom. Works really well :slight_smile:

3 Likes
#8

That’s an awesome idea.

#9

I use the jishi/node-sonos-http-api also and it’s working great.
I have it running on a Pi, but i wonder, could it also run on Homey itself? They say it is “hostable on any node.js capable decive” and isn’t Homey just that?
Maybe someone can make an app for it, i just don’t have the skills for that.

#10

Theoretically yeah, but it would require a lot of re-work to get it working on Homey. node-sonos-http-api hosts a web server and reacts based on web requests. I don’t think Homey allows you to host another webserver inside a Homey app, which means you’d have to rewrite the entire node-sonos-http-api library to make it compatible with Homey

#11

I believe the Athom app for Sonos uses the node-sonos-http-api from Jishi… just probably an outdated version, wrong use of functionality or perhaps they made an error somewhere combining it with Spotify.

#12

You can host a web-server in an app if you want, just needs to use a different port.

#13

@Jamie
That’s news to me :slight_smile: . That would probably make it heaps easier to port this library to a Homey app.

#14

How the “hell” did you manage to make that work stable… I’m having troubles just having homey fire off flows repeatedly… I can never get it to fire off that had…
A simple flow as turning lights on and the off after 30 seconds will often fail as the lights in this case are 3 lamps… if I re enter the room after 30 seconds again the 3 lamps till randomly turn on…

#15

@Morten_Skandshus
If you describe your setup and show me the flows you have built, I will help you get it to work !