Setting volume of Google Home

Just in case anyone would find it helpful, you can set the volume of a GH using custom command, actuator, setVolume. But you must use the decimal option (string and number don't work). 100 seems to be full volume.


Wish we could set the voice to be used in a similar manner...

@Angus_M I tried setting the setVolume custom command using decimal and/or number and neither of them actually changed the volume of the speaker. I used the test custom command to set it at 100 and then looked at the device page for the speaker, did initialize, did refresh, but no change.
What did you do different to get yours to work?

I used decimal set to 100 and the volume maxed nicely for the next action in the sequence which was a TTS. I didn't have to do anything else. No reset etc. It's a Google Home Mini.

@Angus_M I tried the same thing and still didn't get the change. I will try deleting the custom command and create new or maybe just create a new with a different value using decimal and number and see which, if any, works. thanks

@Angus_M EDIT: Created 2 setVolume custom commands, one with 90 as a number and one with 90 as a decimal.

Created a rule with a button on a remote as a trigger and using one of the mini's. First used 90 as a number, no change to volume of mini on it's device page.

Using same rule I changed to 90 decimal and once again the volume on the mini did not change in it's device page.

So not sure why the volume isn't changing. Did notice that mediaSource shows 'none' for all the mini's I have.

@Angus_M @bravenel Ok, I think I might have found a reason or a connection to why it wasn't working. Neither of the custom commands would work until AFTER I put in some text and pressed Speak (which changed mediaSource from None to Hubitat) and that allowed it to speak. After the previous test I was able to set the volume on the mini using either number or decimal, both worked.
So it looks like mediaSource being None instead of Hubitat was the reason it didn't work correctly.


I've noticed the exact same thing on my Google Home Speakers lately (it was working fine before July 3rd).
But you have to be fast because mediasource does not stays on Hubitat for long.

Also I found it strange that now we must send a speak command before we can adjust the volume...a bug in the latest firmwares?

Anyone knows how to make Hubitat permanent for mediasource? (Initialize does not work and Speak
only makes it VERY temporary)

P.S. The setvolume works fine on my Google Hub (Chromecast Video). No need to send a Speak command.

And for those who need more info, this is what I'm getting when I try to change the volume:
java.lang.NullPointerException: Cannot invoke method setVolume() on null object (setVolume)

Getting exactly the same thing. Can't change volume on the device page unless I send a text to the device and then I see the mediaSource change from none to Hubitat. But TTS actions are still running fine regardless of the above.

And to really make it works in rules you must use the following actions :
speak() on GH
setVolume(##) on GH --> after a delay of 0:00:01

The delay is a must otherwise it won't work.

It's been working fine for me without a delay :smile: although I did notice when I came home tonight that my welcome message was at a softer volume than normal. I will try your suggestion!

mediasource is not updating fast enough, so you have to put a small delay to make sure it has switched to Hubitat before sending the setvolume action.

But again, do not use a long delay, because mediasource will switch back to none very fast.

1 Like

Oh yeah, it works nicely!
Thanks for the tip. Hopefully they fix this so that we don't have to cludge it in this manner.

Great :slight_smile:

And I'm sure they will

1 Like