Skip to content

Instantly share code, notes, and snippets.

@timmipetit
Forked from pmoranga/README.md
Last active January 21, 2020 13:42
Show Gist options
  • Save timmipetit/702631d29c610a5082c588e437939e12 to your computer and use it in GitHub Desktop.
Save timmipetit/702631d29c610a5082c588e437939e12 to your computer and use it in GitHub Desktop.
Raspberry pi dashboardrpi screens

Raspberry pi dashboard

This is what we did to setup a dashboard at Recras.

Preparing the system

We'll assume that Raspbian Buster (with desktop) is installed on the Raspberry Pi.

Update the OS

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Install required software

sudo apt-get install vim chromium-browser xdotool unclutter cec-utils

Start the browser on boot

Create a script in /home/pi/dashboard with the code that will run chromium in kiosk mode and press the 'F5' key every hour.

#!/bin/sh
chromium-browser \
--kiosk \
--disable-web-security \
--disable-restore-session-state \
--start-maximized \
--incognito \
--fast \
--fast-start \
--disable-popup-blocking \
--disable-infobars \
--disable-session-crashed-bubble \
--disable-tab-switcher \
--disable-translate \
http://yourdashboard.com &


while : ; do
  sleep 3600;
  xdotool  key F5
done

Add execution permition to the script

chmod +x dashboard

Change the contents of /etc/xdg/lxsession/LXDE-pi/autostart to this:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@xset s noblank
@xset s off
@xset -dpms
@unclutter -idle 0
@sh /home/pi/dashboard

Turn tv on/off automatically

We'll use HDMI-CEC to turn the tv on and off at specific times. Make sure you tv supports this. On Samsung tvs you'll need to enable Anynet+ with the "Auto turn off" option. If your tv/screen doesn't support HDMI-CEC, you can use the alternative option. This will use the tvservice command to power of the display output.

Create a file /home/pi/tvoff with the following contents:

#!/bin/sh
echo "standby 0" | cec-client -s
# alternative: power off the display output
# /opt/vc/bin/tvservice -o

and create a file /home/pi/tvon with these contents:

#!/bin/sh
echo "on 0" | cec-client -s
# alternative
# /opt/vc/bin/tvservice -p ; sudo chvt 6; sudo chvt 7

make them both executable

chmod +x /home/pi/tvon
chmod +x /home/pi/tvoff

and add them to your crontab config (using crontab -e)

0 8 * * * /home/pi/tvon >/dev/null 2>&1
0 18 * * * /home/pi/tvoff >/dev/null 2>&1

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment