Remote VLC remote controller (via telnet)

This is not the vlc component integration to play audio on the home assistant machine, but to trigger home assistant to play audio on a remote vlc player (home theater pc suuuround sound) to play siren or warning when an alarm is triggered.

I dont see anyone using the vlc_telnet platform for media player component so wanted to share for anyone else.

Before i found vlc_telnet i found THIS post with a custom component to control VLC via http. After hours of noobishly trying to get play_media service to work with a recent version of hass i almost gave up so I started browsing the gibhub built in components for ideas why the custom one wasn’t working and then I saw it, “vlc_telnet”.

there is actually a component page that shows how to use it that unfortunately failed to show up on my many google searches for home assistant vlc remote. This page has one fatal flaw. a typo for the platform name.

on the page it calls the platform “vlc-telnet” when in fact it should be “vlc_telnet”

First step is to configure VLC management interface to allow telnet. link on the component page for how to do so. basically enable it and add a passowrd.
Second, the sound files can be hosted anywhere. I choose to keep them on hass in the www folder but can also be local to the vlc player.

# configuration.yaml config for media_player:
media_player:
  - platform: vlc_telnet
    name: HTPCvlc
    host: 192.168.3.111
    password: password

Add sound and config then reboot, you should see a new entity under media_player.

To test it you can use the services in dev tab.
service: media_player.play_media
entity: media_player.HTPCvlc

# here is JSON for service call:
{
  "entity_id": "media_player.HTPCvlc",
  "media_content_id": "http://HASSIO:8123/local/barkbark.mp3",
  "media_content_type": "music"
}

special note: the vlc_telnet component only allows content_type music

HTH anyone else!

3 Likes

Nice work.

I have submitted a correction for the platform name in the docs.

You can do this yourself. There’s a link to the upper right on every page that says “Edit this page on GitHub”

Then follow this procedure:

Cool thanks! After I posted I did see the edit page link. I made the edit but didnt know what to do next, so i dont think my edit actually made it. Thanks for the pointers!

Regarding the special note about the vlc_telnet component only allowing media_content_type music - while that is true for the actual keyword, I discovered you that you can still send a url containing video for the media_content_id and the remote vlc displays it anyway. That allows me to pop-up a full screen live security camera feed on demand over the top of my dashboard (as well as play audio announcements). Not only that, but the latency for live cams is much less than HA’s HLS live stream method because it cuts out the ‘middleman’ (since vlc can display rtsp streams directly). The only downside I have come across is that the vlc_telnet component doesn’t reconnect if the dashboard running vlc is rebooted or goes to sleep - you have to restart HA side also :frowning: Other than that - loving this component!

does vlc_telnet support TTS?

Yes I use the Google translate text-to-speech with vlc_telnet as a media player no problems - bearing in mind the normal requirement of any media player that the url given to the media player has to be reachable from the device/laptop running vlc, usually by setting base_url like in my example below. I also set the scan_interval to 3600 (1 hour) since it don’t really need HA polling vlc for status all the time:

tts:
  - platform:     google_translate
    base_url:     http://192.168.0.140:8123
    time_memory:  60
    service_name: google_say

media_player:
  - platform: vlc_telnet
    name:     vlc bookshelf
    host:     192.168.0.146
    password: test
    scan_interval: '3600'

thanks. i test it and it works in a way. However there are 2 major issue with this.

  1. It only speak the first word or only for 1 second and then it cut off.
  2. I have to SSH in the Pi, run the telnet manually and keep it running to make this work.

I have vlc running continuously (and restarting automatically after reboot) by creating a file under /home/pi/.config/autostart/vlc.desktop with the following contents:

[Desktop Entry]
Type=Application
Name=VLC
Exec=cvlc --fullscreen -I telnet --telnet-password test

This also assumes you are booting the Pi to desktop rather than command line interface - sounds like you might be doing the latter, in which case the autostart method won’t work for you. I have never experienced the 1 second cutoff you describe, so no idea about that one!

Nice! I dont use TTS but it seem worked when i goofed around with it. I also been MIA for quite some time.

I have same problem if VLC is restarted (closed and reopen, or pc reboots) HA does not automatically connect and stops working. I dont recall the error but i would have to restart hass for it to reconnect to VLC.

I am switching VLC player from my main windows workstation to headless dedicated linux or pi. First getting windows 10 to autostart vlc is tricky, and i cant figure out a way to keep it running in the background. I was hoped getting away from windows would help but it sounds like it’s on the component side since your pi does the same. Im planning to dig into this annoyance very soon.

i also hate to lose surround sound on my main windows workstation so im researching a feature in Pulse Audio that can be like a virtual sound card, so multiple devices can use the speaker. Supposedly exists a windows/linux/mac pulse audio client that installs “virtual sound card” which pipes audio over network to pulse audio daemon, the system speakers are physically connected to. Like a virtual audio switch.

anyone have an example service or automation with this working? can’t seem to get tts to vlc_telnet working. @jambalaya by chance?

EDIT : oops i mis read your question about automation. im using nodred. sorry!

hope it help someone else then :crazy_face:
not much in HASS side of things.

took me a while to figure out that:
HASS has to be restarted for it to connect to the VLC. so if you close VLC by mistake, then re-open it and then restart hass. If you dont then hass doesnt connect thats my biggest gripe.

media_player.mattpc

media_player:
  - platform: vlc_telnet
    host: 192.168.3.69
    password: password_in_vlc
    name: mattpc
    port: 42212

the tricky part is setting up VLC properly so HASS can talk to it. il try to get you some relevant config tbh i kind of hacked my way through vlc, turning this on off blah blah. my vlc also keeps a console log open that i can only minimize.

vlc > tools > prefs >
interface > control interface > Main interface.
make TELNET is checked. (idk i have lua check too)

interface > control interface > Main interface > LUA.
in telnet section,
set host = PC IP (not Hass!)
set password (password in configuration.yaml)
set port (port in configuration.yaml. i recall having to do this, maybe i had port conflict)

Hah well, turns out I had it working correctly… but probably helps to have the VLC player audio on something other than 0%. Thanks for the quick rply @mattch

I am noticing a problem though, on initial trigger, the sound fades in from 0% to 100%. Example: “Front door” you can barely hear the word front, but door is at 100% volume. If you trigger again within about 5ish seconds it is full volume. Unsure if this is a linux mint issue or a VLC issue.

1 Like

Did some quick research, look like it’s a VLC problem that it has a default behavior to “fade in”.

Think I figured a way around it, send a message with one space in it, VLC doesn’t make it audible, have a 1 second delay, and that kind of primes VLC and then i send the message I want to be sent and it’s played at full volume.

1 Like