Skip to content

SAPBlogCode/IOTApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enablement of SAP IoT Service in Cloud Foundry environment on SAP Cloud Platform: -

Open SAP Cloud Platform Cockpit and register yourself, if you have already registered then logon with your user credential.

Screenshot

Click on Global productive account. User has to provide quota to services, purchased in the sub-account, to make them available. 'Note:- IoT services in cloud foundry environment are only available for productive accounts.'

Screenshot

Click on button ‘New Subaccount’. A popup will appear. Fill the details for new subaccount as shown in below screen shot and click button ‘Create’.

Screenshot

A New subaccount is created. Click on newly created subaccount. Click on button ‘Enable Cloud Foundry’.

Screenshot

There would be a popup for ‘Organization Name’ which will have default name ‘_.

Screenshot

On press button ‘Create’, It will create a new Cloud Foundry Organization with filled name. Now click on button ‘Create Space’.

Screenshot

A dialog would be opened and enter details as per shown in below screenshot and press button ‘Create’.

Screenshot

It will create a new Space with filled name and you can see newly added Space in ‘Space’ section.

Screenshot

Click on newly created Space. It will navigate to that space. You can see section ‘Service’ tab in left side of page. This tab is having 3 sections – Service Marketplace (SAP provided services for which user has taken subscription), Service Instances (Instances created by user), User Provided Services.

Screenshot

Click on first tab Service Marketplace. You can see tile for ‘Internet of Things’ service, if you have subscription for this service.

Screenshot

Click on this tile, user can see documentation and Standard plans for this service.

Screenshot

Click on ‘Instances’ in left most section and press button ‘New Instance’ to create a new instance of IoT Service. A popup will appear.

Screenshot

In first screen (Choose Service Plan), select ‘standard’ service plan and press button ‘Next’.

Screenshot

Next screen (Specify Parameters) is optional, so just press button ‘Next’.

Screenshot

Next screen Assign Application) is also optional, so just press button ‘Next’.

Screenshot

In last screen (Confirm), Enter a suitable instance name and press button ‘Finish’.

Screenshot

A popup will appear, press ‘OK’.

Screenshot

A new IoT instance will be created. Sometimes it may take significant amount of time.

Screenshot

On click of newly created instance, user will be navigated to detailed page.

Screenshot

Now create a service key for instance, for that select ‘Service Keys’ in left most section and click on button ‘Create Service Key’.

Screenshot

A popup will appear, enter an appropriate name for Service Key and press button ‘Save’.

Screenshot

It will create a service key, which contains instanceId (IoT instance Id), cockpitUrl (IoT Cockpit URL), username (Cockpit Username), password (Cockpit Password). Copy username and password, which will be required for IoT Cockpit Login screen.

Screenshot

Go to space ‘IoT Application Demo’ and select tab ‘Service Instances’ under section ‘Services’ in leftmost part of page. Click on icon ‘Open Dashboard’ in ‘Action’ column of rightmost part of page as shown in below screenshot.

Screenshot

On click of icon ‘Open Dashboard’, Internet of Things Service Cockpit is opened in new tab.

Screenshot

Enter username and password in login screen as mentioned in above step (you can find in below screenshot).

Screenshot

Press button ‘Log On’.

Screenshot

Configuration of IoT things (Capability, Sensor Type, Sensor and Device) in IoT Service Cockpit: -

You can see Dashboard of ‘IoT Service Cockpit’.

Screenshot

In left side toolbar, select ‘Tenants’ tab and click on icon ‘+’ in right side of page to add a new tenant.

Screenshot

A new screen will be opened for tenant creation.

Screenshot

Enter a suitable tenant name and press footer bar button ‘Create’.

Screenshot

A new tenant is added with auto generated unique ‘ID’. Click on icon ‘+’ to assign user to tenant.

Screenshot

Popup will open to add member.

Screenshot

Enter user name as ‘root’ and role as ‘User’. Press button ‘Add’.

Screenshot

Click on tab ‘Tenants’ under ‘User Management’ Section. User can see newly added tenant and on click of tenant, user can see added users under ‘Members’ section of tenant.

Screenshot

Select tab ‘My Tenants’ under ‘User Management’ Section, all the tenants would be listed here.

Screenshot

Click on tenant ‘IotApplicationTenant’. It will navigate you to that tenant. Select ‘Device Management’ tab from left side toolbar where you can see Devices, Sensors, Sensor Types, Capabilities, Gateways etc.

Screenshot

Select ‘Capabilities’ under ‘Device Management’, click on icon ‘+’ to add a new capability.

Screenshot

A new screen will be opened. Enter a suitable capability Name, Alternate Id in General Information section and click on icon ‘+’ in Properties section to add properties as per your requirement. Add property Name and Data Type as shown in below screen.

Screenshot

Press footer bar button ‘Create’. A confirmation popup will appear, click on button ‘Confirm’.

Screenshot

Select ‘Sensor Types’ under ‘Device Management’, click on icon ‘+’ to add a new sensor type.

Screenshot

A new screen will be opened.

Screenshot

Enter a suitable sensor Name, Alternate Id in General Information section and click on icon ‘+’ in Capabilities section. Add capability from drop down as shown in below screen. Press footer bar button ‘Create’.

Screenshot

A new Sensor Type is added.

Screenshot

Select ‘Devices’ under ‘Device Management’, click on icon ‘+’ to add a new device.

Screenshot

A new screen will be opened. Enter a suitable device Name, Gateway (REST), Alternate Id in General Information section. Press footer bar button ‘Create’.

Screenshot

A confirmation popup will appear, click on button ‘Confirm’. Select tab ‘Sensors’ under ‘IotApplicationDevice’, click on icon ‘+’ to add a new device.

Screenshot

A new screen will be opened. Enter a valid sensor Name, Sensor Type, Alternate ID in General Information section. Press button ‘Confirm’ in confirmation popup.

Screenshot

Select tab ‘Certificate’ under ‘IotApplicationDevice’, press button ‘Generate Certificate’.

Screenshot

Select ‘pem’ in Certificate Type. Press button ‘Generate’.

Screenshot

A file with name ‘-device_certificate.pem’ will be downloaded to browser default download location and a popup will appear with Certificate Secret. Copy secret key which will be required for data ingestion.

Screenshot

Curl Command for data ingestion: - In MacBook curl command is already available. For windows you need to install curl command using link. https://stackoverflow.com/questions/9507353/how-do-i-install-and-use-curl-on-windows Open command prompt and go to the folder where pem certificate is downloaded.

Screenshot

Write command as shown.

Screenshot

Press 'Enter'. You can see status 202 which is an indicator that data has been successfully ingested in IoT Cockpit.

Screenshot

Select tab ‘Data Visualization’ under ‘IotApplicationDevice’, select sensor name which is assigned to device. Click on segmented icon ‘Tabular data or Graphicaldata’ on right most side of table toolbar.

Screenshot Screenshot

Similarly, using curl command, you can push more data records and see it in tabular/graphical form as mentioned above steps.

Screenshot Screenshot

Now click on ‘Tenant Information’ tab, user can see all the created Devices, Sensors, Sensor Types, Capabilities and Gateways.

Screenshot

Setup connection between IoT Service and UI5 Application (Destination Creation): -

Now we will create a destination to consume IoT data in SAP UI5 application. Go to subaccount ‘ibso-iot-services-poc’ and click on ‘Destination’ under ‘Connectivity’ section in leftmost toolbar of page. Click on ‘New Destination’.

Screenshot

Create a new destination as shown in below screen shot.

Screenshot

Press button ‘Save’.

Screenshot

Click on button ‘Check Connection’.

Screenshot

It will show message: Connection to {device} established. Response returned: “302: Found”

Screenshot

SAP UI5 Application development consuming IoT data: -

Click on Services in leftmost menu of page as we did for service ‘Internet of Things’. Select tile ‘SAP Web IDE Full-Stack’ and enable service, if not already done and click on link ‘Go to Service’. It will take you through SAP Web IDE portal, where we will develop SAP UI5 application.

Screenshot

Now right click on ‘Workspace’ to create new UI5 application using standard template.

Screenshot

In tab ‘Template Selection’, choose tile ‘SAPUI5 Application’ and press button ‘Next’.

Screenshot

In tab ‘Basic Information’, Give a suitable Project Name and Namespace and press button ‘Next’.

Screenshot

In tab ‘Template Customization’, Enter view name and press button ‘Next’.

Screenshot

In tab ‘Confirmation’, Press button Finish’.

Screenshot

User can see newly created UI5 application under workspace folder.

Screenshot

Open neo-app.json file.

Screenshot

Add highlighted code in neo-app.json so that UI5 application can connect to IoT data through created destination.

Screenshot

Open Main.view.xml file.

Screenshot

Add code as shown in below screenshot to show table in UI5 application.

Screenshot

Open Main.controller.js file.

Screenshot

Add code as shown in below screenshot to get data IoT data.

Screenshot

Right click on project and press Run -> Run as Web Application.

Screenshot

A Popup will appear, select ‘index.html’ and press ‘OK’.

Screenshot

A UI5 application will be loaded in new tab with IoT data as shown in below screen.

Screenshot

About

Integrating SAP IOT Services in UI5 Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published