Kiosk Mode for Raspberry Pi with Touch Display

It seemed to be having a problem with a weather integration. I have removed it now and everything works fine.

Hey, thank you for helping me. I think there is something different on my Raspberry Pi OS. I updated to current Version.

sudo libinput list-devices
Device:                  10-0038 generic ft5x06 (79)
Kernel:                  /dev/input/event3
Id:                      i2c:0000:0000
Group:                   1
Seat:                    seat0, default
Capabilities:            touch
Tap-to-click:            n/a
Tap-and-drag:            n/a
Tap button map:          n/a
Tap drag lock:           n/a
Left-handed:             n/a
Nat.scrolling:           n/a
Middle emulation:        n/a
Calibration:             identity matrix
Scroll methods:          none
Scroll button:           n/a
Scroll button lock:      n/a
Click methods:           none
Clickfinger button map:  n/a
Disable-w-typing:        n/a
Disable-w-trackpointing: n/a
Accel profiles:          n/a
Rotation:                0.0
Area rectangle:          n/a

Device:                  vc4-hdmi
Kernel:                  /dev/input/event1
Id:                      <unknown>:0000:0000
Group:                   2
Seat:                    seat0, default
Capabilities:            keyboard pointer
Tap-to-click:            n/a
Tap-and-drag:            n/a
Tap button map:          n/a
Tap drag lock:           n/a
Left-handed:             disabled
Nat.scrolling:           disabled
Middle emulation:        n/a
Calibration:             n/a
Scroll methods:          *button
Scroll button:           KEY_RESERVED
Scroll button lock:      disabled
Click methods:           none
Clickfinger button map:  n/a
Disable-w-typing:        n/a
Disable-w-trackpointing: n/a
Accel profiles:          flat *adaptive custom
Rotation:                n/a
Area rectangle:          n/a

The official old touch screen doesn’t use USB, I think. (https://www.raspberrypi.com/documentation/accessories/display.html)

Hey leukipp, thank you too. Your solution is the obvious one. That leads to the mentioned artefacts.

There are some known issues for RPI 3 devices (caused by the Electron version used), please follow #104 and report your findings there.
Also see #47 as RPI 3 is known to be running on the limit.

@moritzek you are welcome, that is what we are here for. Pi’s are definitely not plug and play but once you have the settings right they are good.

Hi,
I found a solution, that worked for me. I startet with Raspberry Pi OS lite.
1.

sudo apt update -y && sudo apt full-upgrade -y && sudo apt autoremove -y
sudo apt install --no-install-recommends labwc xwayland swayidle alacritty wlopm -y

Then I use sudo raspi-config to set cli autologin.

cat <<'EOF' >> ~/.profile
if [ -z "\$WAYLAND_DISPLAY" ] && [ "\$XDG_VTNR" = "1" ]; then
  exec labwc
fi
EOF

cat <<'EOF' >> ~/.config/labwc/autostart
wlr-randr --output DSI-1 --transform 180 &
alacritty &
EOF

#to find the correct touch device: cat /proc/bus/input/devices

cat <<'EOF' >> ~/.config/labwc/rc.xml
<?xml version="1.0"?>
<openbox_config xmlns="http://openbox.org/3.4/rc">
  <touch deviceName="10-0038 generic ft5x06 (79)" mapToOutput="DSI-1" mouseEmulation="yes"/>
</openbox_config>
# no mouse emulation works too but doesn't wake the screen
EOF

kill -HUP labwc

I put this in alacritty.

bash <(wget -qO- https://raw.githubusercontent.com/leukipp/touchkio/main/install.sh)

The kiosk renders good and the performence is okay for my use. I hope it is helpfull.

I started a new poject with TouchKio using this:

I am quite happy with the performance of the system.
ToDo is the mounting in the wall, currently its mounted on the wall.

Currently I have TouchKio 1.4.0 and wayland, but not yet labwc
It works quite well so far.

Not all controls like a raspi seem to be possible:


Maybe that could be possible in future?

wlopm is used for display on/off

OK, thank you. Does it just need to be installed, or is some kind of configuration necessary?
Is it possible to get the onscreen keyboard running on my system: nanopi / Ubuntu 24.04 ?
What OS might be better? (from FriendlyELEC)

  • Lightweight Ubuntu 24.04 with GNOME and Wayland
  • Debian 12 Core and additional Desktop
  • Debian 11 Desktop, LXDE desktop
  • or (independend)
  • DiePi

If possible, avoid using GNOME Wayland, as it has the lowest level of support.

Refer to touchkio/HARDWARE.md at e195a56739cd7bb7356ca8d1500f5edd7cf427a1 · leukipp/touchkio · GitHub for details on supported operating systems and what’s necessary for the MQTT features.

Oh, thank you, I missed these details . . .

Hi there,

Is there a way to delay the touchkio start up by another 5 second after reboot?
The reason is the Wifi is taking a while to connect so the home assistant dashboard doesn’t load as there is no internet connection at that exact time.

Many thanks

You could alter the service file.

Hello @leukipp

I installed your solution, which perfectly meets my needs and exceeds my expectations. Great job!

It is installed on an RPi 4 (8GB), powered by PoE and connected to the DeskPi Touch Screen.

I was wondering if it would be possible to convert the display entity into a switch. I just looked at the source code and it seems that the light entity would allow me to adjust the brightness, etc. However, in my case, it is only an on or off type.

You could archive this with a custom switch template in your configuration.yaml that calls the light on/off service.

But that shouldn’t really be necessary:

  • On the dashboard use the default entities card if you want a switch like button.
  • In automation’s just use light on/off instead of switch on/off.

You don’t even need to dig into the config file any more. You can set up everything in the UI just like in this thread Guide: Change Light Entity to Switch.

But yeah, it’s much simpler to use an entities card like you suggested for dashboards.

Card Code

type: entities
entities:
  - entity: sensor.touchkio_pi500_up_time
    format: datetime
    name: Pi500 Uptime
    card_mod:
      style: |
        hui-generic-entity-row {
          border: none !important;
        }
  - entity: sensor.touchkio_pi500_last_active
    name: Pi500 Last Active
    card_mod:
      style: |
        hui-generic-entity-row {
          border: none !important;
        }
  - entity: sensor.touchkio_pi500_processor_usage
    name: Pi500 CPU
    card_mod:
      style: |
        hui-generic-entity-row {
          background:
            {% set perc = states(config.entity)|float(0) %}
            {% set rest = 100 - perc %}
            {% if perc >= 59 %} {% set bar = '255,0,0' %}
            {% elif perc >= 44 %} {% set bar = '128,0,0' %}
            {% elif perc >= 24 %} {% set bar = '255,165,0' %}
            {% elif perc >= 9 %} {% set bar = '0,100,0' %}
            {% else %} {% set bar = '0,128,0' %}
            {% endif %}
            /*linear-gradient(to left,ivory {{rest}}%, {{bar}} {{perc}}%);*/
            linear-gradient(to right, rgb({{bar}},0.9) 0%, rgb({{bar}},0.6) {{perc}}%,
                                      rgba({{bar}},0.3){{perc}}%, rgba({{bar}},0.1) 100%);
        }
  - entity: sensor.touchkio_pi500_processor_temperature
    name: Pi500 Temp
    card_mod:
      style: |
        hui-generic-entity-row {
          background:
            {% set temp = states(config.entity)|float(0) %}
            {% set rest = 100 - temp %}
            {% if temp >= 85 %} {% set bar = '255,0,0' %}
            {% elif temp >= 75 %} {% set bar = '128,0,0' %}
            {% elif temp >= 65 %} {% set bar = '255,99,71' %}
            {% elif temp >= 55 %} {% set bar = '255,69,0' %}
            {% elif temp >= 45 %} {% set bar = '255,140,0' %}
            {% elif temp >= 35 %} {% set bar = '255,165,0' %}
            {% else %} {% set bar = '0,128,0' %}
            {% endif %}
            /*linear-gradient(to left,ivory {{rest}}%, {{bar}} {{temp}}%);*/
            linear-gradient(to right, rgba({{bar}},0.9) 0%, rgba({{bar}},0.9) {{temp}}%,
                                      rgba({{bar}},0.6){{temp}}%, rgba({{bar}},0.2) 100%);
        }
  - entity: sensor.touchkio_pi500_memory_usage
    name: Pi500 Memory
    card_mod:
      style: |
        hui-generic-entity-row {
          background:
            {% set perc = states(config.entity)|float(0) %}
            {% set rest = 100 - perc %}
            {% if perc >= 85 %} {% set bar = '255,0,0' %}
            {% elif perc >= 75 %} {% set bar = '128,0,0' %}
            {% elif perc >= 60 %} {% set bar = '255,165,0' %}
            {% elif perc >= 50 %} {% set bar = '165,42,42' %}
            {% else %} {% set bar = '0,128,0' %}
            {% endif %}
            /*linear-gradient(to left,ivory {{rest}}%, {{bar}} {{perc}}%);*/
            linear-gradient(to right, rgba({{bar}},0.9) 0%, rgb({{bar}},0.9) {{perc}}%,
                                      rgba({{bar}},0.6){{perc}}%, rgba({{bar}},0.2) 100%);
        }
  - entity: button.touchkio_pi500_reboot
  - entity: light.touchkio_pi500_display
    name: Touchkio pi500 Display
    card_mod:
      style: |
        hui-generic-entity-row {
          border: none !important;
        }
  - entity: number.touchkio_pi500_page_zoom
  - entity: button.touchkio_pi500_refresh
    name: Touchkio Pi500 Refresh
    card_mod:
      style: |
        hui-generic-entity-row {
          border: none !important;
        }
header:
  type: picture
  image: /local/home-assistant/rapberry-pi.png
  tap_action:
    action: none
  hold_action:
    action: none
card_mod:
  style:
    hui-sensor-entity-row:
      $: |
        hui-generic-entity-row {
          height: 25px;
          padding: 0px 16px;
          border-radius: 24px;
          border: 1px groove var(--divider-color);
        }
    .: |
      .card-content {
        background: var(--ha-color);
      }
      ha-card {
        color: white;
        --card-mod-icon-color: white;
        --mdc-icon-size: 20px;
        font-weight: bold;
      }

Card Header Image

Updated version with a TouchKio Logo. @leukipp feel free to use this on your repository, if you like it

Thank you very much for this.
I have installed it on a Pi 4B (2GB) running Raspberry Pi OS 64 bit Trixie, with an ELECROW Portable Monitor 10.1" (1280x800).
The only problem I ran into was unconnected with this project - the pi insisted on sending 1920x1080 video to the screen. I was able to get this to work OK by scaling the HA kiosk in ~/.config/touchkio/Arguments.json, but the aspect ratio of 1920x1080 is different to 1280x800, so it was a bit distorted.
I eventually found where to override the resolution - by editing ~/.config/kanshi/config I got the Pi to send 1280x800 to the display.
Many thanks again.
Rhys

This is a great project! I’m using it with a RPi4 and a dedicated 14" touchscreen from Amazon that has a Pi enclosure built-in.

A couple of uestions for those who are smarter than me…

  1. I would like the screen to turn off automatically and come on when triggered by motion sensor in the room. The switch off trigger seems to result in it turning itself back on fairly regularly.
  2. I would like a photo display “screensaver” - any solutions/thoughts?

See FAQ.

Use a second page and an automation to switch between them.