Local Audio to Google Home

Hi all,

I have been able to get TTS working with my GH but no such luck with a local audio file. I have searched and followed all the guides and threads without any joy, can anyone see what I am doing wrong?

- action:
  - data:
      entity_id: media_player.bedroom_speaker
      volume_level: '0.9'
    service: media_player.volume_set
  - data:
      entity_id: media_player.bedroom_speaker
      data:
        entity_id: media_player.bedroom_speaker
        media_content_id: https://xxxxxx.duckdns.org:8123/local/audio/door.mp3
        media_content_type: 'audio/mp3'
    service: media_player.play_media
  - delay: '5'
  - data:
      entity_id: media_player.bedroom_speaker
      volume_level: '0.5'
    service: media_player.volume_set
  alias: Front Door Alert
  condition: []
  id: '1515147203854'
  trigger:
  - entity_id: sensor.bed_door
    from: closed
    platform: state
    to: open

So I set the GH volume up, play audio file, wait 5 seconds then turn volume back down. All this works other than the audio file doesn’t play. If I go to the address in a browser the file plays.

Any ideas?

Anyone go this setup and working?

I’m new to HASS as well. Saw your post and was intrigued by the idea of sending media to GH, so I tested sending a media file to GH and it worked. I’d suggest narrowing things down by testing if you’re able to send local media to GH via Developer tools > Services. Choose your service and entity using the drop down and then under Service Data, plug the following in and see if media plays. I also read somewhere to try putting your file in your main “www” folder where its accessible from web.

{
  "entity_id": "media_player.bedroom_speaker",
  "media_content_id": "https://xxxxxx.duckdns.org:8123/local/audio/door.mp3",
  "media_content_type": "MUSIC"
}
1 Like

Thanks klingon888,

This has indeed worked. Now just to figure out why it doesn’t work in the automation…

I’m definitely no expert but looking at your code, I see 2 data sections.

  - data:
      entity_id: media_player.bedroom_speaker
      data:
        entity_id: media_player.bedroom_speaker
        media_content_id: https://xxxxxx.duckdns.org:8123/local/audio/door.mp3
        media_content_type: 'audio/mp3'

Try the following:

  - data:
      entity_id: media_player.bedroom_speaker
      media_content_id: https://xxxxxx.duckdns.org:8123/local/audio/door.mp3
      media_content_type: 'MUSIC'
1 Like

Thanks again klingon888, I now have it working with the below automation:

- action:
  - data:
      entity_id: media_player.bedroom_speaker
      volume_level: '0.9'
    service: media_player.volume_set
  - data:
      entity_id: media_player.bedroom_speaker
      media_content_id: https://xxxxxx.duckdns.org:8123/local/audio/door.mp3
      media_content_type: 'MUSIC'
    service: media_player.play_media
  - delay: '5'
  - data:
      entity_id: media_player.bedroom_speaker
      volume_level: '0.5'
    service: media_player.volume_set
  alias: Front Door Alert
  condition: []
  id: '1515147203854'
  trigger:
  - entity_id: sensor.bed_door
    from: closed
    platform: state
    to: open