First off, great work! This is a fantastic card, just what I've been wishing for to control Sonos, and well worth the move to Lovelace on its own.
A feature request: Following on from the Sonos group volume sync added in response to #48, please add the option to set a volume offset for individual players. Something like:
sync_volume_offset: [value]
A card configuration might look something like:
- type: 'custom:mini-media-player'
entity: media_player.dining_room
hide:
icon: true
power: true
source: false
artwork: cover
sonos:
expanded: true
sync_volume: false
entities:
- entity_id: media_player.kitchen
name: Kitchen
sync_volume_offset: 5 [5 levels louder than the group master]
- entity_id: media_player.living_room
name: Living Room
sync_volume_offset: -3 [3 levels quieter than the group master]
- entity_id: media_player.bedroom
name: Bedroom [No offset specified, so same volume as group master]
A use case example: I have a number of regular Sonos speakers plus one Connect Amp connected to a pair of non-amplified speakers (Kitchen). At any given volume level (for example, level 10) the Kitchen speakers sound quieter than the speakers in the rest of the house. To compensate, I set the Kitchen speakers to 5 volume levels higher than the speakers in the rest of the house. Once I've done that, the volume slider for the group in the Sonos app maintains the relative volume difference between the speakers.
I like the example config. An offset in each Sonos entity object makes sense.
I'll see what can be done, right now changing the volume will send a single service call to the backend. In order for this feature to work, it would have to be changed to one service call for every Sonos entity with an offset set.
Thanks. Let me know if you need a tester!
On Thu, Feb 21, 2019 at 1:54 PM Karl Kihlström notifications@github.com
wrote:
I like the example config. An offset in each Sonos entity object makes
sense.I'll see what can be done, right now changing the volume will send a
single service call to the backend. In order for this feature to work, it
would have to be changed to one service call for every Sonos entity with an
offset set.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/kalkih/mini-media-player/issues/88#issuecomment-466007591,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALznEzzuogxm7nljZtnGYq6tSke6ZHyaks5vPqUZgaJpZM4bHWzN
.
I noticed something today about how the Sonos app displays a group volume adjustment. As you can see in the video at this link https://photos.app.goo.gl/bvnHr3Q5FwqJhBuF9, it looks the volume is adjusted not in perfect sync but with a bit of lag. You can see that especially on the Kitchen line. Maybe that's just a UI issue, or maybe it's a clue that the volumes are actually adjusted individually and not quite simultaneously.
Okay, then they are most likely adjusted individually by the HA backend, I haven't looked into the backend enough to say for sure though.
I'm however only sending one service call from the card to the HA backend to change the volume for all players, (this is what I would have to change for this feature).
I know it's been a few days, I'll try to get this done asap! 😬
LOL. Not meaning to hound you. I can be patient. ;-) Really appreciate it!
New release available, with a new volume_offset option for the sonos entity object v1.0.3, I was only able to run simulated tests fort his feature, since I don't own any sonos devices.
Please let me know if you have any issues with it.
Really appreciate the addition, but it 's not quite working. The effect of setting volume_offset is unpredictable. I think that it worked as expected once in dozens of tests I made. Other times, all speakers except the coordinator were offset and other times random speakers were offset together. Whatever particular behavior that kicked off when the config file was edited for a new volume_offset persisted until the config file was edited again. Here's a video showing what happens: https://photos.app.goo.gl/CpNjgR8r9H12mJTd9
In the video, volume_offset works as expected the first time I edit the config, but that's just coincidence. That's the only time it worked as expected.
I don't know JavaScript, but I'd be happy to give some code editing and testing a shot if you'd like, and you point me in the right direction.
Thanks for the video, looks like the behavior is more or less random, very strange.
I'll see if I can find what's causing this.
This card is a bit harder to edit manually than most other cards, since it requires a build process.
I just updated the developer instructions so they are up to date if you want to give it a shot. You can find the instructions here.
The logic for volume change can then be found in src/model.js at the following lines:
https://github.com/kalkih/mini-media-player/blob/ac290c3c508ed3f492d62620da9e0a64ff102664/src/model.js#L213-L234
We basically loop through all entities in the current sonos group, look for their entry in the sonos -> entities config object, look if volume_offset exists and applies the offset before calling the volume_set service.
While I wrote this I think I found the issue, and I feel pretty dumb, we are reassigning the initial volume value with every grouped entity we loop though. 😞
I'm not home today, but I'll fix this tonight/tomorrow, could I possibly send you a test version and have you verify and make sure it works?
Thanks!
Sure. I'll test a trial version and let you know how it goes.
Great, I'll let you know when I got it ready.
@ronschaeffer
Here's a new build including the (potential) fix 55f3f54b42ae66e1b5dc86dc8b9eafa049d6d3e8
https://gist.github.com/kalkih/9f2b1571accb417f0e5713a19b6e9461#file-mini-graph-card-bundle-js
Great, thanks. Getting late here, so I'll try it in the morning.
Hi, Karl - The code has lost all formatting in the gist--it's all on one
line. I tried pasting into VS Code and forcing the syntax, but no luck.
Repost or send? My email is [email protected]
On Fri, Mar 8, 2019 at 10:23 PM Karl Kihlström notifications@github.com
wrote:
@ronschaeffer https://github.com/ronschaeffer
Here's a new build including the (potential) fix 55f3f54
https://github.com/kalkih/mini-media-player/commit/55f3f54b42ae66e1b5dc86dc8b9eafa049d6d3e8https://gist.github.com/kalkih/9f2b1571accb417f0e5713a19b6e9461#file-mini-graph-card-bundle-js
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kalkih/mini-media-player/issues/88#issuecomment-471096779,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALznE-s2hCwnz79YzO3fOtJ5EvrRng2pks5vUuLngaJpZM4bHWzN
.
@ronschaeffer
The code is transpiled and minified like the regular release builds, so all is good.
Just replace your current one with the one I linked you.
OK, now I'm feeling stupid. ;-)
Success! It works as expected. Here's a vid: https://photos.app.goo.gl/ewjqpFmk7ZmZQVK28
Great, seems to be relatively responsive as well!
Thanks for helping me test this.
The fix will be included in the next release, feel free to continue using the bundle I sent you in the meantime.
Will do. Thanks again for the great add.
On Sat, 9 Mar 2019, 18:13 Karl Kihlström, notifications@github.com wrote:
Great, seems to be relatively responsive as well!
Thanks for helping me test this.
The fix will be included in the next release, feel free to continue using
the bundle I sent you in the meantime.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kalkih/mini-media-player/issues/88#issuecomment-471207832,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALznE4okEOa2pn5OTFCvZ3eOuv2SA66Bks5vU_nbgaJpZM4bHWzN
.
Fix for this issue is now available with the latest release