The goal of this blog post is to share a SAPUI5 dashboard that I have built in the HANA Cloud Platform (HCP) using the SAP Web IDE to extend the SensorPhone application from another blog post. Within a few minutes, you will be able to visualize the sensor data that is streaming from your iPhone to HCP. Please check out Pat Colucci's SensorPhone blog post
here.
Before we get started, here is what you will need:
- The iOS SensorPhone app - version 1.3.2
- iotmms, configured to the instructions outlined in the SensorPhone tutorial
- HCP account
- The DashboardInCloud.zip and iotmms file, located here.
Step 1: Save the iotmms Table Name
If you have followed the SensorPhone tutorial, you should be able to view the sensor data in the HCP iotmms. To open the iotmms, select
Java Applications in the HCP side panel. The iotmms should already be deployed. Select
iotmms to open the iotmms overview page.
The Application URL should now be displayed. Select the URL to launch the iotmms application.
Note: The service must be started in order for this step to work.
Select the
Display stored messages tile.
A list of the existing table names are displayed. One of the tables should contain your sensor data. The table was automatically generated from your first HTTP Post in the SensorPhone tutorial. Select the table that contains the iPhone sensor data.
Copy the table name.
Note: Only copy the text that begins with T_IOT_. You do not need the part that begins with NEO_.
You can also find the table name by selecting
OData API, located at the top right of the table. By clicking the URL, you will open a new tab and find the table name in the first <id></id> tag, shown below. Save this table name because it will be necessary to access the data in the dashboard application.
Step 2: Create IoT Destination
Creating a destination will allow you to access the data within the Message Management Service (mms) in HCP.
Select
Destinations in the HCP side panel, then select either
New Destination or
Import Destination.
You can manually enter all of the table data or use the iotmms file to import the destination settings. Please do not change the name of this destination. Update the URL ( https://iotmms<userID>trial.hanatrial.ondemand.com/) to include your I-number or P-number. Entering the HCP username/password under Authentication will allow you to access the destination from the dashboard without having to constantly reenter your username/password.
Hit
Save and then
Check Connection. If everything was entered correctly, you should receive a popup message that indicates a successful connection.
Step 3: Import the Dashboard to SAP Web IDE
To open SAP Web IDE, please select the
Services option on the HCP side panel. Scroll down to the SAP Web IDE tile. Enable this service if you have not done so already. Select the
SAP Web IDE tile and then select the
Open SAP Web IDE link.
Within SAP Web IDE, select the
Workspace folder and right click to view the available options. Select
Import >
From File System. Navigate to the DashboardInCloud.zip file. You can download the zip file
here.
After the file has been imported to the SAP Web IDE, select the
index.html file and then select the
Run icon.
A new tab should open with the settings page. Enter the table name from Step 1 and then select the desired refresh rate. If you are not streaming any data from the SensorPhone application, leave the refresh rate as
Just Once. If you are streaming data from the SensorPhone application, select the matching refresh rate and the chart will update automatically.
Selecting the Start button will pull the data from the mms, using the destination, and will display the top 30 values in a table.
The example table below only has 3 rows of data. S
elect the View Chart option in the top left of the screen to visualize the sensor data.
Currently, the chart is only showing the accelerometer data from the iPhone, but this can be easily changed to include other values.
If you are streaming data from the SensorPhone app or manually publishing the data from the iotmms, select a refresh rate other than
Just Once and the chart will update automatically.
Final Thoughts
The HANA Cloud Platform provides users with a complete set of tools and services to develop virtually any IoT project. In the
SensorPhone tutorial, you were able to easily create device types and messages to collect sensor data in HCP. Using the same platform, you are now able to visualize the data from your devices. The project can be easily extended to integrate with core ERP modules, such as SAP Plant Maintenance. For example, rules could be setup to trigger events within the PM module to create a Work Order or Notification.
Anthony McLeod
LinkedIn