It’s a bit odd, I’m just trying to play sounds through my regular audio jack but I couldn’t find a guide or a post which explains how to do it.
I found some info in the documentation about VLC and MPD, but it wasn’t clear enough for me.
If someone can post here a step-by-step guide which explains how to make this setup, so eventually I will have an entity media_player.XXXX in which I can play sounds, that’ll be awesome.
The use case for me is to play sounds when automations are triggered. For example, I would like to hear a notification sound when the boiler is turned on, so I will know that the automation really worked (it’s a bummer to think that the boiler was on and then find out you don’t have any hot water).
I’m running my HA on a dedicated Debian based laptop, but it can also be relevant for RPi and any other configuration.
I don’t think I have read anyone doing this.
Most use either notifications through HA app or other messaging apps, notification through TTS on a smart speaker.
There is a DIY solution using a ESP somewhere in the forum.
But directly from the computer running HA is news to me…
Refresh the add-ons using the white arrow on the top right of the page
Search for “Local VLC” on the list and click on it
Click on the install button and wait! It could take a couple of minutes.
Configure a password for your telnet and web interface
Configure your audio output device.
Click on start!
From the second link, add this to your configuration. yaml file:
media_player:
- platform: vlc_telnet
host: IP_ADDRESS # this is the ip address of your home assistant server
password: PASSWORD # this is the password you set up un step 5 above.
Restart home assistant and you should have a new meda player for VLC.
Invalid media type audio/wav. Only music is supported
12:03:12 PM – vlc_telnet (ERROR) - message first occurred at 12:00:20 PM and shows up 3 times
YAML file /config/configuration.yaml contains duplicate key "media_player". Check lines 64 and 68
12:03:10 PM – util/yaml/loader.py (WARNING) - message first occurred at 12:00:17 PM and shows up 3 times
Error setting up entry configuration.yaml for mqtt
11:59:54 AM – components/mqtt/__init__.py (ERROR)
Ok, following your question, I deleted in my configuration.yaml file the following -
mqtt:
discovery: true
And now I don’t have any errors (can’t remember why I put those lines in the first place).
However, I still don’t hear any sound when I trigger the action.
Maybe I need to configure somewhere my audio output? Right now, under “configuration” tab in my “local VLC” addon, under “audio output” I have two options - “Default” and “Built In Analog Stereo”. None of them work. Note that I use an external USB sound card. But even when I tried to connect the 3.5mm cable directly to the audio jack, it didn’t work.
I would emphasize that I know that the sound card and cable work, because I tested them through the Debian terminal and it played my audio file.
I tried your suggestions, none of them worked for me. But now it’s clearer why there are problems. I looked at the log of Local VLC and saw the following errors:
[000055fdba05b900] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[000055fdba05b900] main interface error: no suitable interface module
[00007f3fd6c0fb40] main libvlc error: interface "dbus,none" initialization failed
[000055fdba0944a0] main interface error: no suitable interface module
[00007f3fd6c0fb40] main libvlc error: interface "globalhotkeys,none" initialization failed
[000055fdba05bac0] [telnet] lua interface: Listening on host "telnet://:4212".
[000055fdba058040] main playlist: playlist is empty
[000055fdba0963e0] [http] lua interface: Lua HTTP interface
Although it may sound like a non-VLC related issue, I googled the error which appears in the first line (D-Bus error) and per the results it is very much associated with VLC. Couldn’t find a solution in google.
No problem, sorry for the bum steer. The only other method I know of is MPD and it is really not easy to do with Home Assistant OS.
As an alternative, the solution I implemented to this problem was to purchase a Chromecast Audio (still available second hand on fleabay) and hook it up to a pair of Creative Pebble speakers. One big advantage of this setup is that it can do text to speech rather than just relying on pre-recorded messages for announcements.
Also the Chromecast Audio is auto discovered. Very easy to add.
Ok, sounds interesting. Indeed I have Chromecast built-in in my Nvidia Shield and the integration with HA is fairly intuitive.
Where do you connect the Chromecast? It’s HDMI powered, isn’t it?
And how do you connect the speakers to it?