Hello everyone,
as it took me some time to figure all of this out, I figured I’d post it here so it might help others. I was struggling with power saving, different settings and so on.
I have a MagicMirror on a pi 5 with Trixie OS that opens chromium and displays my Homeassistant Dashboard.
First, you need to install everything you will work with:
sudo apt update
sudo apt install -y \
xorg x11-xserver-utils xinit \
matchbox-window-manager unclutter \
chromium mesa-utils mesa-vulkan-drivers \
libva2 libva-drm2 vainfo vdpau-driver-all libvdpau-va-gl1
- We will want to autostart our dashboard, so we will add this part to /etc/bash.bashrc
if [ "$(tty)" = "/dev/tty1" ]; then
xinit /home/pi/kiosk.sh -- vt$(fgconsole)
fi
It only starts the script if it is a local user. That way we avoid errors when connecting via ssh.
- We will need a kiosk.sh file in /home/pi/kiosk.sh
#!/bin/bash
export DISPLAY=:0
# --- Display setup ---
xrandr --output HDMI-1 --rotate right #if your mirror is turned to the side. Adjust if necessary
xset s off
xset -dpms
xset s noblank
# --- Window manager ---
matchbox-window-manager --use_titlebar no --use_cursor no &
unclutter -idle 0 -root &
# --- Clean Chromium crash markers ---
PROFILE="/home/pi/.config/kiosk_profile/Default"
rm -f /home/pi/.config/kiosk_profile/SingletonLock
[ -f "$PROFILE/Preferences" ] && sed -i 's/"exit_type":"[^"]*"/"exit_type":"Normal"/' "$PROFILE/Preferences"
[ -f "$PROFILE/Preferences" ] && sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' "$PROFILE/Preferences"
# --- Launch Chromium ---
chromium --display=:0 --start-fullscreen \
--ignore-gpu-blocklist \
--enable-gpu-rasterization --enable-zero-copy \
--use-gl=egl --disable-software-rasterizer \
--disable-extensions --disable-translate \
--disable-background-timer-throttling \
--disable-renderer-backgrounding \
--disable-infobars --noerrdialogs \
--disable-session-crashed-bubble \
--disable-restore-session-state \
--disable-features=InfiniteSessionRestore,SessionRestore \
--hide-scrollbars --overscroll-history-navigation=0 \
--renderer-process-limit=8 \
--password-store=basic \
--force-device-scale-factor=1.5 \ #adjust as needed
--user-data-dir=/home/pi/.config/kiosk_profile \
"URL OF YOUR DASHBOARD?ts=$(date +%s)" #the timestamp was relevant for a setup with my doorbell camera
Do not forget to make the file executable:sudo chmod +x /home/pi/kiosk.sh
- If you are using a pi 5, this was necessary so it boots into console, not the desktop environment:
sudo systemctl disable lightdm gdm3 wayfire weston --now
sudo systemctl set-default multi-user.target
You will need physical access to the mirror in order to log into homeassistant & set it to dark mode, if needed.
Happy New Year to you all