Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
fabianl
Product and Topic Expert
Product and Topic Expert
In the first blog of my litte SAP Cloud Platform IoT service series we´ve seen that we have two options to connect to IoT service.

  • IoT Gateway Cloud

  • IoT Gateway Edge


In this blog i want cover the "IoT Gateway Edge" component from IoT service, u can found here the complete list of the other blogs:



























  • Connect a device to the IoT service part 3 (via IoT Gateway Edge) - (this blog)









 

Please refer here for a detail overview to the documentation:



Please have a also a look into this nice article about SAP Leonard Edge Computing.

IoT Gateway Edge introducing


As described here the IoT Gateway Edge supports in differentiation to the "IoT Gateway Cloud" these protocols:

From my perspective is this part of the new IoT service really helpful to onboarding a device.

Especially if the device does not provide the feasability to transmit the data and futher to secure the commuincation.

Example: Some of our customers has already devices which are running since decades, based on old operating systems and finally the do not have anny connection to outside.

But of course they are able to perform simple I/O operations an can therefore write sensor informations to a file.

Based on this i want cover in the next lines how IoT service can also get informations via file by using the "Iot Gateway Edge" component.

The detailed documentation about this can be found here.

Installing and config the IoT Gateway Edge component for IoT service


The IoT Gateway Cloud Software runs on premise, the first thing is for sure to download the peice of software from the "SAP Software Center" and store the file on the system of your choice.

If we have extracted the archive we need now open our terminal or the CMD.

We execute now the "build.bat" or "build.sh" file following by the protocol in our case FILE:
$ ./build.sh FILE
Extracting Gateway file libs ...
... Plugin configuration ...
Removing unnecessary adapters .

As described in the offical documentation we must now configure some details.

In the "config" subfolder we need to edit the "config_gateway_file.xml" and change the hostname for this entries to our own IoT service tenant:
<cnf:connectionString>failover:(nio+ssl://<IoT_service_Tenant>.eu10.cp.iot.sap:61616?daemon=true&amp;soTimeout=60000)</cnf:connectionString>
....
<cnf:cxf lan="true">
<cnf:address dev="core"><IoT_service_Tenant>.eu10.cp.iot.sap</cnf:address>
....
<cnf:cxf lan="false">
<cnf:address dev="core"><IoT_service_Tenant>.eu10.cp.iot.sap</cnf:address>

For the "File" Scenario the "IoT Gateway Edge" component provides already some example files.

If u have a look into the folder and open the files u cann see we have one JSON based and CSV based file.



As documented we create a new directory called "gateway-file-examples" and later we will copy here the files from the "file-examples" directory.

 

To combine the "IoT Gateway Edge" with IoT service we must create an "Genetic Code" in the IoT service copickt.

In the "Sytem" panel click the "Advanced" entry and choose now the "Create a Genetic Code" widget:



Choose "System" as type and entering a name e.g. "gw_edge_file" and save our changes:



The next step is write down the id of our newly created "Genetic Code", for this select  "Apllications and Services" and click on "Genectic Codes". In the list u can now filter to our newly created "Genetic Codes":



Back to our "IoT Gateway Edge" installation.....

The next task ist to edit the "getway.sh" or "gateway.bat" file and changing the follwing line to our id:
-Dcom.sap.iotservices.genetic.code=1026 \

Finally we need now to download the user certificate from IoT services.

Go back to the IoT service cockpit and choose "Applications and Services " > "Users"

Download the certificates by choosing the "Keys" button:



The archive should be stored and extracted in the "config/certificates" folder of the "IoT Gateway Edge" installation. In my case i createt first the folder and in the next step i extarcted the archive inside this:



Now we open the "pswd.properties" file and enter the password of the user and save our changes:
#Thu Aug 03 08:54:31 UTC 2017
keyStoreServer=root
tenantId=0
user=root
password=insert_your_password_here
keyStorePassword=K3ysIns1de

At this point we have have finished all required settings.

Starting the IoT Gateway Edge


We can now start our IoT Gateway Edge software by executing the "gateway.bat" or "gateway.sh" (my case) script:
./gateway.sh

During the startup we can identify that a new "Network" is added to IoT service.

Before:



Startup and if readable ;o) we can se "Network" 4 is now added:

Result in IoT service:



Few lines ago i left out the point to copy the files into the "gateway-file-examples" folder.

We do it now and if we check the IoT service cockpit we can detect two things.

First we got two new devices:



This i based at the config in the "/config/readFileConfig/readFile.json" file:
{
"files" :
[{
"path" : "config/gateway-file-examples/Heller-Reflow-Profile-JSONExampleDataSet.json",
"mode" : "periodic",
"interval": 20000,
"schema": "reflow",
"machineId": "8D:E4:32:57",
"backupFolder": "config/fileBackupFolder/reflow"
},{
"path" : "config/gateway-file-examples/HS-Screw-Torque-Position-1.csv",
"mode" : "periodic",
"interval": 20000,
"schema": "screw_torque",
"machineId": "8D:E4:32:58",
"backupFolder": "config/fileBackupFolder/screw_torque"
}]
}

 

Second if we press the "Real-Time Measurements" widget we got now the data from the file in IoT service:



For details about the "files" and the detailed setup in the "IoT Gateway Edge" please read the  documentation:

Publishing Data From File

And for the other supported protocols an the specific details check this good documention to get more insights:

 

Comment: In contrast to my last blog, where i described that the next one will covered the creation of "devices" via API i´ve changed the topic. Sorry! I think this topic fits better in the "series".

 

cheers,

fabian
1 Comment
Labels in this area