NUC play local audio file to 3.5mm jack in Home Assistant (HassOS 110)

Thanks for looking. I have a doorbell set up in HA (OS 110). I would like to trigger playing an mp3 (WAV or any format which will work) through the 3.5mm jack on an intel NUC and routing through my whole-home audio amps.

For this task, I have tried using Mopidy, creating my own custom addon, using media extractor, everything I can possibly find–without success. As a n00b, can anyone assist with getting this configured? Thanks in advance.

3 Likes

Crazy to think I am the ONLY one who wants to output local audio over the NUC 3.5mm? I have read until my eyes bleed yet cannot make any of the solutions work. Obviously I am missing something but would enjoy seeing what works in HA. This is my first service integration and it seems I am missing the mark.

Ok, so maybe I will ask this question in a different manner:

I was able to install the HACS Alexa integration and successfully send audio to my Echo speaker. I understand the limitations of sending local audio to that device. I need to output a local audio mp3 to utilize on doorbell button push. For the moment, I have done the following:

Installed Mopidy (note the audio port selection):

Added these lines to my config.yaml:

media_player:
  - platform: mpd
    host: 192.168.1.XXX:6600

Restarted the HA server. Attempted to call the service but get nothing. The address was copied from the IRIS web gui using the “get uri” option:

I can reach the IRIS web gui…but trying to play the file shows mopidy playing the file without sound. I will assume that a serial port assignment has not been made for output, but I am not sure how to address that.

I do not see any errors in the log when the service is called. I initially thought it was a permissions error, but the add on has no difficulty playing the file and no errors are thrown. HA just won’t output the sound using the jack. I have followed the same steps by creating my own addon using sox as suggested in another thread, yet met the same end.

Your help is appreciated.

I don’t know if you were able to make it work but after wasting about an hour trying to setup mdp I found that HassOS comes with paplay (a PulseAudio utility) that can be used to play files from the command line. They only problem is that it doesn’t read mp3s so you’ll have to convert them to wav first.

I wanted to use it to play a doorbell sound when someone presses the doorbell button so I ended up with something like this in my config file

shell_command:
  play_doorbell_sound: "paplay /media/doorbell.wav"

automations:
  - id: play_sound_on_doorbell
    alias: Play doorbell sound
    trigger:
      platform: device
      device_id: my_device_id
      domain: binary_sensor
      entity_id: binary_sensor.doorbell
      type: turned_on
    action:
      service: shell_command.play_doorbell_sound
4 Likes

Hey, thanks for posting this. I will keep it in my notes. Since writing this post, I have simply built a small stand alone module using a board I found on amazon which had a built in flash module. I simply hard wired the module to my bell button and into my amplifier. It works flawless. I am glad to know there is another method should I ever change my mind. Thanks again for posting this solution!

Hello,
does it still works for you after update to 2020.12? It stops working for me with shell command return code 1. It works fine in terminal.

It does not work anymore but I haven’t looked at it yet to try to fix it. I’ll let you know if I manage to make it work again

1 Like

Did you ever manage to fix this? Am attempting the same thing with PAPlay, logs gives an error code 1 with little information.

Edit : the only way I could get this working was to leverage the terminal app :

Put your wav file in a directory

Create a bash script in doorbell.sh (in my_scripts in this example) with the following :

#!/bin/bash
/usr/bin/paplay --volume 30000 /config/doorbell.wav

Set permissions for doorbell.sh to be executable

Add the following to your automation as action:


  - data:
      addon: a0d7b954_ssh
      input: /config/my_scripts/doorbell.sh
    service: hassio.addon_stdin