Home Assistant display the Linux way
I've seen many examples of people repurposing Android tablets to use as Home Assistant displays, and I have opinions. Of course I have opinions - I work in DevOps.
Operating System
They are always Android tablets. I've not even seen anyone try to use a SBC, or Linux.
Touchscreen
Perhaps this is why everyone selects Android without looking at alternatives. Touchscreen PCs aren't very common, unless you're talking about laptops, and why would you want an open laptop in your lounge?
Display size
Tablets are between 7" and 12". Come to think of it, I did once see a Youtuber repurpose a big TV from a school. I should find that sometime.
Kiosk mode
Fully Kiosk Browser on Android is free for limited functionality, with a watermark, or it has a cost for each device. You don't buy a licence for the software - you buy a licence for the software running on one device.
Battery
Batteries are always left in the devices. Good for when you have a power cut, or for instances where power can't be run to where the display will live, but not so good when the device gets old and the battery starts to degrade by bulging.
Speaker
Tablets have speakers. Not necessarily very good, but they should be good enough for homelab announcements. If the running software on the device doesn't include the ability to add functionality like this, is it useful?
Webcam
Shouldn't the display double as a component of home security? Sending the webcam feed to something like Frigate?
Security
The device is secured in kiosk mode, but it doesn't stop anyone from taking the device. Is a photo taken of the person interacting with the display?
Up-to-date
We're talking about obsolete devices finding a new life. We can't expect the latest version of the operating system to be used. Unless we use a better operating system.
Flexibility
What else could / should the device be doing? Do we want an MQTT client on it? What for? Do we want it to run an instance of Home Assistant? Do we want it to be a part of our homelab, providing other services? Do we want it to run docker services? Local LLM? Anything else?
My Solution
Repurpose an old Windows all-in-one PC with Linux. replace the HDD with SSD. Upgrade the RAM. Autostart Firefox in kiosk mode. Use webcam software that turns on the screen if it senses movement. Install MQTT client for integration possibilities.
How I came to have an old Windows all-in-one PC
My late father-in-law was sold on the all-in-one PC form factor. When he passed, my mother-in-law didn't share his views, and preferred using her iPad Mini, but she needed something that could take over when the iPad didn't quite cut it. So I gave her my 2014 MacBook Pro and my iPhone 6 Pro Max, and she gave me the all-in-one PC. As a transaction, it's a very bad deal for me. As son-in-law value, I've received cake from her every week for 6 years, so I'm happy with the deal.
The PC
It's a HP all-in-one from perhaps 2015. It boasts a AMD A6-6310 APU, and I upgraded it to 2 sticks of 4GB DDR3 RAM. I can't find a BIOS newer than VA0.10 from 10 May 2016. You can likely pick them up for under £100So I've had this since 2020. Why didn't I do something interesting with it then? I did - it's just taken me 6 years to bother writing about it!
Oh - I did make an upgrade a few years ago. As soon as AI could create images, I made a png for startup and shutdown in Linux, so it looks like this during boot:
What about when it's running? Does it look any good?
It shows what I want. A complete Home Assistant dashboard. No need for a restricted view due to the space available on a small screen,. It's 22" 1080p display, so I can show whatever I want on it. Note the webcam at the top of the screen has its LED illuminated. It's scanning to make sure there's someone in front of it, and the display turns off when there's no-one there.Speed-wise, it's perfectly snappy. I believe this device was introduced in Windows-7 times, but there was an upgrade available to Windows-10. It was never performant on Windows, so I put Linux on it. I tried various distros, but I couldn't standardise on my preferred ones due to software requirements. My first choice at the time was Manjaro, which didn't work for me on this machine. I then tried CachyOS, but the webcam wasn't reliable. I tried OpenSUSE Tumbleweed, before I realised that I didn't want a rolling distro. My home servers use Debian, but there were too many limitations with the old kernel. Fedora was ok, but the webcam software I wanted to use didn't work correctly on it, so I eventually installed Ubuntu 20.04. Over time, I upgraded to 22.04, then to 24.04. I'm now waiting for 26.04 to be released so I can move to that LTS.
I tried Ubuntu late in my investigation of operating systems because I am opinionated about package management (which is the main justification I use for hopping between distros). I would much rather have an application packaged by the creator / maintainer of the package than by the maintainer of the operating system. I think one of the Ubuntu upgrades replaced my Flatpack installation of Firefox with the Snap package version, which I'm not delighted about, but there are some battles not worth having.
Software
There is some software that needs to interact with the display. This software runs as autostart entries for the user after automatic login on startup. Other software can run as services.
I want the webcam to register motion and turn the on display. The display should turn off shortly after motion stops. This should stop any possibility of burn-in, whist not irritating me by using more power than is needed when no-one is watching the screen.
https://motion-project.github.io/
/etc/motion/motion.conf
# Rename this distribution example file to motion.conf
#
# This config file was generated by motion 4.6.0
# Documentation: /usr/share/doc/motion/motion_guide.html
#
# This file contains only the basic configuration options to get a
# system working. There are many more options available. Please
# consult the documentation for the complete list of all options.
#
############################################################
# System control configuration parameters
############################################################
# Start in daemon (background) mode and release terminal.
daemon off
# Start in Setup-Mode, daemon disabled.
setup_mode off
# File to store the process ID.
; pid_file value
# File to write logs messages into. If not defined stderr and syslog is used.
log_file /var/log/motion/motion.log
# Level of log messages [1..9] (EMG, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL).
log_level 6
# Target directory for pictures, snapshots and movies
target_dir /var/lib/motion
# Video device (e.g. /dev/video0) to be used for capturing.
video_device /dev/video0
# Parameters to control video device. See motion_guide.html
; video_params value
# The full URL of the network camera stream.
; netcam_url value
# Name of mmal camera (e.g. vc.ril.camera for pi camera).
; mmalcam_name value
# Camera control parameters (see raspivid/raspistill tool documentation)
; mmalcam_params value
############################################################
# Image Processing configuration parameters
############################################################
# Image width in pixels.
width 640
# Image height in pixels.
height 480
# Maximum number of frames to be captured per second.
framerate 15
# Text to be overlayed in the lower left corner of images
text_left CAMERA1
# Text to be overlayed in the lower right corner of images.
text_right %Y-%m-%d\n%T-%q
############################################################
# Motion detection configuration parameters
############################################################
# Always save pictures and movies even if there was no motion.
emulate_motion off
# Threshold for number of changed pixels that triggers motion.
threshold 1500
# Noise threshold for the motion detection.
; noise_level 32
# Despeckle the image using (E/e)rode or (D/d)ilate or (l)abel.
despeckle_filter EedDl
# Number of images that must contain motion to trigger an event.
minimum_motion_frames 1
# Gap in seconds of no motion detected that triggers the end of an event.
event_gap 60
# The number of pre-captured (buffered) pictures from before motion.
pre_capture 3
# Number of frames to capture after motion is no longer detected.
post_capture 0
############################################################
# Script execution configuration parameters
############################################################
# Command to be executed when an event starts.
; on_event_start value
# Command to be executed when an event ends.
; on_event_end value
# Command to be executed when a movie file is closed.
; on_movie_end value
############################################################
# Picture output configuration parameters
############################################################
# Output pictures when motion is detected
picture_output off
# File name(without extension) for pictures relative to target directory
picture_filename %Y%m%d%H%M%S-%q
############################################################
# Movie output configuration parameters
############################################################
# Create movies of motion events.
movie_output on
# Maximum length of movie in seconds.
movie_max_time 60
# The encoding quality of the movie. (0=use bitrate. 1=worst quality, 100=best)
movie_quality 45
# Container/Codec to used for the movie. See motion_guide.html
movie_codec mkv
# File name(without extension) for movies relative to target directory
movie_filename %t-%v-%Y%m%d%H%M%S
############################################################
# Webcontrol configuration parameters
############################################################
# Port number used for the webcontrol.
webcontrol_port 8080
# Restrict webcontrol connections to the localhost.
webcontrol_localhost on
# Type of configuration options to allow via the webcontrol.
webcontrol_parms 0
############################################################
# Live stream configuration parameters
############################################################
# The port number for the live stream.
stream_port 8081
# Restrict stream connections to the localhost.
stream_localhost on
##############################################################
# Camera config files - One for each camera.
##############################################################
; camera /usr/etc/motion/camera1.conf
; camera /usr/etc/motion/camera2.conf
; camera /usr/etc/motion/camera3.conf
; camera /usr/etc/motion/camera4.conf
##############################################################
# Directory to read '.conf' files for cameras.
##############################################################
; camera_dir /usr/etc/motion/conf.d
~/.config/autostart/motion.desktop
[Desktop Entry]
Type=Application
Exec=/usr/bin/motion
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=Motion
Name=Motion
Comment[en_GB]=Webcam motion detection
Comment=Webcam motion detection
~/.config/autostart/firefox.desktop
[Desktop Entry]
Type=Application
Exec=firefox --kiosk http://192.168.1.42:8123\n
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=kiosk
Name=kiosk
Comment[en_GB]=Home Assistant
Comment=Home Assistant
~/.config/autostart/xhost.desktop
[Desktop Entry]
Type=Application
Exec=xhost +
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=xhost
Name=xhost
Comment[en_GB]=Allow DISPLAY monitoring
Comment=Allow DISPLAY monitoring
I can see that Fully Kiosk Browser on Android has some control options from Home Assistant. I don't believe in the management of infrastructure devices from Home Assistant, but is there anything equivalent that will work in Linux? Yes there is. It's called LNXLink
https://github.com/bkbilly/lnxlink
~/.config/lnxlink/config.yaml
mqtt:
prefix: lnxlink
clientId: allinone
server: 192.168.1.17
port: 1883
auth:
user: user
pass: pass
tls: false
discovery:
enabled: true
lwt:
enabled: true
qos: 1
retain: false
connectMsg: 'ON'
disconnectMsg: 'OFF'
update_interval: 5
modules: null
custom_modules: null
exclude: brightness
settings: null
It's installed, but I don't use it for management. If I ever want to monitor it, I have Telegraf & InfluxDB.
The PC has stereo speakers. Couldn't it be a part of my "announcements" group, to receive audio commands and speak to me?
That option is provided in Home Assistant by mqtt media player. I had to get Pipewire working and use pavucontrol to enable the correct audio output, but this is what the audio output looks like in Home Assistant
My Node-RED announcements optionally get sent to all of those Home Assistant media players
Doesn't this PC have a microphone? Could I use it to control my home using voice? Well, I probably could, but I don't think the microphone array is as sophisticated as Amazon speakers, or even as good as the little Xiaozhi AI globes that I already have. so I won't use it for that.
What about installing Frigate, or Home Assistant, or Zigbee2MQTT, or Pi-Hole, or any other applications on this machine? Absolutely, it might be able to run them, and it might run them well. I have other ways to run all of these applications, though, so unless something changes, I have this covered already.






Comments
Post a Comment