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.
Edit: changing to the correct contants (MRRC_*) fixes the issue, and they automatically resubscribe to the MRRC events. Volume values update after the hour.
Ouch, I looked at that area of the code and missed that completely. It's insanely obvious now that you've pointed it out.
Let me know how it goes. I've made the changes myself and will be testing too.
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.
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.
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...
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.
Does anybody know what this log message means: "messaged has been enqueued". I'm trying to figure out what enqueued means in this context?
Does anyone in the community know the cause of this error?
dev:567 2024-06-26 08:09:11.937 AM error java.lang.NullPointerException: Cannot invoke method playerModifyGroupMembers() on null object on line 123 (method on)
I've been using Sonos without any issues for months, but this error showed up today. I can no longer use the Sonos Group controller. With the developer unavailable, I was wondering if anyone else has suggestions.
Edit
I figured it out! For some reason, the Sonos Advanced Controller was missing one of my Sonos devices, which happened to be the Group Coordinator. After running the discovery process, it found the device, and I selected "Done." Grouping now works perfectly.
Is there any way to turn off the errors for Roam devices that are switched off? (I typically only use mine when I go out on the back deck or other places in the yard that I want to use it, and Otherwise I keep it turned off so that I don’t ruin the battery with it sitting there at 100% on the charger all the time.) The errors in the logs every hour are annoying, and there’s no Way to adjust logging for the child device. Thanks!
Does tts work on your sonos roam?
Yes
Hello,
I don't know what I could have going on here, but I have tried to get this app working and had zero luck.
I always get the error shown in the attached screenshot.
C7 Hub, latest FW, latest app installed by HPM.
Click "Sonos Virtual Player Devices"
Finds 6 devices, all primary.
Click "Next" button
Click "Click to set" and select all
Click "Create Players"
App shows "The following devices will be created: (all 6)
Click "Next" brings me back to main screen, and nothing looks different from first run screen.
Click "Done"
One non-functional player created in devices and returning to the app shows nothing different than the first run of the app with no virtual player devices shown.
If I run through it again, it will do the same thing again.
Network:
SonicWall router
Unifi access points (no VLAN or issolation)
Junpier QFX 10G copper
I tried a different access point, different "dumb" Negear 24 port switch, and I can't beleive the router is an issue, but I have a consumer router to try at some point. Network discovery works fine, so I don't think this is a Unifi issue. Playback on the Sonos app is fine. I grabbed a new off the shelf Hubitat just to make sure nothing installed on my main hub was interfering.
Any ideas? Cause I am stumped.
Update if this helps. The Hubitat integration does work.
Thanks!
I’ve got similar issues. The discovery part looks at my NAS and says it’s not a SONOS. I guess because it’s where music library is stored and address is held somewhere on SONOS. Also has looked at 192.168.1.1. Only managed to get two of my 8 Sonos devices loaded - an AMP and Roam. Had a Sonos One working at one point but reinstalled to see if that would help and lost it.
Apologies if this has been addressed somewhere in this long thread - I did attempt to scan through it but couldn't find any mention of my particular issue(s)...
I'm tyring to utilize this app to do some basic Sonos zone grouping/favorite playing. And, generally, it has worked pretty well. However, I'm getting intermittent failures for which I'm having difficulty pinning down the cause.
** Side note...I had these exact same problems when I utilized Sonos integration on the Vera platform, so I suspect the issue is with the Sonos API. But, wanted to ask just to be sure I'm not missing something obvious.
I have two simple rules setup...one to play a Sonos favorite (Spotify playlist) throughout my house (all four zones), and another to play "nap" music in my office (plus a couple others, but these two examples demonstrate the issue). You can see from the rule snippets below that the commands I'm using are very basic and they work about half the time However, in a scenario where I'm currently playing music throughout the house (all zones) and run the "nap" music rule, most of the time, ALL the commands will execute, seemingly somewhat delayed when watching the Sonos app, but the music will not actually play (the Sonos player will remain on Pause). The same happens in reverse - if I'm currently listening to nap music and run the "whole house music" rule, everything will setup correctly but Sonos will remain "paused." In my layman's view, it seems like Sonos is getting overwhelmed with commands and/or the "load favorite" command can't quite get to playing.
If I run any of these rules when Sonos is in full pause mode (i.e. nothing playing on any zone), they always work perfectly. It's only if I run the rule when Sonos is currently active doing something else that the new music/grouping doesn't actually play. Again, all the other commands in the rule are executing...zones grouping correctly, favorite loads, crossfade turns on, shuffle turns on, repeat-all mode turns on. But then it just doesn't play.
In an attempt to diagnose the issue, I added a delay to the "load favorite" command, figuring that might give Sonos the chance to catch up. That made no difference. One other thing I checked...if I click the "Load Favorite" button in the device control panel, even when Sonos is actively playing some other selection, it works perfectly every time - the favorite loads and begins playing. This intermittent failure only occurs with the HE rules.
Here are the two rules/command lists (note: Living Room is the group coordinator for the group 'Whole House')...
Whole House Music:
"Nap" music:
What am I missing?