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.

openHAB

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

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

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

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

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

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

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

Chromium

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.

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.

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:

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.

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.

The annoying warning is finally gone:
photo

Conclusion

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

Leave a Reply

Your email address will not be published. Required fields are marked *