I got bored and thought it might be nice to have a simple way for my partner and I to see what is coming up next in our lives.
The finished product
So I'm not going to go over the exact setup here, it is pretty easy to do with a free account at dakboard.com. I'll just tell you the commands you need to do what I did. Just get yourself a fresh Raspberry Pi and input the following commands:
sudo apt update
sudo apt upgrade
That will get the old girl up-to-date and ready to do cool stuff.
You'll need to grab your Private URL for the board you have no doubt created at dakboard by now:
Get your URL from here.
So you are gonna need to setup chromium to launch when the pi boots. To do that, first ensure the following directory path exists:
~/.config/lxsession/LXDE-pi/
Once it does, run the following:
sudo nano ~/.config/lxsession/LXDE-pi/autostart
This file will tell your raspberry pi what to do instead of its normal boot process. Inside this file, we can paste this:
@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --noerrdialogs --kiosk YOUR_URL_HERE
Make sure to replace YOUR_URL_HERE with your board URL.
Let's also get the pesky cursor to go back into the fiery chasm from whence it came:
sudo sed -i -- "s/#xserver-command=X/xserver-command=X -nocursor/" /etc/lightdm/lightdm.conf
That will pretty much do the job.
Bonus Round 1: .sh script to refresh the browser
If you don't want to wait the default one hour for the dashboard to update, you can install xdotool
to help.
sudo apt install xdotool
Once this is installed, make yourself a nice .sh script and put this goodness within:
export DISPLAY=":0"
WID=$(xdotool search --onlyvisible --class chromium|head -1)
xdotool windowactivate ${WID}
xdotool key ctrl+F5
That should refresh the page when you run it. If it doesn't, let me know!
Bonus Round 2: Scheduling
To go the extra mile and save the planet, you can add a cronjob for disabling the monitor on a schedule.
To do this, we will need to disable DRM VC4 V3D driver. Not 100% sure what that is, but it gets in the way of turning the monitors on and off.
sudo nano /boot/config.txt
In that file, find the line dtoverlay=vc4-kms-v3d
and comment it out.
This sucka
With that bad boy disabled, the following two commands can be used to turn the display on and off:
vcgencmd display_power 0
vcgencmd display_power 1
For all of you non-nerds (I assume that will be roughly none of you) 0 if off and 1 is on.
So to do this in crontab, first open the sudo crontab:
sudo crontab -e
If it asks you some nonsense about VIM and Nano, pick Nano. VIM is for the master race and I can't do it.
Then, paste this gear in there:
0 19 * * * /usr/bin/vcgencmd display_power 0
0 7 * * * /usr/bin/vcgencmd display_power 1
This is set to have it on from 7am to 7pm. You can probably figure out what to change to get the time you want, but if you need help, crontab-guru is a great resource!
Conclusion
Oh my god, that was longer than I wanted it to be. Hope that was helpful. If not, just let me know and I will likely do nothing about it. Peace.