Service to set "repeat all" on you Sonos speakers

Hi,
After searching for a while I couldn’t figure out an easier way of setting “repeat all” after starting a playlists in the Sonos queue. So I decided to make a custom component that exposes a service sonos_player_modes.set_mode to set any of the mode supported by the underlying SoCo library that’s already used by the main sonos integration.

It’s my first custom component (and maybe there was an easier way to do this), so please, any help/suggestions would be appreciated.

Source and instuctions are on GitHub
It can be installed with HACS, if you use that.

Hey, is this still working? Im having trouble getting it to work. Also dont see it in HACS.

Installed it manually. The service shows up but it wont work.
Either nothing happens on the front end, and I see no response in sonos, or Ill get the following error on the front end:

Failed to call service sonos_player_modes/set_mode. UPnP Error 712 received: Play mode not supported from xxx.xxx.x.xx

Hi @halpplz ,
It’s working for me in 0.101.3! My Sonos is on the latest version too.

Demo Sonos Player Set Mode Repeat

What data are you sending to the service?

@giu1io
Hello again,

So I swithced it over from a custom component to a HACS install (not sure if this is the cause…or perhaps due to an update) but now I cant get it to work anymore :frowning:

This is my script:

  - data:
      entity_id: media_player.bedroom 
      mode: REPEAT_ALL
    service: sonos_player_modes.set_mode

Now, notihng happens. Dont get an error either. Any ideas?

Hi,

I’ve just tested this script

test_script:
  alias: Test Script
  sequence:
    - service: sonos_player_modes.set_mode
      data:
          entity_id: media_player.closet
          mode: "SHUFFLE"

And it’s working correctly. I have the component installed via HACS. I’m on the latest Home Assistant (via Hass.io) and Sonos is updated to the latest software.

If you are having trouble maybe try removing the component and re-installing it?
I don’t know if that would make any difference.

Hey @giu1io

Havent looked at this in a while due to lots of issues with my setup. Finally redid it and got it working fine via custom component.

Just fyi, the download on your zipfile has an issue I noticed. The directory is duplicated so its: custom_components/sonos_player_modes/sonos_player_modes/

Took me a minute to figure out why hass wouldnt recognize the component.

Thanks again!

Hi,

What is the zip file that is giving you this issue? The .zip files in the “releases” section are generated automatically by GitHub. I have tried downloading the latest one and inside I see only one folder custom_components that contains only one sonos_players_modes folder.

I’m glad you got it to work anyway! :partying_face:

thats weird. Its the one I downloaded from git. oh well! thanks again

Is this still available in HACS? I couldn’t seem to find it. Thanks!

Hi Dan,

I haven’t had it listed yet in HACS, but you can add it to HACS as a custom repository (from the top right menu in HACS select “custom repository” and paste in the input field

https://github.com/giu1io/sonos-player-modes-HASS

Then select Integration and click Add. This way it should show up for you.

Let me know if you encounter any problem.

Thanks! Worked great!