Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

SAP Cloud Platform launched the IoT Service in May this year. For those who are interested in the overall picture I would like to forward you to the SAP Enterprise Architecture Explorer providing more insight how it fits into SAP Leonardo IoT specifically SAP Leonardo IoT Foundation.


IoT Service Cockpit offers number of benefits and services to the Developers to on-board Devices, create Endpoints, Configure Events/Alarms. It lets us consume the real-time sensor data on Cloud (IoT Gateway Cloud) as well as provides IoT Gateway Edge services. IoT Gateway Edge enables us to process the sensor data near the Sensor network without the need to send it to SAP Cloud Platform. Have a look at this introductory blog about IoT 4.0 Leonardo for Next Gen Business to get overall picture.


This tutorial's going to be a series of posts starting with this First Blog on getting yourself on-boarded with IoT Gateway Cloud. Later, I'll be also sharing topics related to IoT Gateway Edge, Device Lifecycle Management, User Management and others.


Here's my attempt to share the learning I got from recently concluded DevCamp in Labs Bangalore. Following were the topics which we were introduced and I've come-up with this Video Tutorials which hopefully will help people get on-boarded with the latest Leonardo IoT Service Cockpit.


Topics: - [ IoT Gateway Cloud ]

  • Check the Pre-requisites.

  • IoT Gateway Cloud Services with MQTT Network Devices (Simulator - PAHO Client)

  • IoT Gateway Cloud Services with REST Network Devices (Simulator - POSTMAN Client)






Pre-requisites:

  1. Access to SCP IoT Services 4.0 Instance

  2. Java 1.8 Installed and JAVA_HOME Configured (check below)


STEPS: -




  • Right click on My Computer > Properties > Advanced System Settings > Environment Variables

  • Under System variables, click on New and enter following

  • Variable name: JAVA_HOME

  • Variable value: path of the JDK installation folder (for ex: C:/Program files/java/jdk1.8.0_73)


 

  1. Install the MQTT Network Simulator (PAHO Client)

  2. Install Chrome POSTMAN Extension.


 

Demo




 




IoT Gateway Cloud Services MQTT Protocol:

 

  1. Introduction to "IoT Service Cockpit"

  2. Creating Device Data Model

    • Downloading Centralized Data Model

    • Extending Data Model with Custom Profile

    • Uploading New DataModel back to the Cockpit.



  3. Device Onboarding

    • Creating Physical Node

    • Download Certificates of Physical Node



  4. Send Data from MQTT Device Simulator (PAHO Client)

    • Configure PAHO Client with Device Certificates for Secure Communication

      • ssl://<HOST_NAME>:8883

      • Give password for Trust Store



    • Connecting to MQTT Gateway Cloud ("Make sure to connect to SAP_Internet")

    • Creating Logical Nodes (E.g. Sensors) Under the Physical Node.

      • Topic: measures/<MAC_ADDRESS>

      • E.g. {"measureIds":[1,2], "values":["75","30"], "profileId":XXX,"logNodeAddr":2 }



    • Sending MQTT Message Data via MQTT Body



  5. Consume & View the Data



Demo


 



 




IoT Gateway Cloud Services REST Protocol:

  1. Creating Device Data Model - Update with Custom Profile. Upload the Updated DataModel back to Service Cockpit.

  2. Device Onboarding

    • Creating Physical Node (Type: Endpoint)

    • Download Certificate of the Physical Device

    • Generate .p12 Certificates from client.ks. Run this command from certificate folder -

      • keytool -importkeystore -srckeystore client.ks -destkeystore client.p12 -deststoretype pkcs12



    • Refer the password file. Keep the Password same for all three times. .p12 file generated successfully.



  3. Enable SSL Certificate on Windows(Chrome Browser). Chrome -> Settings -> Manager Certificates. Import new .p12 file.

  4. Sending Data from POSTMAN using Secure Certificate.

    • Need to Close all chrome.exe instances. Use this command -

      • TASKKILL /IM chrome.exe /F



    • This will close all the chrome browser instances including POSTMAN(if open). You can optionally re-install the POSTMAN client following the Prerequisite video.



  5. Open POSTMAN and execute the POST call using this syntax -


  6. Consume & View the Data



Demo




 

NOTE:

  • The availability of IoT Service Cockpit instance is currently limited to Customers.

  • This blog serves as a reference for quickly starting-off your IoT Journey with SAP Cloud Platform Internet of Things.


Get your hands dirty with the IoT Service and then further exploring SAP Leonardo IoT. Feel free to ask questions and provide feedback to improve the blog contents.

 



 











Last Modified 23rd Jul, 2017
Document Version 1.0

 
14 Comments
akshat_kharial
Discoverer
I was there at the Dev camp. Great job, Prakash.This article summarises it perfectly.
Former Member

Hi Prakash,

IoT 4.0 available on SCP Trial account? if not, can we expect this on trial account in near future.

 

Thanks

 

Former Member
0 Kudos
Hi Yogendra,

Not yet! Tenants are only given to the Customers.
Former Member
0 Kudos
Thank you for the awesome tutorial.
Former Member
0 Kudos
Glad you like it! 🙂
AvijitDhar-IBM
Explorer
0 Kudos

Hi Prakash,

Thanks for the tutorial. Recently we have purchased our IoT 4.0 Tenant but I don't see any Active Networks inside my IoT Cockpit. Can you please tell me how I can add the Active Networks like MQTT, REST which you have used in your example. My Netoworks inside IoT 4.0 cockpit look like the following -

Please help.

Thanks

Avijit

 

0 Kudos
Hi Prakash,

Thank you for the really nice videos. they are really helpful!

We also have a IoT 4.0 tenant. I tried with and MQTT - Paho Client and i get the expected result, but when I tried REST - Postman I get the following error - 415 Unsupported media type.

I tried running the URL directly in chrome and in the console i see 2 errors



Could you please help ?



Thanks,

Prerana
Former Member
0 Kudos
Hi Prerana,

You shouldn't use Chrome for POST request. For above issue, you should check the content-type to be application/json in POSTMAN Headers and try giving valid MAC address in the URL.
0 Kudos
Hi Prakash,

Adding the header - application/json in postman worked! Thank you very much!

Best Regards,

Prerana
Former Member
0 Kudos
Hi Prakash,

I have tried both the MQTT and REST approach but in both the case even though I am getting a successful posting status but the data is not showing inside my Cockpit. Can you please help on this?

The postman shows a 200 status.



But the gauge is not showing any data. Can you please help?

Former Member
0 Kudos
Hi Prakash,

I am unable to connect to MQTT broker in sap iot cockpit what might be the issue? .I have raised a question for the same in SCN.Kindly requesting if u can check the same

https://answers.sap.com/questions/329038/unable-to-connect-to-mqtt-broker-in-sap-iot-cockpi.html
Former Member
0 Kudos
Hi Deepan,

Make sure to watch the 2nd Video where I explain about onboarding device and paho client configuration. And give correct <HOST_NAME> with the ssl check box and correct Certificate details downloaded from the IoT Cockpit.

 

It should work then.
former_member183990
Active Contributor
0 Kudos
Do we have any trial version for SAP Leonardo?
Former Member
0 Kudos
Is there any way to connect to IoT Service Cockpit with MQTT , without paho client ?