Play local audio with 3.5mm audio jack

Hello, i am sorry if this question has been asked before. I’ve browse this community but still can’t find proper answer.

I’m using home assistant docker running on my Ubuntu laptop. I have local mp3 file stored in the laptop. Is there some way to play the mp3 file through 3.5 audio jack on my laptop, every time any trigger happen? For example when i push switch to high, it will play audio file stored locally.

I’ve been reading these topics for reference, but still can’t figure something out. Can someone please help me? Thanks.
Reference1
Reference2
Reference3
Reference4

2 Likes

I think you should take a look at this and use the modipi add-on

Hi, thanks for responding.
I’ve tried that. It used google text to speech feature. Meanwhile i want to play audio file (.mp3) everytime homeassistant detect a trigger. Do you have any idea? Thanks before.

Sorry, I meant a post further down the thread:

I’ve tried to do those steps recently.
After reading the basic over here to create local addons. The addons was unable to show up even though i’ve refreshed addons page. Do you have any idea how to figure it out? Thanks.

Edit:
I make some changes in confg.json file, the rest is left unedited. The file become like this.

{
  "name": "Audio Player",
  "version": "1.5",
  "slug": "audio_player",
  "description": "Play audio files",
  "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
  "startup": "application",
  "boot": "auto",
  "stdin": true,
  "audio": true,
  "options": {},
  "schema": {},
  "host_network": true
}

Here is my success log, it says the service is starting.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
starting!

After that i refreshed addons store and the addons shows up. But then i when i tried to play audio file stored locally, it failed. Here is the fail log

[Info] Read alias: http://192.168.42.48:8123/config/tts/e0049a66519cae71159800bb77a35007bc2d76d3_id_-_google_translate.mp3
ALSA lib dlmisc.c:283:(snd_dlobj_cache_get0) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error loading shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: No such file or directory)
[Error] Playing failed ->

Do you have any idea to resolve this? Thanks.

Sorry creating add-ons is way out of my league. I hope someone else (like Frenck) will respond to this to help you out. Maybe try to change the title of your topic to gain their interest?

I’m pretty new to home assistant and i have no idea who is Frenck, i’m sorry. @frenck is it the right guy?

Or do you have any idea how to play local audio file beside this method? Thanks so much.

That is the one, but you shouldn’t have tagged him. You couldn’t have known, but he doesn’t like that. He works for Nabu Casa but does not have a strict job description. He created a lot of add-ons already available in the supervisor. But my point was to make a topic title were you might attract either his or someone else’s desire to help out with this.

Hi, when I tried to install Mopidy it is an error:
404 Client Error for http+docker://localhost/v1.40/images/create?tag=0.2.7&fromImage=bestlibre%2Faarch64-mopidy: Not Found (“manifest for bestlibre/aarch64-mopidy:0.2.7 not found: manifest unknown: manifest unknown”)

any idea what is the wrong?

same problem here.

I solved with VLC!

follow the last comment: