GET Http Command Stopped Working

So I have a rule that accesses my SONOS Hub to Re-Group Speakers.

It sends the following GET request:

This worked up until about a week ago (when I noticed it) and still works when I put the command into a browser.

These are the log results, but nothing happens:

    [app:4354]( 03:41:03.391 pm [info]( Over: Send GET to: --> delayed: 0:00:05

    [app:4354]( 03:40:58.298 pm [info]( Send GET to: --> delayed: 0:00:05

    [app:4354]( 03:40:57.485 pm [info]( setTrack(x-sonos-htastream:RINCON_949F3ED359B301400:spdif) on Kitchen Sonos

    --- Live Log Started, waiting for events ---

This is a problem with a RM HTTP Get Request? Can you post a copy of the rule? Are you sure that the Sonos hub is working correctly and wasn't assigned a new IP address?

(Also, FYI, screenshots are preferable to copy/paste according to Hubitat staff. Copy paste can affect some text when Discourse gets a hold of it.)

Do you have a Sonos with a non-spaced name that you could put in a command see if it works? There may be a possible issue with the %20 in the http get command.

I thought that as well... yes other join commands work that do not have a space in the speaker name.

Did you change the speaker name a week ago? I fail to see how this would have ever worked if the "%20" was the problem. The action works when you put the same URL into a browser?

I bet it is trying to substitute global variables into what is between the % signs!! That is how you get a global variable into the url. I use this for different functions within rule machine. Anything between % signs is treated as a global variable. So, it is looking for the variable 20TV and not finding one. Change the names to not include spaces and use underscores instead and it bet it will work perfectly.

That's what I thought. I have had similar issues with the http get and sonos commands. That's the only time I use it. There are some other posts describing similar issues with the %20. My was to rename my Sonos devices that I called directly via a get command to a single name. Not the best way, but at least it's working.

1 Like

Let me add to this. I got Living%20Room to work. But Master%20Bedroom doesn't.


Anyway, @JDogg016, why not use @ogiewon's http momentary switch to send your join command, and then use the momentary switch in your RM rule?

In looking at the line, there aren't any variables being passed. The names of the Sonos devices are "Kitchen Overhead" and "Kitchen TV Speaker". It's a good theory about the substitution though. If it was consistent then no command would work with a %20 in it.

I'm wondering if there's an issue passing more than one % in a get command. That's where I ran into issues (noted in another post). I couldn't pass a variable to a Sonos that had a space in it, like http://x.x.x.x:5005/Family%20Room/(command)/%variable%)

In a previous post, I noted that I was running a packet filter on the machine running the API and I didn't see any packets coming from the hub with multiple % in it.

What do you mean? What line? The URL the OP is using is:

So, I would expect %20TV% to be changed into the global variable 20TV. But there isn't one so it's setting that to NULL and instead most likely it's sending the GET to:

It would only be a problem if the device name had two spaces in it since that gets your two % signs.

I think we are saying the same thing in different ways. I wonder if there are two % in a line (regardless of being separated by a / ), it thinks it's a variable. The only glitch I found is the lack of a packet(s) coming from the hub in that situation. So, that would negate the variable substitution idea.

1 Like

The momentary switch fixed the issue. Thank you!

Seeing that I did not know of this app, I see it would help me in another area but it brings another question.

I have a HUE Lab that I would like to trigger in HE (because it will work better that way). I have to enter a 'PUT' command to[login]/sensors/40/state

I then have to enter in the json parameter status: 1.

How can I do this using momentary switch as RM does not have a PUT command.

1 Like

You'd have to write a driver to use the HTTP PUT method instead of the HTTP GET method. There's a thread on how the async http calls now work in Hubitat.

The driver @aaiyar mentioned above does have a PUT option. I don't know if it can pass the json parameter you need but might be worth a shot.

Hubitat/Drivers/http-momentary-switch.src at master · ogiewon/Hubitat · GitHub

You cannot pass json parameters in @ogiewon http momentary switch unless he epilated his driver.

@bravenel any chance you would add PUT capability into RM?

@JDogg016 looks like you are using Sonos HTTP api by jishi. I use this also but I didn't notice that you could group speakers with a command. And the HTTP momentary switch will be helpful with integrating into HE. I had a WebCore rule that would turn the volume up and down when I asked Alexa but this has broke now with the new Sonos update in ST (only thing I was using ST for). I am thinking that this might be useful to accomplish this in HE and Alexa routines.

I use the app WATO to assist me with various volume controls if that helps, but I don't turn the volume up with my voice as I am still a remote control household. :-/

You can do that and much more. There's this incredibly clever post by @homeauto2112 demonstrating how to use a dashboard tile to search libraries on Sonos and start playing a specific artist.

Since Alexa doesn't seem to play well with Sonos just yet, this could help to fill the gaps. I just created a HTTP momentary switch called Jane's playlist. I put it in HE Amazon Echo Skill so that Alexa could see it and now I can ask Alexa to turn on Jane's playlist. :grinning: I am going to setup two switches, one that will turn volume by 5 and one that will turn volume up by 5.:smiley:

Edit: This works great! I can officially take ST off line now!