Sync Sonos Connect, Amp or Port volume and source with your receiver

If you have a Sonos Connect (or Amp, or Port) like me, and you connect it to your home theater receiver, you might’ve run into the issue that it’s not really plug and play. You can start music with the Sonos app, but it will not power most receivers automatically, especially when you connect it through an optical cable for example.

Sonos has a nice feature in their apps as well where you can set the volume of the Connect to passthrough, which means it will not actually set the output volume of the Connect, but we can still read that volume from the Sonos API.

That’s why I’ve made a blueprint that does the following:

  • Switches a media_player entity, like your receiver, to the right source when you start playing.
  • Turns off your receiver if it’s still set to the Sonos source after you stop playing music.
  • Pauses Sonos playback if you turn off your receiver or switch it to another source.
  • Synchronises the volume you adjust in Sonos with that same media_player.
  • Synchronises the volume setting of the media_player back to the Sonos, for example when you twist the volume knob.

Works great between my Sonos Connect (gen 2) and Denon AVR-X1600H. Not tested with anything else, please let me know how well it works for your setup!

There’s a configurable buffer delay for the volume synchronisation so they don’t keep adjusting each other. 1 second works for me, but you might want to put in a higher value if you notice weird behaviour with the volume. Or you can just turn it off if you don’t need it, or like the output adjustment of the Connect itself. (Which I don’t recommend, because it reduces audio quality.)

Check out the source right here: sonos_connect_sync.yaml · GitHub

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

2 Likes

great work!
Tried the blueprint with sonos connect(v2) and Marantz Mcr603.
What worked:
switch on the receiver when playing music over sonos.
there is a one-time-sync between volume of sonos connect and marantz. Any further changes of volume on either device doesnt do anything.
any idea?
sonos connect is in volume pass-through mode
sonos devices are connected via sonos net
what im doing wrong?
==update==
got it working

1 Like

Thank you so much for this! I’ve been wanting to do this, and you helped me out tremendously!

1 Like

Hi there!

Thanks for creating this. I am using a Sonos Port with Marantz receiver. I created a few automations myself, but yours seems cleaner. There are only two things that don’t seem to be working with yours that do with mine…

  1. Powering on the AVR when I start playing Sonos in the zone that is plugged into the AVR.

  2. Setting a max volume on the AVR. Your sync volume implementation is much better than mine, but it makes the assumption that I actually want to go to 100% on my AVR. My AVR gets loud for the room it’s in, and it would be great to add an option to cap the volume. I.E. 100% in Sonos is only 70% of my AVR, and then we just scale the volume.

I’m new to using Github… I’m new to Home assistant… I did get a YAML working, though. Should I try to push changes to yours? Thanks!

Thanks for the suggestions! I actually had a volume scaling functionality in there, but it turned out to be a bad idea as I ran into multiple issues:

  • It’s very hard to sync properly due to calculation differences with floating points.
  • How would you handle a volume set higher on either source outside of the scale?
  • What if the scale doesn’t translate 1 to 1? For the volume property of a media_player this is always the case as the implementation should cover it.

Trying to fix those things meant a lot of jumping around in volume, and there is a better way! I currently solve this by setting a volume limit in the SONOS app itself, which I think is a much cleaner solution anyway. :slight_smile:

I don’t use multiple zones myself, so I’m not entirely sure how that would work properly, and won’t be able to test it. As for pushing your changes, it’s a gist on GitHub so it’s not really built for collaboration, but I could setup a repository if there’s enough interest!

This is really great and works well with my AVR-X4400H. Is there any way to add wakeup when the source is selected in Sonos?