Local volume control skill?

Does anyone have a skill, sample script or suggestion to adjust/set the local volume?
I’m looking to implement something like “Turn yourself up” or “Set your volume to 50%”.

I’m also wanting to set the volume based on time of day as well. That way it’s not shouting after the kids are in bed.

1 Like

I’m on it - just need to figure out where snips stores the used output device ^^

I’m sure @Psycho already has something like this in his Alice code… check his github

True, I did it for Alice. The satellites volume goes lower after we told Alice that we are going bed and even lower once we tell her good night

mixer = alsaaudio.Mixer('PCM')

Awesome, thank you!

It suddenly occurred to me that this won’t directly work on the satellites. Are you doing anything to voice adjust volume on satellites? Any suggestions?
I’m leaning towards just moving the volume control to Hass and bounce everything through that.

Satellites would need that skill as well - not as part of an own assistant(with asr etc) but just by installing that one skill to react on the intent locally. And the skill has to make sure to only trigger for the correct siteID -> the central HUB must ignore that Intent for its Satellites!

My Problem with the coding @Psycho is, that I have to determine the value of ‘PCM’

I’m not sure I’m following how to trigger the skill on the satellites without having the satellite’s skill server fire for all the other skills (or at least try). Even if that’s the only skill installed, wouldn’t it still be listening and trying to fire for other skills?

yeah, it would fire for every other intent as well - but you can then decide by having a look at the siteId if it is meant for that satellite

you would need to create a new script or code that just runs locally on the satellite that listens for that intent… and when it gets that intent, check to see if the siteId matches the satellite and if so then run the code locally

That or your app skill listens for the intent and sends its own mqtt message like satellite/sound/<ID>/down_or_up
And then again with your own other code/script listening to just the topic satellite/sound/ID would control the vol

yep, I’m running code on the satellites that listen for mqtt messages sent by the main unit and filter them by siteId

@Psycho and others: in your experience, when creating a feature like this, what’s the best way to do it?

Option A

  • Create an intent for up_and_down, with custom slot that has ‘up’ and ‘down’.
  • Create an intent for specific_level, which can directly set the intended level. For example: “set the volume to 30%” or “turn up the volume to 11”. It would probably need a percentage and number slot (or would you just use a single number slot?)

Option B

  • Create a single volume_control intent that handles both of the above in a single intent?

Now, another question.

Let’s say you went with option A and wanted to add an ‘turn the audio off’ ability. How would you do it?
A. Would you create a completely new audio on and off intent?
B. Would you add it to the up_and_down intent (since its sentence structure is so similar), and simply add ‘off’ and ‘on’ to the custom slot? or add a new boolean slot?
C. Would you add it to the ‘specific level’ intent, and treat ‘off’ as ‘zero’?

I’d make a skill to control my sound, with intents for defined user intentions. So volume up down is an intent (and setting at specified volume is another), that has nothing to do with turning sound on/off except it targeting the same, a sound system.

Thanks. So basically you’d make three different intents.