Summary. This tutorial explains how to build a Kura application into a bundle using Reactive Blocks. Then, the bundle is deployed on a Raspberry Pi and also configured.
Kura is an Eclipse project which provides an OSGi-based container for IoT applications running in service gateways. It provides API for configuration, communication, etc.
Learn more about Kura on the project’s website: http://www.eclipse.org/kura.
See for example here to find out how to connect a LED to a Raspberry Pi via a breadboard.
The first time you boot your Raspberry Pi, you need to set it up. If a monitor is connected to the Pi, the Raspberry Pi configuration menu is opened automatically. If you login to the Pi via ssh (default username and password are
pi/raspberry), run the command
Let us connect the Raspberry Pi to an MQTT broker.
After a while, you should see that the Pi is connected to the on the Status section.
You can create a (configurable) Kura application as described here. However, in this tutorial we will use an existing example application.
This is a simple example that toggles a LED and publish the LED state using MQTT.
When looking inside block Periodic Toggler or block Publisher you will see that both contain block Config Listener 2.
These properties are defined as metatypes in an XML file. The file is created for each system block of type Kura Application with Configuration and can be found in the OSGI-INF/metatype directory of the project. When running on Kura, this configuration will be picked up by the OSGi Metatype service. As developers, you specify the configuration properties of your application by modifying the XML file.
You should get generated files in the project. Some files are also updated.
Right-click the deployment package definition file KuraDemo.dpp and select Quick Build to generate the deploymet package KuraDemo.dp.
An easy way of finding out what is going on is looking at the log file. Log into the Raspberry Pi (for example using ssh) and type:
tail -f /var/log/kura.log
You should see that the application is publishing messages.
As described in the section Configurable Properties above, there are two properties in the example, namely toggle.duration and publish.topic