That site is awesome! Now I want to change my doorbell announcement as well.
It’s pretty good eh? Sometimes it takes some creative spelling and punctuation to get things to sound right, but well worth the effort.
I make 3 or 4 versions of each type of announcement, save the MP3 files to a directory in home assistant, and it randomly picks one of them to play for that announcement every time it’s triggered.
So my Rick Sanchez doorbell for example will say one of these :
- Seriously? Whoever is pushing that button is really starting to push MY buttons.
- Ding Dong Bi*ch, Someone is at the gate.
- Ding Dong Mother f***er, Someone rang the door bell
- Knock Knock Mother f***er, Someone’s at the door
Yeah I’m a big kid, and that makes me smile everytime I hear it
Other announcements are for things like when the front gate opens, the front gate closes, I leave the house, I arrive home…
Pretty funny when I take the car keys off the hook at the front door and open it, Rick says “Don’t let the door hit your a*se on the way out!” or “Watch out for Zombies!”
Do you mind sharing how you do this? I have a few TTS messages that choose a random sentence from a few options but not sure how it’s done using MP3 files.
Sorry about the delay in getting back to you…
ok, this is a rough list of what I did to get random mp3 announcements. Adjust for your use as needed… Some of this stuff might be there already, but I’ll list it all so you have everything…
In your root directory (one level back from the config directory where all your yaml files are) make a directory called media (that may be already there I cant remember) and in there I created
/media/audio/bullhorn/bullhorn_doorbell (each directory is for a particular set of announcements)
/media/audio/bullhorn/bullhorn_house_leave
/media/audio/bullhorn/bullhorn_house_enter
etc…
in your configuration.yaml file add the following:
allowlist_external_dirs:
- "/media/audio/bullhorn/bullhorn_doorbell"
- "/media/audio/bullhorn/bullhorn_house_leave"
- "/media/audio/bullhorn/bullhorn_house_enter"
media_dirs:
media: /media
sensor:
- platform: folder
folder: /media/audio/bullhorn/bullhorn_doorbell # Load array for doorbell mp3 files
filter: "rick-*.mp3"
- platform: folder
folder: /media/audio/bullhorn/bullhorn_house_leave # Load array for leaving house mp3 files
filter: "rick-*.mp3"
- platform: folder
folder: /media/audio/bullhorn/bullhorn_house_enter # Load array for returning home mp3 files
filter: "rick-*.mp3"
The filter command is important because it makes sure that it only grabs file names that end in .mp3 That’s because I also store a text file in there that has the text I used to make the TTS mp3 file in case I need it later to modify things and don’t want to spend hours working out what site/engine, text I used to make them. the filter also has “rick-*” to make sure it only gets the files that start with “rick-” That way its easier for me to “theme” it in the future.
for example in the doorbell folder I could put a bunch of 'Rick Sanchez" announcements that all start with “rick-” and a bunch of “Bart Simpson” announcements that start with “bart-”. if I get sick of one lot I can change to the other theme by just changing the filter command and doing a reboot.
SO… Now you need to create all your announcements, and put them in the respective folders. It doesn’t matter what the file names are - just probably keep them short and no spaces. I’ve got files like :
rick-ding-dong-doorbell.mp3 rick-knock-knock-gate.mp3 etc…
that way I know roughly what each file is going to say if I want to swap some in or out. and because of the filter command, you can take one out by just renaming it to say x-rick-ding-dong-doorbell.mp3
Then you can add it back by just renaming it back again.
hope that’s clear. haha
Now all you have to do is set up your automation…
my doorbell one is:
alias: "Doorbell Alert"
initial_state: true
trigger:
- platform: mqtt
topic: gate/stat/POWER2
payload: "ON"
action:
- service: media_player.play_media
entity_id: group.bullhorn
data:
media_content_id: "/media{{ state_attr('sensor.bullhorn_doorbell', 'file_list')|random }}" # FROM PATH: /media/audio/bullhorn/bullhorn_doorbell/xxxx.mp3
media_content_type: "audio/mp3"
So that’s it. Hope I haven’t left anything out… Have fun with hilarious random announcements.
Having them chosen randomly really stops it being annoying because your brain is saying “Oh! I wonder what it will be this time??”, instead of “It just played xxx.mp3 I knew it was going to do that…”
How? Do you mind to post an example?
service: google_assistant_sdk.send_text_command
data:
command: [your message here]
Here are the docs for this command.
To broadcast a TTS message you need to use:
service: google_assistant_sdk.send_text_command
data:
message: testing 1 2 3
This is an interesting piece of information.
How can I find out if Spotify supports this (I have a feeling it is not, but perhaps some additional config is required) ?
It was kinda built in for Music Assistant. I don’t know of any other integrations which make use of it. Spotify does not.
I also have been trying all possible options (including the Music Assistant Beta route) but resume won’t work on Google Home/Nest devices. The script path is way to comlicated for my taste, so this remains a very much wanted feature
If you need help setting it up, I can give some assistance
What do you mean? Music Assistant with resume after tts?
Yes please, do so here. Other people might also benefit.
Sorry, I was not clear. I meant the resume script/package
Ah ok. What do you suggest?
You quoted a post I wrote a year ago, when the announce
feature was reported to work.
I can’t comment on the current situation because I no longer have any Google Home devices.
The announce
feature doesn’t pause the existing music, it plays over it (at least that’s how it works for Sonos speakers). Maybe it works differently (or not at all) for Google Home devices.
Sadly it does not work at all. Music pauses/stops and does not resume.
I was just hoping to find a acceptable solution because it is quit annoying that tts messages stop music.
I have tried your script, which looked very sophisticated, but sadly I could not get the following to work:
The only way I can keep multiple google home/nest speakers in audio sync is to create a speakergroup in the Google Home app and cast to that group.
If I then cast music to the group like:
service: script.google_home_resume
data:
action:
- service: media_player.play_media
target:
entity_id:
- media_player.cast_groep_woonkamer_keuken
data:
media_content_type: music
media_content_id: http://icecast.omroep.nl/radio2-bb-mp3
announce: true
and then tts to only one speaker of the group like:
service: script.turn_on
target:
entity_id: script.google_home_resume
data:
variables:
action:
- alias: "Send TTS message"
service: tts.cloud_say
target:
entity_id: media_player.cast_google_nest_woonkamer
data:
message: "Dit is een test."
extra:
volume: 0.5
That one speaker plays the message and resumes, but the other one of the group turns off when the message is played and stays muted after playing the message.
That won’t work for me as I do not generally cast tts to the exact same entities that are playing music and I do want my music to play in sync.
For that to work you need to specify the group and it’s members in the script settings
ahh, I see. Now it works just fine. From your documentation it was not directly obvious to me where you defined the groups for in your example.
Thanks for clarifying!