Using Google Home (assistant) speaker for notifications/alarms?

Hi, after some debugging it is clear the delay in casting a notification is caused by the call to pychromecast.get_chromecasts(). I forked your repo and added a commit which now has an MP3 cache, as well as it gets all chromecasts on the network once at startup rather than for every request.

These changes reduce the notification time from 8-10 seconds to around 3 seconds, which is good enough for me. Thanks a lot for this script, if you add me as a collaborator to your original repo I can create a pull request there. Until then, anyone interested can download the updated code from my forked repo:

4 Likes

Thank you for this,
I also did modified the original code to use local mp3ā€™s. Although,I didnā€™t see any improvement on the time either. Making the google homes ip addresses static was the key for me.
I also added the possibility to choose which speaker you want to get the notification to within the url.

Ive Added you as A Collaborator - Thanks for the Help on this. as my first Delve into python, im still getting my head round the basics

Thanks
Elliott

1 Like

Is it possible to do custom messages? Iā€™ve only been able to see it load already pre-created media files or maybe load various web streams.

Yes. You can use the speak text function. Just give it a sentence and itā€™ll throw it up to Amazon Polly, convert the text to speech, then speak it via chromecast.

Iā€™m using thisā€¦doesnā€™t use TTS so if using GH for music streaming it will pause and resume music after the announcement, unlike TTS approach that doesnā€™t resume music. Announces on all GHs on the network.

1 Like

This is excellent. Response time is still 2-3 seconds, but definitely a perk not pausing the music (which would be a big problem for me).

I noticed the broadcast API canā€™t broadcast to specific cast receivers. I think this can be worked around by setting the cast receiver volume to 0 depending which ones you want to mute at what time of the day (ex mute the bedroom during sleeping hours).

1 Like

I would like to share my setup for this.
I use Home assistant to do it, it so much easier

in home assistant:

  • i use amazon polly for TTS, i feel the voice is better (you can customised it as well)

Using webcore (smarthings)

  • this is where i create rules to do a web request to my home assistant rest API to broadcast notification

It is alot of work but it works well

1 Like

Is Home assistant is still able to send a broadcast to your google homes? I am using the assistant relay and it is currently broke on googles end.

1 Like

As of 28May2018, the broadcast functionality is not working
But the command one works

Here is a link to the updated Google Assistant Relay v2

And here is a SmartApp to work along side the Google Assistant Relay v2 to broadcast notifications to your Google Home when a SmartThings device is triggered.

If you need to make use of a device handler you can install this one for use with 3rd party tools like WebCoRE.