[Nearing Release] Sonos Advanced Controller

Ah, super helpful. @daniel.winks, you might want to add to the OP which models SAC supports, assuming @rhodesda is correct. It would certainly explain my problem!

I'm trying to install the Sonos Advanced Controller package, but I'm probably doing something wrong as it's my first HPM installation. I get the following:

Can some please point me in the right direction?

Also getting this error, same as one of the posts above

Hi @daniel.winks
Firstly, thanks for this great app.
It has been working great for me for months with no issues.
I just rebooted my hub today as memory was getting low.
I'm now getting issues.
An error I am seeing is as follows:-
[dev:11390](http://192.168.0.24/logs#)2024-05-21 13:33:48.975[error](http://192.168.0.24/logs#)com.hubitat.app.exception.LimitExceededException: Device 11390 generates excessive hub load on line 1824 (method secondaryConfiguration)
Dev 11390 is Co-ordinator in a group of 2 speakers.

Another thing to note is that it looks like the Sonos app has been updated. I'm not sure if that is making a difference.
The app version is - 80.00.05-release+20240510.78d060b

Any thoughts?
Thanks.

EDIT: Seeing this in the logs as well.
[dev:449](http://192.168.0.23/logs#)2024-05-21 14:36:27.890[error](http://192.168.0.23/logs#)java.lang.IllegalStateException: could not fetch device information from source hub on line 4643 (method setVolume)

I've got a weird issue where i'm not able to play tts over sonos all of a sudden, ip of sonos is correct anyone else had or know how to fix this? oddly controlling it works fine, it lowers the volume to speak but doesnt play the chime or text

Been trying to use your app. Unfortunately, I am unable to get it to create the players consistently. It will generally only create one at a time and then it won't recognize the players as having been created previously (won't allow me to select for grouping, etc.). Numerous "cannot connect" errors in log:

2024-05-25 11:19:37.307 AM[error] java.lang.NullPointerException: Cannot invoke method minus() on null object on line 201 (method localPlayerSelectionPage)

2024-05-25 11:19:32.161 AM[info]Sonos Advanced Controller: Could not connect to: 192.168.4.110:1443. If this is a Sonos player, please report an issue. Note that RIGHT channel speakers on a stereo pair, subwoofers, or rear channel speakers this is expected. Only LEFT channel in stereo pairs (or Arc/Beam in a center + rear setup) will respond.

2024-05-25 11:19:31.772 AM[info]Sonos Advanced Controller: Could not connect to: 192.168.4.42:1443. If this is a Sonos player, please report an issue. Note that RIGHT channel speakers on a stereo pair, subwoofers, or rear channel speakers this is expected. Only LEFT channel in stereo pairs (or Arc/Beam in a center + rear setup) will respond.

2024-05-25 11:19:28.742 AM[info]Sonos Advanced Controller: Could not connect to: 192.168.4.156:1443. If this is a Sonos player, please report an issue. Note that RIGHT channel speakers on a stereo pair, subwoofers, or rear channel speakers this is expected. Only LEFT channel in stereo pairs (or Arc/Beam in a center + rear setup) will respond.

Any suggestions? Thank you!

Went out and got a newer Sonos that supports S2. This allowed me to install SAC without error this time. Phew. My use-case is pretty basic: I'd like TTS messages, when they collide to queue up rather than interrupt each other.

But I'm struggling to get it working after a few hours of troubleshooting. Wondering if others have experience with the following:

  1. When I invoke playHighPriorityTTS, I hear the TTS message, but it doesn't queue up multiple TTS messages sent right after one another. It just interrupts itself.
  2. When I invoke the other TTS commands (speak, playText, playTextandRestore, playTextandResume), I hear nothing. The logs say that the message has been "enqueued". Does that mean it's queued up after some other track or text? If so, how do I "release" the message from the queue? This behavior seems to occur whether I'm playing a track on my Sonos or not.
  3. What does "Always use non-interrupting messages" under device preferences mean? I'm confused how to interrupt toggle on versus off. I've tried the above with the toggle on and with the toggle off, but it doesn't seem to change the behavior.

Appreciate any ideas. I'm stuck.

Love the app, thanks. Recently (perhaps upgrading to 2.3.9.135), I've observed something with volume control of individual players that are grouped together. If I adjust the volume of the player, it takes effect, but the Current State does not reflect a change or publish an event for the level/volume of the player. However, the player reflects the change in the groupVolume attribute. The same behavior occurs if I ungroup the players, as it creates a new group of 1 speaker, so the updates only change the groupVolume. I added logging, and Sonos returns only GroupRenderingControl (not RenderingControl). I had hoped it would be possible to reflect the changes in both, as I try to confirm the volume attribute after changing it.

Any help or ideas would be appreciated. Thanks!

setGroupVolume requires an additional cast as well. playerSetGroupVolume requires level as an Integer, or it throws an exception.

image

This happened to me as well. I believe what is happening is the players are not resubscribing to MRRC_EVENTS after the 3600 sec timeout. One workaround, which I first noted back in March, is to send an initialize() command to each speaker once every hour with a gap of around 10 minutes between the speakers to reduce the load on the hub. RM or webCoRE can be used to automate this until Daniel can provide a more permanent solution.

Hoping someone can help. I am trying to install this with HPM but keep getting the following error:

An error occurred while installing the package: Failed to install app https://raw.githubusercontent.com/DanielWinks/Hubitat-Public/main/Apps/SonosAdvancedApp.groovy. Please notify the package developer..

Thanks! (Negative points for my search skills.)

In the code, I may have found a "copy-paste without edit" that explains this. The resubscribeToMrRcEvents callback for the MRRC subscription (subscribeToMrRcEvents) is passing the MRAVT event and callback method to Sonos. So the initial subscription works, but the callback (100 seconds before the timer ends) is resubscribing MRAVT instead of MRRC.

I've recompiled with the MRRC constants. I'll know in 55 minutes if this fixes it. :slight_smile:

Edit: changing to the correct contants (MRRC_*) fixes the issue, and they automatically resubscribe to the MRRC events. Volume values update after the hour.

image

2 Likes

Ouch, I looked at that area of the code and missed that completely. It's insanely obvious now that you've pointed it out. :smile:

Let me know how it goes. I've made the changes myself and will be testing too.

1 Like

Hi @bthrock and/or @JDC,

I am experiencing the same issue and appreciate you identifying this and finding a solution. As I have limited knowledge of Hubitat code and @daniel.winks is currently not responding to posts, I would be grateful if you could help me implement the necessary changes when you are done testing.

Could you please clarify the following:

  • Specify what the changes are and what needs to be replaced.
  • In which modules should I make the changes (App Code, Drivers Code, Libraries Code, or Bundles)?
  • Are there specific line numbers where these changes should be made?
  • Do I need to compile the changes, and if so, how should I do that?
  • If possible, provide step-by-step instructions.

Thank you very much for your assistance.
David

David, the code referenced in @JDC's post (link) starts at line 1678 In the Sonos Advanced Player driver code. Simply modify the two lines with the yellow highlight so they read:

String evtSub = MRRC_EVENTS
String callback = MRRC_EVENTS_CALLBACK

Then click SAVE. It's a large driver so it can take a minute to compile, but once the circle stops spinning you're ready to go.

2 Likes

After the code change and compilation, you'll need to hit Initialize in the Sonos Advanced drivers for your devices. Then you should be all set.

2 Likes

Thank you @JDC and @bthrock. I will:

  1. Back up the current Sonos Advanced Player driver code and save it offline (cut and paste).
  2. Make the changes as per @bthrock's instructions.
  3. Save the driver and be patient with the time it takes to save.
  4. Initialize all Sonos devices using the Sonos Advanced drivers as per @JDC's instructions.
2 Likes

The backup isn't necessary, but it won't hurt anything. If you make an error, you can always do an HPM repair to restore the original code.

The initialize() step, which I should have mentioned (thanks @jdc), is important. I chose to reboot my hub instead, but only because I was doing some other testing at the time. Either way, it's been working as intended since then.

Hopefully, @daniel.winks will be able to rejoin us and make changes to the repository in the not-too-distant future.

So do I only change lines 1683 and 1684 or do I change
1683, 1684, 1702, 1703...

Just 1683 and 1684. It should look like this:

1 Like

Great, thank you @bthrock! I'm also looking forward to @daniel.winks' return. We were collaborating on debugging an issue I've been having via PM, and he even wrote some debug code for it. Additionally, I was assisting him with functional testing via PM since around the 5th release. However, I haven't heard from him in about two months.

1 Like