Kiosk Mode for Raspberry Pi with Touch Display

In my search for suitable touchscreen hardware to display the Home Assistant dashboard in kiosk mode, I decided to use a Raspberry Pi with the official 7" Touch Display 2. While a 7" display may not be the largest, it’s sufficient to effectively display a complete Home Assistant dashboard. I’ve never been a fan of tablets that constantly require a charging battery, as I’m not convinced they will last any longer than a Raspberry Pi.

I would like to introduce you to my TouchKio project, which supports any kind of Linux device connected to a Touch Display and is designed for easy setup, making it beginner-friendly.

TouchKio

A Node.js application that utilizes Electron to create a kiosk mode window specifically designed for a Home Assistant dashboard. This tool is packaged as a .deb file, making it easy to launch the kiosk application on any Debian based Linux hardware (e.g. Raspberry Pi) equipped with a DSI or HDMI Touch Display. Additional releases for other Linux systems are available as .zip file.

display

This implementation addresses common issues encountered when using the built-in browser running in fullscreen mode on the Raspberry Pi with Touch Display.

Moreover, the device running the kiosk application also offers several Home Assistant MQTT sensors, enhancing it’s functionality for automation purposes.

mqtt

If you are interested you may want to have a closer look into this github repository:

1 Like

If I tie a PIR or proximity sensor to the Pi, would the app be able to wake up the screen?
If not, is it something on the roadmap?

Technically, it is possible to connect some additional sensors directly to GPIO and trigger the wlopm --on * command (which is used to turn on the screen), but that would require wiring and custom programming.

The screen can be put into sleep mode using the Raspberry Pi’s built-in screen blanking function (e.g. blank screen after 10 minutes) and woken up again by tapping it once. Alternatively, the method below can also be used.

With the mqtt integration it is possible to turn the screen on via Home Assistant. The only thing required would be a Home Assistant automation and an existing presence or motion sensor. e.g when presence is detected, turn the screen on, turn off when no presence or after some timeout.
Additional the screen brightness may also be adjusted if the sensor provides some light (lux) measurements. e.g. dim the screen brightness down at night.

Using mqtt via an existing sensor is a good idea. I will look into that.

And thank you for the build :+1:

1 Like

Awesome kiosk application. Works way smoother for me than chromium in kiosk mode.

However, since I am using a Pi 4, I am unable to use/test the MQTT sensors. For testing, would it be enough to alter the model filter and remove the 5 in it so it is “supported” on all Pi’s?

1 Like

Yes, please try this. :clap:
I’m pretty sure it should work with RPi 4 and Touch Screen 2, but I’m unsure about Touch Screen 1.

Please let me know if it works and feel free to do a pull request to make this project support more devices.

Alright. So I did some testing… I am using an HDMI-Display so the brightness and display status won’t work for me. So I commented out all function calls for getting this data and removed the model number from the getModel() function to allow other Pi’s than the 5.

This seems to work for me. Of course, the display is not controllable at the moment but for me that would be enough. A bit of code optimization is needed as well as in my fork at pdsccode/touchkio: Home Assistant Touch Kiosk for Raspberry Pi with the official 7" Touch Display. the display is completely out of order.

Will do a pull request when I optimized the code.

Update: Just opened a PR to allow other Pi models and Displays: Feat: Allow other displays and Raspberry Pi models by pdsccode · Pull Request #2 · leukipp/touchkio

With the help of @pdsccode, this project now supports a variety of DSI and HDMI touch displays. Thanks for that! :+1:

Check out the latest releases if you want to try it out:

1 Like

Very nice project!

I have one remark: In the install.sh you set 2 environment variables (DISPLAY & WAYLAND-DISPLAY).
These variables must also be set in the user shell profile otherwise you get an error when you start touchkio from the prompt. You mentioned this in the “Development” topic, but I didn’t read that part because I used option 1 for the Installation. Maybe you can move this remark to another place in the README.md.

I’m looking at kiosk with the touchscreen2 / PI5. What would be a good PI5? Can I get away with the cheapest 2GB one, or does it need more?

I can only say: “It’s working fine on a PI4 with 4GB”. Personally I wouldn’t go for a PI5 with 2 GB, Most likely I would choose the 4GB version to be a little bit ‘future proof’, so you can also use it for other stuff.

As far as I know, on a standard installation of Raspberry Pi OS this shouldn’t be necessary. At least when it comes to the install.sh. If you regularly start touchkio from the shell, then yes, it helps. However, after using the install script, you can start and stop via systemctl --user start touchkio.service. This way, touchkio should start properly.

Oh and by the way @leukipp: The screen blanking functionality still works for me in combination with the mqtt switch. Even if I enable the display via HA, the screen goes dark after some time again. Maybe someone else can test this as well and report back. If so, the remark for this might be obsolete now.

I have a quick question about implementing this touch solution.

I’m using a Raspberry Pi 4 with the official Pi Touch Panel. I’ve set up Chromium in kiosk mode and am currently relying on the native DKMS of the Pi. While this works, there’s an annoying issue with touch accuracy—if you touch slightly off-target, it activates the wrong element, which is frustrating.

From what I understand, this solution replaces the native DKMS setup on the Pi. If that’s correct, I assume I’d need to disable the 10-minute screen blanking timeout since this module would take over.

Would this solution also work without a full desktop environment? I prefer keeping things minimal on the Pi and usually install only the minimal image, configuring only what’s necessary.

Additionally, does this solution completely blank the screen when inactive? By that, I mean turning off the backlight entirely so the screen doesn’t emit any light in a dark room.

Thanks in advance for clarifying!

There could be different behavior based on the window system used: Are you on X11, Wayfire or Labwc?

The application doesn’t alter/replace system configurations, it will mainly check if the session is Wayland or X11 based. For Wayland it will use the wlopm command to update the screen power, for X11 it will use xset.

Yes, this would be the ideal setup. However, most of the guides for minimal GUI setups are for X11, I would go for Wayland (as this is now also the default for the official Raspberry Pi OS releases).

I tried some minimal setups, but never could get things as properly working as installing Raspberry Pi OS directly with GUI. The official image contains some changes for the DSI display state and also for the squeekboard on-screen keyboard support.

For a beginner friendly setup I would suggest installing the default Raspberry Pi OS (not Lite or Full) and then afterwards just purging some unused packages via sudo apt purge ....

If you find an easy way to start from the Lite image and get everything for TouchKio fully working let me know. The most supported OS is the official one with default settings (debian bookworm, wayland labwc, squeekboard).

I am currently running X11 due to the xset test from earlier. Will check again with Wayfire and Labwc later.

I am a very new to working with Linux so please be gentle. I have been looking for a good solution for a wall mounted HA kiosk and ran across your project. When I go to install everything goes fine until running the setup. Initial run I get this:


After completing the setup I get this:

I am unsure how to correct this issue. Any help would be great. (BTW I am running this on a pi4B using the latest PiOS, it is connected to a HDMI based touchscreen)

Please re-run the install script or check the web url parameter stored in home/[USERNAME]/.config/touchkio/Arguments.json. It seems like you provided and invalid url (typo, slashes, etc.)…

Changed the URL in arguments from “192.168.20.155:8123” to “http://homeassistant:8123” and that fixed it. The IP address for my HA instance was correct in the arguments but switching it to this format worked so…