OH3 Chromecast Volume control

  • Platform information:
    • Hardware: AMD64
    • OS: Windows 10/10.0 (amd64)
    • Java Runtime Environment: Azul Systems, Inc. 11.0.12 (Zulu11.50+19-CA)
    • openHAB version: openHAB 3.2.0.M1

Hi All

I am having issues setting the volume of my Google Home Minis via the Chromecast binding.

The volume changes seem to revert after a few seconds and I am not sure why.

Couple of scenarios used for testing/debugging.

Simple rule based change to only adjust the volume via the volume channel:

rule "Test Say"
        Item Test_Say received command ON

Results in the following:

14:30:56.520 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Test_Say' received command ON
14:30:56.535 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Test_Say' changed from OFF to ON
14:30:56.535 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeSpeaker_Volume' changed from 12 to 100
14:30:56.535 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Test_Say' changed from ON to OFF
14:31:02.949 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeSpeaker_Volume' changed from 100 to 12

The following rule which plays audio results in the audio fading out during the playSound as the volume reverts. The sound file is 6 seconds long.

rule "Test Say"
        Item Test_Say received command ON
        playSound("chromecast:chromecast:6df7deca73b62299e64480d680f5d95f","gun_1618.wav", new PercentType(100))

Logs as follows:

14:40:19.615 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Test_Say' received command ON
14:40:19.630 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Test_Say' changed from OFF to ON
14:40:22.160 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeSpeaker_Volume' changed from 12 to 100
14:40:27.253 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Test_Say' changed from ON to OFF
14:40:27.400 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeSpeaker_Volume' changed from 100 to 12

If I manually adjust the volume using the LoungeSpeaker_Volume item, the volume adjustment is maintained

The obvious issue with this is that the audio fades out before the playSound completes which makes adjusting the volume a pointless excercise.

I would prefer to use the LoungeSpeaker_Volume.postUpdate(100) as this removes the nuisance of the Google Home mini volume change jingle which I have seen a few posts about.

Any suggestions?


postUpdate only chnges the item in openHAB. It doesn’t send the command to the binding and further to the chromecast.
That’s why it reverts back. The binding reads the volume from the chromecast - which is unchanged - and re-updates the items.
You should use sendCommand. That one updates the item AND sends that value to the binding to be sent to the device.
Read further on the docs Rules | openHAB

Great, thank you. I always seem to get “caught” by that distinction.

The sendCommand option works great. However does still cause the volume change “jingle” - so my initial idea of trying to get rid of that does not happen.

Any idea how to adjust the volume “permanently” using the playSound("gun_1618.wav", new PercentType(100)) syntax? As that would be preferable if I cannot get rid of the jingle?


I’m afraid that “jingle” is the chromecast response when changing the volume. You’ll get that if you modify the volume directly on the device or using Google Home app, for example.
I don’t think you can circumvent that…

Make 2nd also linked to the chroemcast volume channel but set the profile to folllow don’t adjust things from this item though just use your original. this should get rid of your jitter