Having trouble with media_player.volume_set

hi all,

I’ve been playing with a script I have to play a video on my tv from Youtube and I just found a few extra settings that I have been playing with.

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

I got the mute setting to work, but I cant get the volume control to work and i’m sure i’m missing something simple. been trying things for about 5 hours now and thought a fresh sset of eyes might help me.

thank you in advance .

here is what I have.

trees:
  alias: In the Forrest
  sequence:
  - service: media_player.volume_set
    data:
      entity_id: media_player.lounge_tv
      volume_level: '0.01'
  - service: media_extractor.play_media
    entity_id: media_player.chrome_cast
    data:
      media_content_type: video/youtube
      media_content_id: https://www.youtube.com/watch?v=MCuFfW3X324

Edit: it plays the video, just won’t turn up/down the volume

Isn’t a volume level of 0.01 inaudible?

The documentation indicates:

Float for volume level. Range 0…1

If 1 represents maximum volume (100%), 0.01 is just 1% of maximum volume.

Change it to 0.1 for 10% of maximum volume.

correct, so if it works it should be easy to hear and I can adjust this to suit later. but it keeps the volume level as it is with no change. this is the problem i’m trying to solve.

it makes no difference if i set it to 0 or 1 or anything in between the volume level remains the same.

Back to first principles. Strip the test down to bare-bones to confirm you can control the volume of your media_player. Go to the Services page, select the volume_set service, pick the lounge_tv entity, set the volume and click Call Service.

If that fails to work, there’s clearly a fundamental problem setting volume for your chosen platform.

thank you Taras ,

for some reason I was drawing a blank to the use of the Services tab. I tried it in there and nothing, but the strange thing ( to me anyway) is that I can use volume_mute, volume_up and volume_down without problem .

I was thinking as I type this that maybe a work around (all be it a bit Heath Robinson) would be to mute the sound then turn the volume up to the desired level in steps but then muting does not set it to zero, just cuts the feed (so to speak)…

more thought needed I think.

thank you

There’s a very good chance that your device does not post a volume level back to home assistant. If that’s the case, volume_set won’t work.

Best way to figure this out is, when you use volume up or volume down. Does the slider bar in the media player show a volume level? And if your answer is, “what volume slider”, then you have your answer.

TIL that Rube Goldberg wasn’t the only cartoonist famous for drawing “whimsical, overly complicated machinery”. :slight_smile:

1 Like

hi petro,

thank you for your post, on further looking i can’t actually find a volume slider in HA on any of my devices so i guess nothing I have supports volume_set. Oh well. this is always a work around i just need to find it, maybe just turn the volume down a few times to lower it.

thank you though

Yah, it’s super annoying to be honest. These devices must track the volume, i don’t know why they can’t add that to their api.

that would be to easy :wink: