Home Assistant - Google Speaker Notification Examples
The following tutorial will show you how to integrate your Google speaker with Home Assistant, so that it announces when your phone battery is low. After this, you will have the knowledge to make further automations so that you can do things like play a sound when your phone is charging, or announce when something else happens.
This is probably the easiest and most generic/useful automation that you can do. Get your speakers to say that something happened (notify you), when something happens.
From the overview page, click configuration
Then click Automations
Then click Add Automation
Then click Start With An Empty Automation
Now give your automation a name. E.g. Notify me when x happens.
In this example, I am going to set my notification to "go off" (trigger) when my phone is low on charge. Thus, I click on Trigger type Device, click on the device field which pulls up a dropdown, and then select my Phone.
Once you have selected your phone as the device, the trigger options will dynamically change. Click on the trigger field (1), and then select Battery Level battery level changes.
Finally, set the percentage below which you want to get an alert. In this example, I am having it alert me when the battery level drops below 20%.
The next card is for conditions. These are optional options, and for this tutorial we do not need to set any, but you may wish to.
In the final actions card, click on Action Type (1), and select Call service.
Select the service field and start type in tts (1), and then select tts.google_translate_say.
Finally, in the Service Data field, enter the following:
entity_id: media_player.all_speakers message: Your phone needs charge!
all_speakers to the name of your speaker device that you want to play the notification, and change the text of the message to whatever you desire.
Finally, click save, and your automation is set. You will now be notified when your phone is low on charge.
Play A Custom Sound Instead
A custom sound can be a lot more entertaining, and the voice on Google assistant is not that great. If you wish to play a custom sound file instead of speaking a typed message, then do the following.
For a bunch of custom sounds that you might find useful, I would recommend the following sound boards:
Find a sound you want, before downloading it.
Stick the sound on a web server that you host in your house, and get the URL for it. E.g. http://myserver.mydomain.com/sounds/my-custom-sound.mp3. If you don't currently have a webserver, you can very quickly and easily deploy one through docker.
Once you have the URL, the steps are the same as before, you are just changing the Service to media_player.play_media (1), before then clicking on the next field and selecting the device to play the sound on (2), and finally setting the service data (3) to
media_content_id: 'http://files.programster.org/public/sounds/charging-up.mp3' media_content_type: audio/mp3
- Youtube - How to Turn your Google Mini into a Loudspeaker with Home Assistant | TTS
- Reddit - Play mp3 on media_player entity
- Home Assistant Forum - Media Playback [Solved]
First published: 1st January 2021