In The Air – Week 12

I’m using a Beaglebone Black and BB View as the main user interface. Because the BB View is a touch screen, I want to avoid the need for another input device such as a keyboard.
In this post, I’ll set up openHAB and Chromium to start automatically and visualise the openHAB GUI without having to enter an URL or open a browser manually.


First, I created a script which will launch the desired application, in this case: openHAB. The script will be put in “/usr/bin”.

debian@beaglebone:~$ sudo nano /usr/bin/


The script needs to be made executable so it can be launched successfully.

debian@beaglebone:~$ sudo chmod u+x /usr/bin/

Next, create the service. Some prerequisites can be specified, for example the need of having the network up and running first.

debian@beaglebone:/usr/bin$ sudo nano /lib/systemd/openhab.service


Create a symbolic link to let the system know where to find the service:

debian@beaglebone:~$ cd /etc/systemd/system
debian@beaglebone:/etc/systemd/system$ sudo ln /lib/systemd/openahb.service openhab.service

Try starting the service to check for mistakes/errors. If all is well, the service can be enabled.

debian@beaglebone:/etc/systemd/system$ sudo systemctl daemon-reload
debian@beaglebone:/etc/systemd/system$ sudo systemctl start openhab.service
debian@beaglebone:/etc/systemd/system$ sudo systemctl enable openhab.service

As a final check, reboot the Beaglebone Black to confirm it’s working as expected.

debian@beaglebone:/etc/systemd/system$ sudo reboot

After reboot, the openHAB start script seems to be running, this is a good sign. Checking the logs, openHAB is started as expected!

debian@beaglebone:~$ ps aux | grep start

root       758  0.0  0.0   1336   440 ?        S    18:59   0:00 /bin/sh /opt/openhab/
root       996  0.0  0.5   5864  2676 ?        Ss   18:59   0:00 /usr/sbin/apache2 -k start
www-data  1003  0.0  0.3   5644  1996 ?        S    18:59   0:00 /usr/sbin/apache2 -k start
www-data  1005  0.0  0.4 227056  2364 ?        Sl   18:59   0:00 /usr/sbin/apache2 -k start
www-data  1007  0.0  0.4 227048  2356 ?        Sl   18:59   0:00 /usr/sbin/apache2 -k start
debian    1323  0.0  0.1   1576   592 pts/0    S+   19:00   0:00 grep start
debian@beaglebone:~$ less /opt/openhab/logs/openhab.log

2015-01-14 19:00:39.422 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.6.0).
2015-01-14 19:00:50.451 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2015-01-14 19:00:51.111 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2015-01-14 19:00:51.168 [INFO ] [.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2015-01-14 19:00:51.180 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection 'eclipseiot'
2015-01-14 19:00:57.860 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'rrd4j.persist'
2015-01-14 19:00:59.817 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'intheair.items'
2015-01-14 19:01:11.457 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'intheair.sitemap'
2015-01-14 19:01:15.109 [INFO ] [] - Started REST API at /rest
2015-01-14 19:01:21.365 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /


To automatically start applications when the desktop loads, an “autostart” file can be edited to add the required applications.

At the end of the file, I appended a line to start Chromium automatically and open the openHAB web interface. I’ve also added the “–kiosk” option, which will load Chromium in full screen mode without the possibility to close it. This will be useful to avoid anyone accidentally closing the application or tampering with the system.

debian@beaglebone:~$ sudo nano /etc/xdg/lxsession/LXDE/autostart

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@chromium --kiosk "http://localhost:9090/"

The result after having applied the changes and rebooting the system, is the following:
photo 1

There are two issues with the above screenshot:
Chromium is started and attempting to open the openHAB GUI before openHAB is fully started
There is a warning message at the top regarding missing API keys

On the good side: Chromium is started in kiosk mode and trying to open the correct URL, meaning the command works.

To solve the first issue, I chose the quick and dirty solution of adding a delay. Because other “custom” commands might be needed, I moved the delay and startup of Chromium to a separate script and called that script in the “autostart” instead.

I added a 2 minute sleep before starting Chromium, giving openHAB enough time to start properly.

debian@beaglebone:~$ sudo nano

sleep 120 && chromium --kiosk "http://localhost:9090/"
debian@beaglebone:~$ sudo chmod u+x
debian@beaglebone:~$ sudo nano /etc/xdg/lxsession/LXDE/autostart

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@sh /home/debian/

After rebooting, Chromium is started 2 minutes later as expected and the openHAB GUI loads properly. Ideally, I should check for openHAB’s status until fully started and then launch Chromium.
photo 2

The get rid of the second issue, the Google API keys warning, some environment variables need to be set:

debian@beaglebone:~$ export GOOGLE_API_KEY="no"
debian@beaglebone:~$ export GOOGLE_DEFAULT_CLIENT_ID="no"
debian@beaglebone:~$ export GOOGLE_DEFAULT_CLIENT_SECRET="no"

Using “set”, it is possible to confirm the variables have been set. Unfortunately, setting them like this is not permanent and a reboot will lose the information.

debian@beaglebone:~$ set


This is where the custom script from earlier comes in handy. I added the “export” statements into the script, which results in them being executed at every startup.

debian@beaglebone:~$ sudo nano

export GOOGLE_API_KEY=no
sleep 120 && chromium --kiosk "http://localhost:9090/"

The annoying warning is finally gone:


After powering on the Beaglebone Black, the openHAB GUI will open automatically on the touch screen without user intervention. Hooray!

© Frederick Vandenbosch, 2014-2021. Unauthorised use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Frederick Vandenbosch with appropriate and specific direction to the original content.