hi, i run home assistant inside docker at a raspberry. i would like let home assistant play video media on my tv. raspberry and tv are already connected via hdmi. my idea was to run a media player inside weston cage on the host and control it with home assistant over an api. i thought of vlc. but the home assistant integration do only support audio. are some other software i can use? i would like to avoid running something big like kodi.
The HDMI port is used for outputting the console output, so you would need a virtualization software, like a hypervisor, on the Pi to separate HA from the HDMI port.
Docker is a virtualization app, so maybe it can separate the HDMI output from HA.
i can configure a user with auto login and put weston cage at the auto start for this user.
like a kiosk system. So this should no be an issue
Then maybe a VLC client with the telnet feature enabled.
it already try it out, but as soon i enable telnet i get no window anymore.
nevermind i try it out again. if i use vlc --extraintf telnet --telnet-password test
instead of vlc --I telnet --telnet-password test
i get a window again.
thanks i will test it with ha later
i have do the following now on a rasberry 2, which run headless alpine linux:
- create a new user
cage
- install needed software
apk add agetty alsa-utils alsaconf cage mesa-dri-gallium seatd vlc
- add seated to auto start
rc-update add seatd
(see Seatd - Installation) - add cage user to needed groups:
adduser cage seat
adduser cage audio
adduser cage video
- enable audio and Graphics Mode by adding the following to
/boot/usercfg.txt
(see Raspberry Pi - Linux Kernel Graphics Modes)
# Enable Audio
dtparam=audio=on
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
gpu_mem=256
# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1
- enable autologin:
edit linetty1::respawn:/sbin/getty 38400 tty1
totty1::respawn:/sbin/agetty --autologin cage tty1 linux
at file/etc/inittab
(see TTY Autologin - By using agetty) - edit start “shell” of cage user to start a custom script instead:
edit linecage:x:1001:1001:cage:/home/cage:/bin/bash
tocage:x:1001:1001:cage:/home/cage:/usr/local/bin/start_cage_vlc.sh
at file/etc/passwd
. - create the script:
#!/bin/sh
#set up to XDG_RUNTIME_DIR enviroment variable (needed for wayland)
#see: https://wiki.alpinelinux.org/wiki/Wayland#Configuring_XDG_RUNTIME_DIR_manually
if [ -z "$XDG_RUNTIME_DIR" ]; then
XDG_RUNTIME_DIR="/tmp/$(id -u)-runtime-dir"
mkdir -pm 0700 "$XDG_RUNTIME_DIR"
export XDG_RUNTIME_DIR
fi
#start vlc inside cage
#i am to lazy to setup pulesaudio/pipewire, so vlc have to use alsa directly
WLR_LIBINPUT_NO_DEVICES=1 cage -d -s -- vlc -A alsa --extraintf telnet --telnet-password test --no-video-title-show --fullscreen 2>&1 | tee /tmp/vlc.log
#wait some time, so I can read the error messages
sleep 20s
if the script terminate, it will be automatically started again
Hints:
- if you use diskless mode do not forget to save changes with
lbu_commit -d
- my raspberry 2 has big performance issues with videos with greater resolution as 1080p. I also looks like mp4 works better like webm, but this need further tests. so high resolution videos maybe not work