In this new Blog series, i want to cover a complete walktrough to SAP Leonardo Foundation IoT and my experience with this products.
And hopefully u can see how easily u can create and work with this products, to “connecting things with people and processes“.
In detail u can expect the following content:
|1||Create your virtual twin with SAP Cloud Platform Application Enablement (this blog)|
|2||Build up an IoT App on top of SAP Cloud Platform Application Enablement|
|3||Deploy your SAP Cloud Platform IoT Application Enablement App to the Cloud Foundry Environment|
|4||How to display a route in a SAP Cloud Platform Application Enablement IoT Application|
|5||How to connect SAP Analytics Cloud to SAP Cloud Platform IoT Application Enablement – part 1|
As already mentioned at e.g. SAP TechEd, the SAP Leonardo IoT Foundation is the technical backbone and provides in detail the following core services:
- Technical Services
- Data Management
- Business Services
In my last blogs my primary focus was on the Technical services, in the upcoming blogs i want to guide you trough the IoT Business Services wich are bundeled in SAP Cloud Platform IoT Application Enablement (AE).
Introducing to SAP CP IoT AE
SAP CP IoT AE consists of the follwing main features:
- Thing Services
- UI Content and Event Services
- Administration Services
- Analytics Services and APIs
- Location Services
- Rules Framework and Machine Learning*
With SAP CP IoT AE we are now able to use diferent microservices/API´s to build up our virtual/digital twin.
For our scenario we would now start already by the “Technical Services” to connect a thing to IoT service. For the simplicity i would use here my notebook/CPU usage, but this also works for example on a Raspberry PI.
A detailed description exists also for SAP Cloud Platform Internet of Things for Neo environment can be found at the “SAP Developers” page here
For the new SAP Cloud Platform Internet of Things for Cloud Foundry environment, the used script must be adopted, for this check the github link below.
Repetation: Device Creation in SAP CP IoT service (via the improved UI)
Create a capability:
Create the Sensor Type and link the previously created capability:
Create your Device:
Finally create the Sensor for your device and link the Sensor Type:
To communicate on a secure way with IoT service we need the device certificate (i use here the PEM format) of our “Notebook”:
Important write down or copy the “Certificate Secret”, we need this in the next step for the creation of the key file.
Now its time to transform our certificate:
>openssl rsa -in ./MyNotebook-device_certificate.pem -out credentials.key Enter pass phrase for ./MyNotebook-device_certificate.pem: <Certificate Secret> writing RSA key >openssl x509 -in ./MyNotebook-device_certificate.pem -out credentials.crt
We still now prepared to send the data to SAP CP IoT service, by executing the script but this i not required.
Because we want to build uour virtual twin, so lets enter SAP Cloud Platform IoT Application Enablement (AE).
Create the Digital Twin with the Thing Modeler with SAP Cloud Platform IoT AE
The entire point is now to enter the SAP IoT AE Launchpad were we cann access different applications.
In FLP we can now see the different tiles for the Tenant Administration an the the IoT Thing Modeler etc.
Important: Please have also a closer look in the detailed documentation about the “Thing Modeler” and his features here.
Our starting point is now the “Package Manager” to create a new package.
A detailed documentation about “Packages” can be found here.
After the successfully creation of the package we opening the “Thing Properties Catalog”:
During the creation of the package you can define, one the follwing “Scopes”:
If your package is e.g. defined as Tenant, you are able to reference to other packages.
This is helpful i u want to reuse existing own “Property Sets” or SAP predifned “Property Sets”:
Define the Property Sets
In the Thing Properties we create now two new property sets:
|Product Data||Basic Data|
Also here pls check the documentation for detailed informations here.
The Product Data property set consists for “general” properties:
For the real “measures” we using the “CPU property set.
In the “Measured Values” section we add the “usage” with the uom an the data type and finally we specify a lower and upper “Threshold“:
Important: To define a “Property Set” from Type “Measured Values” its important to check this documentation for the successfully onboarding and the prerequisites.
In short to connect the “Thing” from IoT AE with the “real Device” from IoT service, the matching between the capabilty (IoT service) and the property set (IoT AE) must be identical, otherwise the mapping does not work. Therefore check always the documenation.
Finally our “CPU” property set looks now like this:
In the lower right corner we can now jump directly in the Thing Modeler:
Create the Thing Type
We creating now our “Thing Type” by filling up some basic information.:
Afterwards we adding now the property sets.
As u can see below based on the reference (during the package creation), we´re able now to choose also these one of these property sets for our thing:
But for now we want only using here our own defined property set.
Optional it´s possible to add a image to our “Thing Type” to having an visualization for the thing:
Connect the “virtual” thing with the “real” device
This most interresting task will be covered in the next few lines.
We connect now both “IoT worlds” (IoT service and IoT Application Enablement) ;o) together.
For this we just clicking in the upper left corner on the “new Thing”:
Afterwards we fill the required data and link now the “Thing” from SAP CP IoT AE to our SAP CP IoT service device:
And whoot….., the “matching” between the “capabilities” (IoT service) and the “property set” (Iot AE) is correct an we got now a successfull “Data Type Match” result !
After we complete this task, we got now the unique “Thing ID”.
Send data to IoT service and check if the data ingestion works
If we now come back to our entire python script, now its time to exectue this:
….we should now get the following console output, the value 200 eq HTTP 200. Our data is therefore successfully posted to SAP CP IoT service:
if we check now check this, we can see the data as well in the visualization:
And finally if we switch over to SAP CP Application Enablement, we can also the the data whcih is succesfully transfered from IoT service via “Ingestion Pipeline” into SAP CP IoT Application Enablement:
For all API fans (like me), SAP IoT AE provides a lot of API´s where we can CRUD access to our things.
E.g. we can already read the “Time Series Store” by calling the follwing REST API:
In the next blog we would continue the little story.
We will create an SAP UI5 application with the SAP Web IDE (Full Stack) to visualize our Data and display our things.
Overview about Helpful Links