Automating Sonos Port and Receiver integration

Hey, so currently I have a Denon X3600H AV receiver in my living room, serving dual purpose for movies/TV and music. To play music I currently use the built in Heos integration, and also use the multi room capabilities with a Heos speaker in another room.

For various reasons I’m not very satisfied with Heos as a system and am considering moving to Sonos, but one advantage Heos has from being built into the receiver is that it can control power and volume. For example, if I select the receiver via Spotify Connect or Airplay and start playing something, it will turn it on and switch to the Heos source, and I can control the volume from my phone that way too.

To connect Sonos to the receiver I’d need a Sonos Port, which wouldn’t be able to control the receiver that way, so I was wondering if I could achieve at least some of this with Home Assistant automations. For example, if media starts playback on the Sonos Port, turn on the receiver to the correct input. Not sure what I could do about volume but at least I can control it via HA so maybe there’s something I could do there.

Does anyone have any experience with a setup like this who could chime in before I invest in the hardware to try it out myself?

I use a Sonos connect (prior version of the port) with a dumb receiver that is controlled by an IR blaster and connected to a zwave plug. So yes, when the Sonos starts playing I run an automation tthat turns the plug on, waits a second, sends the IR command to switch to the Sonos input. For volume control I use the Sonos App or HA to adjust the Sonos connect volume level. Meaning I keep the receiver at a constant volume level and adjust the input level up or down. I do this because the IR only has commands to make the volume louder or softer not set it to an absolute level.

With your smart receiver it’ll be easier.

Thanks, good to know. As you said, since I already have the ability to control my receiver over the network and via HA, that part is already sorted without needing an IR blaster or anything.

And yeah I guess having the receiver set to a constant volume level and controlling the Sonos Port output volume would be the only option really. I would just need to be careful as this would mean setting the volume high on the receiver whereas when watching stuff, it’d be the opposite with a constant level output from HDMI and controlling the volume on the receiver so wouldn’t want to deafen myself when switching inputs…

The receiver has a setting to apply a default volume when turned on, so maybe I could use that along with automations to set the volume when switching inputs and hopefully be safe :sweat_smile:

You don’t have to/shouldn’t do it like that. The Sonos Port appears to have three line-out settings; Fixed with no volume control, Variable where the volume level is adjusted in the audio itself, and Pass-Through where the audio volume level is fixed but any volume commands are forwarded to the receiver, presumably via HDMI CEC.

https://www.sonos.com/en-us/guides/port

Ooh interesting. This looks promising, but I need to figure out what pass-through audio actually is. The Port does not have an HDMI output, so the audio output is either via S/PDIF coax or analog RCA, neither of which would allow it to be sending volume commands to the receiver.

After having a quick Google someone speculated that it actually means it somehow discovers your receiver and sends commands via TCP/IP, which would be great if it works but not sure how to verify what it actually means and therefore whether it would work with my receiver.

Could’ve sworn the Port had HDMI, but I guess that was only the Amp.

You actually can send volume commands over optical Toslink, though I have no idea how widely supported it is. I was very surprised to find out my parents’ Samsung TV could control the volume of their Harman/Kardon AVR255 receiver, which had to be connected over Toslink after the shitty HDMI switcher board in the receiver broke. Yes, I am certain it does not happen over IR.

Since Sonos claims the Port supports forwarded volume commands, I am guessing it also works over coaxial S/PDIF, as at least my understanding is that it is essentially the same thing as Toslink just over a different cable.

Ah yeah, maybe.

Hmm, yeah I believe S/PDIF is the underlying protocol and the transport can either commonly be copper coax cable with RCA connectors, or TOSLINK. So if certain commands are supported, it seems like they would be supported in either case.

And a post from a Sonos staff member in this thread (can’t find a way to link to the specific post) speculates that it could use a “hidden, inaudible signal in the feed”.

At the same time, doing more googling gave me a lot of results indicating that this feature requires “Works with Sonos” certification on the receiver and uses this to send commands over IP. I think only some Onkyo and Pioneer receivers have this certification - my Denon certainly doesn’t.

Also, this anecdotally has someone saying that they tried this out with the same model receiver as mine, and it didn’t work.

And thinking about it, the reason I can control the receiver’s volume in Home Assistant currently is using either the Denon or HEOS integrations, both vendor specific. If those are the mechanisms by which the receiver can be controlled over a network, it seems unlikely that Sonos would have implemented them, especially given that HEOS is a competing multiroom streaming system.

Well, regardless of whether the Port controlling the volume on your receiver through S/PDIF works natively or not, it should be a simple thing to set up an automation in HASS to synchronize the volume levels between the two, since both Sonos and your receiver are supported with integrations in HASS. The only limitation is that the Port must expose a volume level so that there is something to pull the number from, which it probably won’t do in the Fixed mode but should do in Pass-Through.

I made an automation that synchronizes volume between all speakers in a group. I was always annoyed that Sonos didn’t enforce this itself. Yes, adjusting volume in the Sonos app (or Spotify Connect) will adjust the volume on all speakers in the group, but whatever relative volume differences they had when initially paired will attempt to be preserved. (Up until you manually synchronize the volume between speakers, like for example dragging it all the way down to 0.)

Yeah, as you said the issue there might be which volume mode to use. I think you’re right that fixed mode would be no good as I assume it doesn’t expose a control at all. Variable would be complicated as then you would still have two controls - varying the Sonos volume would vary the Port’s output, so it would be unclear how to synchronise the two as having both controls set to 50%, for example, would be equivalent to 25% of the total receiver output as it’s basically 0.5 * 0.5. If we assume that pass-through won’t work as intended, it’s unclear whether it would still expose a (normally non-functional) control that I could build automations on in HA.

And yeah, that one is setup specific I suppose. Given that I have a receiver connected to larger speakers in one room, and much smaller speakers in other rooms, it’s unlikely I would want the same absolute volume number in different rooms (in order to achieve an equivalent level). So preserving the relative differences between the speakers while scaling the group up and down is probably what I would want.

edit: this blueprint looks like it could be very useful, although there are a fair few recent-ish reports of it stopping working.