ebaauw / homebridge-zp

Homebridge plugin for Sonos ZonePlayer
Apache License 2.0
243 stars 20 forks source link

Feature Request: Implementation of a TV Level to adjust surround sound level #210

Closed ElfixHS closed 7 months ago

ElfixHS commented 7 months ago

Issue

I use the plugin to active and deactivate night sound depending on the time of day. Unfortunately, this also affects the level of surround sound which drastically increases with night sound activated. However, unlike the sub level, I do not see an option to change the TV level for surround sound. In the app the setting can be found under System -> corresponding product -> Surround-Audio -> TV Level.

Not sure if it helps but the Sonos plugin for Home Assistant seems to be able to expose this setting to HomeKit ("TV Level").

https://www.home-assistant.io/integrations/sonos/

Would be awesome if this could be added, similar to the sub level. Or maybe there is another workaround that I am missing here?

Thanks in advance!

Home Asisstant

ebaauw commented 7 months ago

In v1.4.40.

ElfixHS commented 7 months ago

Thanks for the fast reply and implementation! Unfortunately I am not able to find it in my HomeKit settings. I am running plugin v1.4.40. My system displays sub levels but not the surround settings. Anything I am missing here? Maybe something specific to my setup? Running two Era 300s as surrounds if that may help.

ebaauw commented 7 months ago

Could you please list the output of zp -H x.x.x.x info -v, substituting the IP address of your sound bar?

ElfixHS commented 7 months ago

Sure, this is the output

{ "address": "192.168.10.30", "airPlay": true, "bootSeq": 23, "channel": "", "homeTheatre": true, "household": "Sonos_yqsA13gJtaKBfMkedfjluMP2in", "id": "RINCON_38420B4C4E0601400", "lastSeen": "Mon Dec 11 2023 19:54:30", "memory": 1024, "modelName": "Sonos Arc", "modelNumber": "S19", "name": "192.168.10.30", "role": "master", "satellites": [ "RINCON_F0F6C1C5C25201400", "RINCON_F0F6C1C5C25E01400", "RINCON_F0F6C1ED035001400", "RINCON_F0F6C1ED037801400" ], "sonosOs": "S2", "tvIn": true, "version": "15.10", "zone": "RINCON_38420B4C4E0601400", "zoneDisplayName": "Sonos Surround (+LR,LTR+RR,RTR+Sub+Sub)", "zoneGroup": "RINCON_38420B4C4E0601400", "zoneGroupName": "Sonos Surround", "zoneGroupShortName": "Sonos Surround", "zoneName": "Sonos Surround" }

ebaauw commented 7 months ago

Thanks, that explains it.

My Arc is paired with two Play:1 surround speakers and a single Sub, and displays as Living Room (+Sub+LS+RS). Consequently, Homebridge ZP is looking for +LS+RS in the zoneDisplayName to recognise that the Arc has surrounds configured.

It looks like the Sonos Era 300 is advertised as +LR,LRT and +RR,RTR, maybe because it does 7.2 surround? Left Rear and Left Top Rear? This is also the first time I come across a dual-Sub setup. Could you please post screenshots of the Surround Audio and Sub Audio screens in the Sonos app? These are under System | Products and then the Arc (I think you named it: Sonos Surround).

Also, if I may, this is the first time I come across the Era 300. Could you please list the zp -H x.x.x.x info -v output for one of these?

ElfixHS commented 7 months ago

Yea, I think your assumption are correct, both the Era 300 and the Era 100 provide upfiring sound and are capable of Dolby Atmos. Like the Arc, they also provide additional channels for top rear sound.

Here are the screenshots, if needed I could also switch the language settings of my phone to English

photo_2023-12-11_20-36-15 photo_2023-12-11_20-36-22

And the command output for the Era 300s. I am happy to help and provide any additional information in case you need any. Love the Homebridge plugin and I am happy if I can contribute my part:

{ "address": "192.168.10.29", "bootSeq": 9, "channel": "RR,RTR", "homeTheatre": true, "household": "Sonos_yqsA13gJtaKBfMkedfjluMP2in", "id": "RINCON_F0F6C1C5C25E01400", "invisible": true, "lastSeen": "Mon Dec 11 2023 20:41:18", "memory": 2048, "modelName": "Sonos Era 300", "modelNumber": "S41", "name": "192.168.10.29", "role": "satellite", "sonosOs": "S2", "version": "15.10", "zone": "RINCON_38420B4C4E0601400", "zoneDisplayName": "Sonos Surround (+LR,LTR+RR,RTR+Sub+Sub)", "zoneGroup": "RINCON_38420B4C4E0601400", "zoneGroupName": "Sonos Surround", "zoneGroupShortName": "Sonos Surround", "zoneName": "Sonos Surround" }

ebaauw commented 7 months ago

Here are the screenshots, if needed I could also switch the language settings of my phone to English

Thanks. That's OK, I read German, just no experience writing it. Those are the same settings as I have, so apparently no differences between the 5.1 and the 7.2 surround settings.

And the command output for the Era 300s

Thanks. Apart from the channel, I see no weirdness. I'll map the channels RR,RTR to RS and LR,LTR to LS, and then your setup should be recognised.

I am happy if I can contribute my part

If, by chance, you have the Era 300 in a stereo pair setup or if you have an Era 100, I'd love to see their zp info -v output as well. Sonos has been bombarding me past couple of weeks with spam mails full of discounts, but not for the Era 100 nor Era 300. I trying to resist the temptation and to hold off until next year's black Friday.

ebaauw commented 7 months ago

In v1.4.41.

ElfixHS commented 7 months ago

Update:

Okay, tested it just now and everything works like a charm. Thank you so much for implementing it so fast. This saves me a few annoying clicks every day within the app after changing to night sound. Ignore my comment below regarding the double subs.


I will test v1.4.41 in a few minutes. Without having tested it, maybe the representation of double subs might screw it over? This is a screenshot of how that looks like in the app.

I don‘t have Era 100s, but I can help with the stereo pair. Does that mean I need to remove them from the current setup and set them up independently from the Arc?

I can feel your temptation, I had to give in myself a few weeks ago :‘)

IMG_7859

ebaauw commented 7 months ago

Without having tested it, maybe the representation of double subs might screw it over? This is a screenshot of how that looks like in the app.

Thanks, I’ll have a look. I don’t think I use the zoneDisplayName in HomeKit, but I would still like it to match the Sonos app. This isn’t reported by the speakers themselves, but rather compiled from the topology. I already noticed that I use an extra + at the start, and my Living Room shows the Sub before the surrounds - probably due to the order in which the satellite speakers are discovered.

I don‘t have Era 100s, but I can help with the stereo pair. Does that mean I need to remove them from the current setup and set them up independently from the Arc?

You would need to remove them as surround speakers, after which they appear as separate zones (products in the system settings). After creating a stereo pair, they would appear as one zone with (L+R) added to the name. This is perfectly reversible by breaking the stereo pair and re-adding them as surround speakers. You would need to re-tune trueplay afterwards. And I would shutdown Homebridge ZP while doing this, as it might try to adjust how the Arc is exposed, losing the surround characteristics, causing HomeKit to lose the corresponding automation. Basically a lot of work, I understand if you don’t want to mess with your setup (if it ain’t broke, …).

ElfixHS commented 7 months ago

No big deal, you saved me a ton of inconvenience by implementing the feature, helping you with the stereo pair is the least I can do. I will try it later today and post the output here.

While we are at it: Is there any specific reason that properties such as the surround sound level/sub level are only displayed in the „speaker“ accessory and not in the „sonos“ accessory? To be honest, I don‘t really get the difference between the two, other than that the „speaker“ only appears when checking the checkbox in homebridge which says something like „add additional speaker for each zone“. Is one for the basic speaker properties and the other one for the more advanced stuff?

ebaauw commented 7 months ago

It’s a bit theoretical in your case, as you only have one zone (room). If you have multiple zones, you might group them, for multi-room audio. That was actually the trigger why I wrote Homebridge ZP: I want my music to follow me through my home. I use HomeKit automations for a zone to join a zone group when I enter a room, and to leave the zone group when a room is empty.

The Sonos service corresponds to the zone group, the Speaker service to the zone. Changing the input, next/previous track, play/pause, shuffle, repeat, etc all act on the zone group. Adjusting the audio settings only acts on a single zone. Changing the volume on the Sonos service will change it on all zones in the zone group, while changing the volume on the Speaker service only changes it on the corresponding zone.

It might seem more natural to have separate accessories for zones vs zone groups, but HomeKit doesn’t like configuration changes. And you would lose automations on zone groups when they disappear. I tried to explain this in the README, but I guess it’s a bit abstract with only one zone.

ebaauw commented 7 months ago

zoneDisplayName should be fixed in v1.4.43.

ElfixHS commented 7 months ago

Sorry, I could not find the time to generate the output today. I will see if I have the time tomorrow, otherwise it might have to wait until the weekend.

ebaauw commented 7 months ago

No hurry.

ElfixHS commented 7 months ago

It’s a bit theoretical in your case, as you only have one zone (room). If you have multiple zones, you might group them, for multi-room audio. That was actually the trigger why I wrote Homebridge ZP: I want my music to follow me through my home. I use HomeKit automations for a zone to join a zone group when I enter a room, and to leave the zone group when a room is empty.

The Sonos service corresponds to the zone group, the Speaker service to the zone. Changing the input, next/previous track, play/pause, shuffle, repeat, etc all act on the zone group. Adjusting the audio settings only acts on a single zone. Changing the volume on the Sonos service will change it on all zones in the zone group, while changing the volume on the Speaker service only changes it on the corresponding zone.

It might seem more natural to have separate accessories for zones vs zone groups, but HomeKit doesn’t like configuration changes. And you would lose automations on zone groups when they disappear. I tried to explain this in the README, but I guess it’s a bit abstract with only one zone.

Thanks for the explanation, that makes a lot more sense now and the music following through the rooms seems to actually be a pretty cool feature. I might need more speakers now...

As promised, here are the outpus of zp -H x.x.x.x info -v for the master and the slave speaker, which is two Era 300s as a stero pair:

Master:

{ "address": "192.168.10.29", "airPlay": true, "audioIn": true, "balance": true, "bootSeq": 10, "channel": "L", "household": "Sonos_yqsA13gJtaKBfMkedfjluMP2in", "id": "RINCON_F0F6C1C5C25E01400", "lastSeen": "Wed Dec 13 2023 17:51:17", "memory": 2048, "modelName": "Sonos Era 300", "modelNumber": "S41", "name": "192.168.10.29", "role": "master", "slaves": [ "RINCON_F0F6C1C5C25201400" ], "sonosOs": "S2", "stereoPair": true, "version": "15.10", "zone": "RINCON_F0F6C1C5C25E01400", "zoneDisplayName": "Wohnzimmer 3 (L+R)", "zoneGroup": "RINCON_F0F6C1C5C25E01400", "zoneGroupName": "Wohnzimmer 3", "zoneGroupShortName": "Wohnzimmer 3", "zoneName": "Wohnzimmer 3" }

Slave: { "address": "192.168.10.23", "audioIn": true, "balance": true, "bootSeq": 11, "channel": "R", "household": "Sonos_yqsA13gJtaKBfMkedfjluMP2in", "id": "RINCON_F0F6C1C5C25201400", "invisible": true, "lastSeen": "Wed Dec 13 2023 17:52:16", "memory": 2048, "modelName": "Sonos Era 300", "modelNumber": "S41", "name": "192.168.10.23", "role": "slave", "sonosOs": "S2", "stereoPair": true, "version": "15.10", "zone": "RINCON_F0F6C1C5C25E01400", "zoneDisplayName": "Wohnzimmer 3", "zoneGroup": "RINCON_F0F6C1C5C25E01400", "zoneGroupName": "Wohnzimmer 3", "zoneGroupShortName": "Wohnzimmer 3", "zoneName": "Wohnzimmer 3" }

ebaauw commented 7 months ago

here are the outpus of zp -H x.x.x.x info -v for the master and the slave speaker, which is two Era 300s as a stero pair

Thanks. That’s looking good - no weird channels.

I might need more speakers now...

Sonos is the most dangerously addictive gadget I’ve ever bought. You always need more. I think their deal with IKEA is brilliant: you buy a cheap SYMFONISK speaker as gateway drug into their ecosystem, and then you’re hooked.

ElfixHS commented 7 months ago

Thanks again for the rapid implementation! Solved all issues that I had.