How to use AGILE Kura REST api
This tutorial illustrates how to use the Agile Kura REST api to publish data. The example shows how to collect data from a Modbus device and publish it on a cloud platform using the interaction between NodeRED and Agile Kura. The Modbus device will be emulated using a software simulator, like .
Configure Modbus device
1. Download ModbusPal  on a computer that will act as a Modbus slave.
2. Open ModbusPal application as root and click on the “Add” button under the “Modbus Slaves” tab to create a Modbus slave device. Select an address (i.e. 1) and put a name into the “Slave name” form.
3. Click on the button with the eye to edit the slave device. Once the window is opened, add a coil with address 1 and set a value (0 or 1).
4. Close the editor and on the main window, click on the “TCP/IP” button under the “Link Settings” tab. Set the “TCP port” to 5020. Be sure that the selected TCP port is opened and reachable on the system.
5. Click on “Run” button to start the device.
Configure Agile Kura Assets
1. Access the Eclipse Kura Web UI and select the Packages section
2. Install the ESF Modbus Driver from the Eclipse Kura Marketplace . The ending setup should be like the one in the following image.
3. Define a new Modbus Driver instance in Drivers and Assets by clicking on the New Driver button, selecting the proper factory and setting a name, for example modbusDriver.
4. Configure the new service as follows:
- access.type: TCP
- modbus.tcp-udp.ip: IP address of the system where ModbusPal is running
- modbus.tcp-udp.port: 5020
5. Create a new Asset by clicking the New Asset button and setting a proper name, e.g. modbusAsset
6. Configure the just created Asset, specifying the same Channel setup as the one specified in the ModbusPal application.
Configure Agile Kura Cloud Connection
1. Access the Cloud Services section
2. Configure the connection to the remote cloud platform. For example, for Everyware Cloud, specify the MqttDataTransport section by defining the broker-url, the topic.context.account-name, username and password as needed. DataService needs to be updated as well setting to true the connect.auto-on-startup parameter.
Configure Agile Kura REST Cloud Publisher Component
1. Create a new Component instance by selecting the org.eclipse.kura.internal.rest.publisher.PublisherRestService factory and specifying a meaningful name, e.g. agilePublisher
2. The just created component can be configured in terms of publishing topic and MQTT message options.
1. Access the NodeRED Agile dashboard
2. Create a new Flow specifying 5 components:
- Two instances of Http Request
- One function Component
- One Debug component (optional, for debugging/logging purposes only)
3. Configure the Inject component as follows:
4. Configure the first Http Request component as follows. The authentication username and password default to admin:
5. Configure the function component as follows:
6. Configure the second Http Request component as follows. The authentication username and password default to admin:
7. The final flow will be something like this:
8. Click on the Deploy button and start the graph execution by triggering the inject component.
Access Everyware Cloud
1. Access to the provided Everyware Cloud account
2. Select the Data tab and access to the data stored by topic
3. Consult the data fetched from the simulated field device and now available from the cloud.