Kassis Netz / blog

This time it’s all about getting the Raspberry Pi to boot into kiosk mode and automatically showing our dashboard.

In the last episodes we got our Pi to be able to show our dashboard whenever we start the x-server manually.
To use the Pi for monitoring in the office we don’t want that manual step - usually there’s even no keyboard and mouse attached to it.
Thus it has to do everything on its own whenever you plug in the power cable.

At first let’s automatically start the x-server.
With our presettings we already did this should be easily done by adding the following to /etc/rc.local right above the exit 0

×

–

⬈

bash

$ su - pi -c 'startx' &
$

If you reboot now google chromium should start but will be unable to show the requested URL because we haven’t started dashing yet.

On a new reboot you will see a line stating ‘Starting dashing’ and after some time chromium should start, too.
However on my first attempt, chromium still wasn’t able to load http://localhost:3030/ – I had to use my mouse to reload the page and then it worked.

To tweak around this misbehaviour we can try other things.
First let’s install a cool tool which lets you send keystrokes to x-windows:

×

–

⬈

bash

$ sudo apt-get install xdotool
$

Now let’s first check the title we set for our dashboard.
If we’re using the sample dashboard without change, this will be “My super sweet dashboard”. This is also the name of our (fullscreen chromium) window.
Let’s reload it:

and watch how chromium reloads your dashboard.
This might become handy if you need a second try after startup, maybe after a sleep of 2 secons or so.

Another sidenote: if you want to use the run script from above to stop dashing, you may notice a delay because it’s waiting for the connected browsers to disconnect. A reload of the browser will also do this.