This is what we did to setup a dashboard at Recras.
We'll assume that Raspbian Buster (with desktop) is installed on the Raspberry Pi.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install vim chromium-browser xdotool unclutter cec-utils
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
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