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:
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
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
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.
- Copy the script below.
- Create a new script in HA.
- Go to the … menu and select Edit in YAML.
- Select everything and Paste the script you copied from below.
- 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: false
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.