Send commands to Google Home


#1

I have a 10-week old baby at home, we have created some Google Home routines to help her go to sleep. When we put her down we say the command “Ok Google Shush”. This sends google the command “play shush sounds” and plays a shushing white noise that she likes. The problem is that Google has decided to limit this white noise to 8 hours long. I even tried changing the command to “play shush sounds for 12 hours”. Google responded with “You can only play white noise for 8 hours”. So it’s obviously a limitation with Google. This turns off the white noise at about 4:00am and my daughter promptly wakes up around 4:03am.

I’m hoping HA can help me work around this. My thought is to set an automation that would trigger a 7 hour timer when the Google Home started playing after a set time of day. When that time ends I would like to have HA send the command to Google Home “play shush sounds”. Can this be done? I’m not familiar with what action I would have to create to get the Google Home to accept that command.

Help me get more sleep!!!


#2

Maybe a different approach could be a useful alternative. You could generate a X hour long white noise mp3, and use the TTS functionality to stream that to the Google Home.
Out of curiosity I just now used Audacity to create 12h brown noise (which to sounds more like what Google is calling white noise, ot at least it has less of a hiss factor). That just took around 2 minutes. The saved mp3 file (with 96kbit/s, we don’t really care about details here) took roughly 7 minutes to export, and the filesize is ~500MB. Trying it with 64kbit/s now to hear how it sounds and what the rilesize will be.
Edit: At 64kbit/s it’s 330mb, and not being an audiophile I pretty much don’t hear any difference.


#3

Thanks! I’m trying to use your method. I have a 12 hour file created called shush.mp3. I saved it in my www folder. I can access it at https://MYURL.duckdns.org/local/shush.mp3. Here is what I have in my scripts file.

'1547092097205':
  alias: Play Shush Sounds in Nursery
  sequence:
  - service: media_player.play_media
    data:
      entity_id: media_player.living_room_google_home
      media_content_id: /local/shush.mp3
      media_content_type: 'music'

When I run the script I hear the “I’m alive” tone on the google home but nothing plays. Any ideas what I have wrong?


#4

I was able to get it to work using this code.

'1547092097205':
  alias: Play Shush Sounds in Nursery
  sequence:
  - service: media_player.play_media
    data:
      entity_id: media_player.living_room_google_home
      media_content_id: http://192.168.1.111:8123/local/shush.mp3
      media_content_type: 'music'

#5

check out this thread. You can set commands to the google home to get it to perform tasks as if you had given it voice commands. There is a ‘broadcast’ function as well as a ‘command’ function.