Sono Integration: How do I play music from HE to Sonos?

It does the full replacement of the URL for everything formatted %something% as the parameter passed to asynchttpGet.

You could easily do a little experiment (not with Sonos) to convince yourself that this is actually happening. You can use that website that shows what you send in Gets and Posts sent to it.

@bravenel Well, I am running the node.js on a Mac and I setup tcpdump to watch for incoming traffic from the HE hub to trying to emulate your experiment.

When I use any of the commands I have programmed, I see traffic between the HE and my server. All seems to work well.

When I include a % as a variable indicator no traffic is seen coming into the server. The only time it does is if it's followed by a 20 (as in %20 to denote a white space).

No incoming traffic from the hub to the Mac. As soon as I remove the % in any string of an HTTP GET, there is traffic between the hub and my Mac.

21%20PM
04%20PM

When I ran the rule above, you can see in the second pic that the Room/clearqueue made it to the server. The following command with the % wrapped around the variable never left the HE.

Okay. I finally got it working. The glitch seems to be when using a two word phrase for the Sonos location. For example, HE doesn't send anything when it's /Family Room/ or /Family%20Room/. If I use a single word, such as Office, then the URL is sent.

HE Sends:
http://192.168.5.220:5005/Office/musicsearch/apple/song/%music_search%

HE Doesn't Send:
http://192.168.5.220:5005/Family%20Room/musicsearch/apple/song/%music_search%
http://192.168.5.220:5005/Family Room/musicsearch/apple/song/%music_search%

I have three rooms with two word names; Guest Room, Family Room, Music Room. If I try with any of them in the above "Doesn't Send:" section, the results are the same.

Hello.
My apologies for reviving an old thread.
Just a quick question.
(I'm just about to install a full Sonos installation at someone's house, and I really don't know too much about it.)
Why would I want to do something custom from Hubitat, instead of using the Sonos app directly?
Isn't it very good? Doesn't it allow you to do searching?

If the goal is searching for music and playing it manually, then use the Sonos app.

But Hubitat makes it possible to play (or search for) music based on all kinds of triggers, or send TTS notifications to speakers, probably other features but I’m not much of a Sonos person myself so I don’t use the integration extensively.

1 Like

Hello all, just got a couple of Sonos speakers and have added the integration to my hub.

A bit of background; I'm coming from Google Home Minis. We wanted something that sounded better and also something that didn't have a microphone (all of our mics on the home minis are muted). I went to Ikea and picked up 2 of their Symfonisk speakers. SO far, OBVIOUSLY a huge jump in quality from the Home minis.

One of the things we loved about the home minis was the ability to have a morning routine that plays the news. They would play the latest news from a bunch of our sources, most of them updated hourly.

I've gone and tracked down all of the RSS feeds for most of those sources. Now I' trying to replicate the capability I had through the Sonos Speakers an Hubitat.

I'm goign to try to explain this problem but because I don't understand it fully myself, it may sound a bit disjointed. Apologies in advance.

Here is the link to one of the casts I am trying to integrate.

https://www.cbc.ca/podcasting/includes/hourlynews.xml

I'm not terribly familiar with RSS or Sonos, but when I plug this link in, nothing happens, however, when I plug the link that is ON that same XML file, the cast plays. The problem is that the XML file is updated daily, but the file name is of a particular cast for a certain date.

Anyone know how I would get this to work? Then I imagine, I can simply apply that same solution to the rest of the news casts.

Thank you,

Phil