Disable Google Home casting sound

When I first started integrating my Nest Minis to Home Assistant, I noticed that the speaker always plays a short chime whenever HA tries to connect it. This ruins my doorbell automation, which plays a custom doorbell chime when the doorbell is pressed.

I checked out this thread which was able to disable the sound and while it does offer a nice workaround, it feels a bit tedious to configure with the idle and off timing frequency of the Nest minis.

After messing around for a while, I was able to come up with a short and simple solution with a script:

alias: Disable google cast sound
sequence:
  - choose:
      - conditions:
          - condition: state
            entity_id: media_player.$PLAYER
            state: 'off'
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: media_player.$PLAYER
            data:
              volume_level: 0
          - service: media_player.turn_on
            target:
             entity_id: media_player.$PLAYER
          - wait_template: '{{ is_state(''media_player.$PLAYER'', ''idle'') }}'
      - conditions:
          - condition: state
            entity_id: media_player.$PLAYER
            state: idle
        sequence: []
    default: []
  - service: media_player.volume_set
    target:
      entity_id: media_player.$PLAYER
    data:
      volume_level: $VOLUME_LEVEL
  - service: media_player.play_media
    target:
      entity_id: media_player.$PLAYER
    data:
      media_content_id: '$AUDIO_URL'
      media_content_type: audio
mode: single

How it works:

  1. Check if Nest Mini is either off or idle. If it is idle, skip to step 5.

  2. If Nest Mini is off, set its volume to 0%.

  3. Turn on the Nest Mini with Home Assistantā€™s call service.

  4. Wait for the state of the Nest Mini to change from off to idle.

  5. Once it is idle, set the volume to whichever you desire.

  6. Audio is played on the Nest Mini without cast sound successfully.

Hope this helps anyone facing this issue! :smile:

13 Likes

Iā€™ve been doing this in Node-Red for a little while now. Nice little work around.

How about this idea? My change below splits off the play-audio part so you can use this script also when you want to do other things, for example TTS.

As i could test it, it will mute the volume instead of setting it to ā€˜0ā€™; also preventing the casting sound to appear. Then, once it becomes ā€˜idleā€™ it will unmute and continue with the flow. In the next part, it will again mute (so the one in the condition might be optional) and set the volume level so you donā€™t hear the volume change sound, as last step it will unmute and be ready for you to cast/play audio.

ready_cast_with_set_volume:
description: Ensures a Google Home device is activated with a pre-set volume
sequence:
  - choose:
      - conditions:
          - condition: state
            entity_id: media_player.$PLAYER
            state: 'off'
        sequence:
           - service: media_player.volume_mute
             data:
              entity_id: media_player.$PLAYER
              is_volume_muted: true
          - service: media_player.turn_on
            target:
             entity_id: media_player.$PLAYER
          - wait_template: '{{ is_state(''media_player.$PLAYER'', ''idle'') }}'
      - conditions:
          - condition: state
            entity_id: media_player.$PLAYER
            state: idle
        sequence:
           - service: media_player.volume_mute
             data:
              entity_id: media_player.$PLAYER
              is_volume_muted: false
    default: []
  - service: media_player.volume_mute
      data:
      entity_id: media_player.$PLAYER
      is_volume_muted: true
  - service: media_player.volume_set
    target:
      entity_id: media_player.$PLAYER
    data:
      volume_level: $VOLUME_LEVEL
  - service: media_player.volume_mute
      data:
      entity_id: media_player.$PLAYER
      is_volume_muted: false
mode: single

@Codestian feedback?

4 Likes

The only thing i notice is that volume changes also have a small ā€˜bloobā€™ feedback; still have to get rid of that.

Volume up seems to bloop, but volume down does not. Or was it the other way around? Not quite sure

That is interesting, i can check that.

Never thought of muting it instead of setting volume to 0%. Both methods do work as intended, though muting will restore the state of the previous volume, which can be convenient. Will try it out.

I think we will have to live with the volume boop sound effect, thereā€™s no setting to disable it from Googleā€™s end.

Where does $PLAYER come from? Is this a parameter from a automation service call? Parameter are in {{ }} so I donā€™t understand.

$PLAYER is just a placeholder for your media_player entity

2 Likes

Hello, I was wondering if there has been any update to this? Iā€™ve currently set my similar script automation up, and I canā€™t get rid of the new speaker startup sound that google has set. It sounds different than the old chime, so I was wondering if you are having any issues with this now, or this work-around is still working for you?

Iā€™ve got it set up and working as a script, and it does work, but it doesnā€™t stop the google start-up chime, just mixes in with it.

Hello, could someone explain how or where i could use this code snippet? Iā€™d like to get rid of that sound also

Have you, has anyone tried this with a list of media players or with a google generated group of players?
Iā€™m going to play with that today unless someone else has adviceā€¦
Want to incorporate it in my blueprints hopefully.
https://community.home-assistant.io/t/script-blueprint-for-google-translate-say-and-tts-cloud-say-message-not-an-automation-blueprint/333199

Update, Iā€™ve given up. It seems that it will only work if you keep the speakers in playing mode all the time.
Also My speakers never appear to go into idle mode, just off and playingā€¦
Someday maybeā€¦

Oh, the set volume to zero I think only works if you set that to very low volume, volume 0 = mute and that changes the behavior. I have me speakers set to all kinds of levels for different areas, so unless I can capture that Iā€™m not going there.

1 Like

Iā€™ve added the script and created an automation which starts the script, however it only works if the Google Home is in idle, and not off. Anyone know what could be the problem here?

I canā€™t seem to get either examples to work - regardless, the chime playsā€¦ has anyone gotten this to work?

Like @Poyaan says, this only seems to work if the Google devices is in IDLE state but most of the time, these devices should be in OFF state?

Also, getting IDLE state for a Google Audio Group doesnā€™t seem to work, but that is a separate issue.

I canā€™t even find idle. All I see is playing and off.

This seems to work for me even if the media_player is off

EDIT: It works for TTS but not if you play media for some reason. I hear a little part of the chime but not all of it.

alias: Disable GA chime test
sequence:
  - service: media_player.volume_set
    data:
      volume_level: 0.005
    target:
      entity_id: media_player.sovrum_hogtalare
  - service: tts.google_translate_say
    data:
      entity_id: media_player.sovrum_hogtalare
      message: TEST TEST TEST
      language: sv
  - service: media_player.volume_set
    target:
      entity_id: media_player.sovrum_hogtalare
    data:
      volume_level: 0.3
mode: single

EDIT2: I have this old script used as a wake up radio. Here I donā€™t here the chime at all even if the entity is off. Maybe if one but some silence in the clip to play and just slowly turns the volume up it would help?

alias: šŸ“» Wake up radio
sequence:
  - service: media_player.volume_set
    data:
      volume_level: 0.005
    target:
      entity_id: media_player.sovrum_hogtalare
  - service: media_player.play_media
    data:
      media_content_id: https://sverigesradio.se/topsy/direkt/132-hi-mp3.mp3
      media_content_type: music
    target:
      entity_id: media_player.sovrum_hogtalare
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - repeat:
      while:
        - condition: template
          value_template: >-
            {{ state_attr('media_player.sovrum_hogtalare','volume_level') |
            float(0)< 0.10 and
            is_state('media_player.sovrum_hogtalare','playing') }}
      sequence:
        - service: media_player.volume_set
          data:
            volume_level: >
              {{ state_attr('media_player.sovrum_hogtalare',
              'volume_level')|float + 0.005 }}
          target:
            entity_id: media_player.sovrum_hogtalare
        - delay:
            hours: 0
            minutes: 1
            seconds: 30
            milliseconds: 0
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - service: media_player.media_stop
    target:
      entity_id: media_player.sovrum_hogtalare
mode: single

How do you handle the equivalent of wait_template

My trigger that started it was when the speaker goes to idle:
image
I just used the Events: State node.

Its easy mute this sound in Nodered. If you want play sound, do 2 action paralel together.

  1. set up volume to zero and let the sound play.
  2. wait until player status is ā€œplayingā€ and in this moment set uo volume to desired value.

4 Likes

How are you using this? Do you add the script to the start of the actions for any automation casting to a Google speaker? Or is there a way to integrate this more generally you you donā€™t need to add it to each automation using a Google speaker?