Set media player volume using Alexa

Hi,

I’ve searched here but been unable to find anything about how to script telling Alexa to set a separate media player’s volume to a specific level specified in an Alexa voice command (such as “Alexa, set Denon volume to 40”.) Has anyone done this? It occurred to me that I could use input_number.volume to store the current volume and then create a script that adds a specific value to it, but I’d prefer to be able to specify the exact value in the voice command and have the HA script act on what it receives when called.

This already works out of the box. Your media player just needs to have a volume slider. It can’t be a media player that only has increase/decrease buttons.

Thanks, I know I can set the level to a specific amount in a script using media_player.volume_set, the question is how do I set up the script so it will accept a variable spoken level value from Alexa that can vary with each invocation of the script? Thus the idea is to have the script set the level value to variable X, where X is whatever spoken value Alexa heard?

Does the lack of responses to this question mean it cannot be done? That is, is it not possible to build a script with a value supplied at runtime?

It means you didn’t reply correctly. If you click the reply at the bottom of the thread, only the thread owner gets notified. Reply to a comment and the commenter gets notified.

1 Like

You don’t need to do that. You just need to expose a media_player to alexa that has the ability to use media_player.volume_set.

No scripts, no nothing.

Just say: “Alexa, set TV volume to 10%”

assuming your media_player is named “TV”.

2 Likes

The hardest part was exposing the entity to Alexa. Thanks!