Play custom audio file on HomePod Mini

Hello,
Recently I thought about buying a Ring Doorbell Gen2 as a replacement of my broken doorbell, but I discovered that it has no integration with HomeKit, so I thought that I could use HA to fill that gap.
(Mainly, I’d like to avoid buying a Chime, because I already have an HomePod that I think I could use for that purpose)

I’m using the Apple TV integration, and I am able to play custom files through the web media player and I also managed to use TTS for voice, but I couldn’t find a way to play a sound using an automation. This automation should be pretty simple to create.
(Ring integration detects that the button has been pressed → Play doorbell sound on HomePod Mini).

I have Samba access to my server (RPi 4) to access the media folder and I already enabled the /local/ web access to serve static files to some random applications that I have.

Does anybody know the service call that I should use?

With some trial and error, I managed to reproduce an audio file hosted in the www folder (www/audio/test.mp3) on my HomePod Mini. The service call that I used was the following:

service: media_player.play_media
target:
  entity_id: media_player.homepod-mini
data:
  media_content_id: http://192.168.69.77:8123/local/audio/test.mp3
  media_content_type: music
  announce: true

Just out of curiosity, how could I have done the same by using the Media Sources as the origin?

2 Likes

With the new Core 2022.9 update and the improved automation creation that came with it, I’ve managed to also use the other method by reproducing local media.

The media_content_id parameter looks like this:

media_content_id: media-source://media_source/local/audio/test.mp3

(The audio file is placed in media/audio)

1 Like

Newb question here but in what file and under what config does this go?

service: media_player.play_media
target:
  entity_id: media_player.homepod-mini
data:
  media_content_id: http://192.168.69.77:8123/local/audio/test.mp3
  media_content_type: music
  announce: true

`

This is a piece of code which is run by a Script or an Automation.

Since I made this post, the developers made it easier to do this kind of automation. Now there is a specific block made just for playing media on a media player of your choice.