Sonos Restore Track

Hi,

I created a rule to announce "Washer is done" on my Sonos Speakers when my washer finished doing laundry (copied a rule from the community would be more accurate). If there’s music already playing on the speakers when the announcement is made, the speakers go back to playing music, no problems there. However, if the speakers aren’t playing music when the announcement is made, when I press play on the speakers to start listening to music I get “the washer is done”… funny, but annoying. Is there a way to restore the station that was preset on the Sonos before the “washer is done” announcement was made? I searched through the community but couldn’t find anything. I also looked at the documentation for Rule Machine 4.0 but nothing. I tried the action “Control Music Player, Volume, Sounds” > “Control Music Player” > “Restore Track,” but it asks me to “Set track name” and I’m not sure how that works. Any help would be appreciated.

Thank you.

1 Like

I have more or less the same issue - trying to understand how the Sonos features work!

Which rule did you copy - maybe that'll work for me?

Regards Jan

Here’s where I found the rule for the washer automation RM4 - List of example rules. Look for the rule called “Laundry Cycle Complete Notification (using power monitoring).”

Here’s how I fixed the Sonos issue. I’m not a coder/programmer so I’m sure there’s a more sophisticated way to write it. I went to the Sonos Device in Hubitat while it was playing the station I like and copied the “trackData” info. Then I created the automation to send text notifications (phones) and voice notifications (Sonos speakers) if the system is in Day Mode, or just text notifications if the system is any other mode. Then, if the Sonos Speakers were not playing any music, I set the “track” I copied from the Sonos device earlier. If the Sonos devices are already playing music, they'll continue to play music after the announcement so no code needed for that. I added the 10 sec delay to make sure the Sonos Device has enough time to say “The washer is done” before it sets the new track. I couldn’t figure out how to execute the same command for all Sonos Devices so I created and IF statement for each device. Like I said, I’m sure there are better ways to fix the issue, but this one worked for me.