Disable Google Home casting sound

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?

The “wait for idle” step doesn’t progress. Is this still working for others?

THis works pretty well for a single speaker but not when broadcasting to a group.

alias: Disable GA chime test
sequence:
  - service: media_player.volume_set
    data:
      volume_level: 0.005
    target:
      entity_id:
        - media_player.downstairs_speakers
  - service: tts.google_cloud_say
    data:
      entity_id: media_player.downstairs_speakers
      message: helloooooo there.  This is a test of the broadcast.
  - service: media_player.volume_set
    data:
      volume_level: 0.3
    target:
      entity_id: media_player.downstairs_speakers
mode: single

Actually, it may be because of the lawsuit with Sonus and this:

1 Like

This does though. I now mirror my google speaker groups into HA groups (annoying but they don’t change much) and use those to drive the volume changes. Works most of the time. maybe 90%.

alias: TTS No Interrupt
sequence:
  - service: media_player.volume_set
    data:
      volume_level: 0.001
    data_template:
      entity_id: |
        {{ expand(target)| map(attribute='entity_id') | join(', ') }}
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 300
  - service: tts.google_cloud_say
    data:
       message: |
         {{message|default('Test Message',true) }}
    data_template:
      entity_id: |
        {{target.replace('group.','media_player.')}}
  - service: media_player.volume_set
    data:
      volume_level: |
        {{ volume | default('0.5') }}
    data_template:
      entity_id: |
         {{ expand(target)| map(attribute='entity_id') | join(', ') }}
mode: parallel
fields:
  message:
    description: Message to send
    example: This is a message
  target:
    description: The group/entity to broadcast to
    example: group.downstairs_speakers
  volume:
    description: Specify target volume
    example: 0.5
3 Likes

Hi @keithcroshaw,

Where you able to disable chime using a node in node-red? If you did could you share how you did it?

Remind me.

It didn’t really work. Often it would fail to turn the volume back up before TTS. That was a while ago. Used to it now.

FYI the original didn’t work for me as it still made the “wakeup” chime sound after the choose action. I had to add 1 second long delay after the second mute in the sequence and then it works (you could still hear the chime sound very little when waiting just 800ms).

alias: Prepare speaker without sound
sequence:
  - choose:
      - conditions:
          - condition: state
            entity_id: media_player.nestmini5073
            state: "off"
        sequence:
          - service: media_player.volume_mute
            data:
              is_volume_muted: true
            target:
              entity_id: media_player.nestmini5073
          - service: media_player.turn_on
            target:
              entity_id: media_player.nestmini5073
            data: {}
          - wait_template: "{{ is_state('media_player.nestmini5073', 'idle') }}"
      - conditions:
          - condition: state
            entity_id: media_player.nestmini5073
            state: idle
        sequence:
          - service: media_player.volume_mute
            data:
              entity_id: media_player.nestmini5073
              is_volume_muted: false
    default: []
  - service: media_player.volume_mute
    data:
      is_volume_muted: true
    target:
      entity_id: media_player.nestmini5073
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: media_player.volume_set  # you can remove this one to keep the previous volume
    data:
      volume_level: 0.5
    target:
      entity_id: media_player.nestmini5073
  - service: media_player.volume_mute
    data:
      is_volume_muted: false
    target:
      entity_id: media_player.nestmini5073
mode: single
1 Like

Hello,

Could you help me to apply thoses scripts ?
How proceed?

I created an automation to launch youtube river and birds sings when movement is detected in my toilets.

The action is

service: media_player.play_media
target:
  entity_id: media_player.ytube_music_player
data:
  media_content_id: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
  media_content_type: playlist
metadata:
  title: SDB
  thumbnail: >-
    https://lh3.googleusercontent.com/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  media_class: playlist
  children_media_class: track
  navigateIds:
    - {}
    - media_content_type: library_playlists
      media_content_id: ""
    - media_content_type: playlist
      media_content_id: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

How can i remove the litle google chim ?

Thanks !

I updated the script originally shared to include friendly fields when using the script in your automations.

  1. Copy the script below.
  2. Create a new script in HA.
  3. Go to the … menu and select Edit in YAML.
  4. Select everything and Paste the script you copied from below.
  5. Use the “Cast Media…” script as an action in your automations.
alias: Cast Media with no Chime 🔕
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ is_state(media_file.entity_id,'off') }}"
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: "{{ media_file.entity_id }}"
            data:
              volume_level: 0
          - service: media_player.turn_on
            target:
              entity_id: "{{ media_file.entity_id }}"
            data: {}
          - if:
              - condition: template
                value_template: "{{ not is_state(media_file.entity_id, 'idle') }}"
            then:
              - wait_template: "{{ is_state(media_file.entity_id, 'idle') }}"
                timeout: "0:00:05"
      - conditions:
          - condition: template
            value_template: "{{ is_state(media_file.entity_id, 'idle') }}"
        sequence: []
  - service: media_player.volume_set
    target:
      entity_id: "{{ media_file.entity_id }}"
    data:
      volume_level: "{{ volume }}"
  - service: media_player.play_media
    target:
      entity_id: "{{ media_file.entity_id }}"
    data:
      media_content_id: "{{ media_file.media_content_id }}"
      media_content_type: "{{ media_file.media_content_type }}"
mode: single
fields:
  media_file:
    selector:
      media: {}
    name: Media File
    required: true
  volume:
    selector:
      number:
        min: 0
        max: 1
        step: 0.05
    name: Volume
    default: 0.5
    required: true

Hi @djahren

I tried your script, but I get an error:

alias: Cast Media with no Chime 🔕
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ is_state(media_file.entity_id,'off') }}"
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: "{{ media_file.entity_id }}"
            data:
              volume_level: 0
          - service: media_player.turn_on
            target:
              entity_id: "{{ media_file.entity_id }}"
            data: {}
          - if:
              - condition: template
                value_template: "{{ not is_state(media_file.entity_id, 'idle') }}"
            then:
              - wait_template: "{{ is_state(media_file.entity_id, 'idle') }}"
                timeout: "0:00:05"
      - conditions:
          - condition: template
            value_template: "{{ is_state(media_file.entity_id, 'idle') }}"
        sequence: []
  - service: media_player.volume_set
    target:
      entity_id: "{{ media_file.entity_id }}"
    data:
      volume_level: "{{ volume }}"
  - service: media_player.play_media
    target:
      entity_id: "{{ media_file.entity_id }}"
    data:
      media_content_id: "{{ media_file.media_content_id }}"
      media_content_type: "{{ media_file.media_content_type }}"
mode: single
fields:
  media_file:
    selector:
      media: {}
    name: Media File
    required: true
    default:
      entity_id: media_player.nest
      media_content_id: media-source://tts/tts.google_en_com?message=This+is+a+test&language=en
      media_content_type: provider
      metadata:
        title: This is a test
        thumbnail: https://brands.home-assistant.io/_/tts/logo.png
        media_class: app
        children_media_class: null
        navigateIds:
          - {}
          - media_content_type: app
            media_content_id: media-source://tts
          - media_content_type: provider
            media_content_id: >-
              media-source://tts/tts.google_en_com?message=This+is+a+test&language=en
  volume:
    selector:
      number:
        min: 0
        max: 1
        step: 0.05
    name: Volume
    default: 0.5
    required: false

It looks like you probably didn’t use the script as an action in an automation. When you do that, you select the target and the media file. I Tested it and it works ok, I still hear a little tone if the speaker was idle. There is a little delay but not too bad. I wish there was a way to just directly play an audio file using the Google Assistant SDK instead of casting.

I know this is an older thread, but I’m wondering if anyone has figured out how to mute the beep from the Nest Mini when the volume gets adjusted. OP’s script for muting the power-on chime worked perfectly, but I’m still left with the volume blip.

Hello! Thanks for the script. I put in a silent mp3 and it plays, but you can still hear a volume adjustment sound, a small beep sound. How else could this be turned off?

As far as I know, this is native to the Nest mini speaker, as it’s the same sound when manually adjusting the volume using the touch buttons on the speaker.

If there were any hope of disabling that, I’d look at native solutions in the speaker to do so, or search for info regarding the Nest mini speaker, completely outside of Home Assistant. At a glance from the speaker settings itself, I’m not able to find anything. But I’d be curious to know if someone else is able to dig up any info on this.

I wasn’t sure of the issue at first but taking another look at this I think I may know what’s going on. It appears as if you are filling out the script from the script edit page. The script is meant to be used within other automations or scripts and the fields are filled out within the automation. Doing so should ensure the fields are filled out correctly.

I did notice a bug which I’ve edited. volume: required should be set to true, not false, as all fields need to be filled out.