Sonos Speakers - Auto Volume Adjustment


#1

In our household, almost everything (but unfortunately not everyone :grin:) is controlled by voice command. Some of us also tend to play our music at a higher volume during certain times of the day. Within our Sonos network, this can occasionally result in surprises if someone commands a speaker to start playing their favorite station, unaware that the previous user had the speaker blasting. In addition, some of our Sonos speakers are Alexa-enabled (or alternately, sometime later this year, Google Assistant-enabled) and issuing a voice command to a speaker that was stopped while playing at a higher volume can result in the speaker shouting back at you. The consequences of this can be particularly unpleasant if it happens late at night or early in the morning.

This piston will automatically adjust the level of any speaker to a preset level after it has been inactive for a pre-defined period of time. The user can set different preset levels for daytime and nighttime (and define the hours for each) by modifying the preference variables. The piston will NOT make adjustments to any active speakers at the onset of ‘daytime’ or ‘nighttime’ until they have been inactive for the user-defined period of time.

To accommodate grouped speakers, which adjust volume relative to the group ‘coordinator,’ the piston first sets all inactive speakers to zero before setting them to the desired presets, thus ensuring that the levels all match.

As a general note, where Sonos speakers have been paired for stereo, only the left speaker of the pair should be defined in the device variable.

See also:
Sonos Speakers - Dashboard Tiles
Sonos Speakers - Group Volume Adjustment via Voice Command


[Deprecated] Sonos Speakers - Group Volume Adjustment via Voice Command
[Deprecated] Sonos Speakers - Dashboard Tiles
10-Day Weather Forecast Tiles
#2

Great stuff. I do something similar but a little simpler. At 4:00am I reset all my Players to a predefined volume level without a check to see if they’re active (I just do it at 4:00am).

I was aware of the set level/volume and grouping issue so I always ungroup everything once I’m done using Sonos for the day (a pain). But I had not thought about setting to zero first. I tried that this morning but I’m not getting the desired result. My piston sets different Players to different levels so I’m not sure if there’s a solution where they are grouped in my case. What is happening is the set to zero is fine but as the piston resets the different volume levels for speakers that are still grouped any level the piston has already set on a player in that group is affected by the next volume set for the next player in the same group. That makes sense based on how Sonos handles grouped volumes I think.


#3

It does make sense, unfortunately. The current DTH has very limited capabilities and I haven’t yet found a reliable way to set specific individual volume levels among grouped speakers via WebCoRE. It may not be possible without an improved DTH that either permits individual adjustments to grouped speakers or allows us to group/ungroup.

Of course, my primary goal here was to eliminate those occasional loud surprises, and this piston achieves that at least. We’re all happier having a consistent baseline and adjusting up or down from there by voice command as desired.


#4

As an addendum to this post, it is now possible to set the volume of individual speakers within a group via IFTTT actions.


#5

Cool, I’ll take a look.

Thanks


#6

I finally implemented this IFTTT solution and it works great. No more ungrouping at the end of the day and I can reset volume on the fly no matter the current grouping (I have a virtual switch I can just trigger with Alexa :slight_smile: ).

Thanks again.