Skip to Content

Introducing

To continue my last blog we will cover now the necessary steps on SAP Cloud Platform IoT service to get our data from the “SigFox” network.

From a architecture side we´ve a little different approach as e.g. for the IoT Gateway Edge REST.

The “device” sends now his data first to an “Base Station” with the “SigFox Radio Protocol”, this data is finally pushed to the “SigFox Backend”.

On the Backend you are now able to see the data and manage your device. The “SigFox Backend” also provides an REST API:

Based on the possibility that the “SigFox Backend” provide us an REST API, the “Gateway Edge” component will use this to communicate with “SigFox”:

To get access to the “SigFoX” REST API we need some configurtions on the SigFox side and as well on the IoT service side.

So lets start…

Creat API Access on the SigFox Backend

To allow access to the API from external we need to create a new “API” access, to do so go to the “SigFox” cockpit an switch to “Groups” and enter the “Group”:

Next click on the “API ACCESS” entry and creat a new one, as result u get the requireed “login” data to access the API:

Now we can switch over to the IoT service part.

Configure the SCP Iot Edge Gateway for the SigFox Network

First of all we need to download the software and go ttrough the necessary installation tasks whcih is described here.

If this is done we can set up the gateway by executing the follwing script and the “REST-SIGFOX” parameter:

No we need to edit the “config_gateway_rest.xml” file

with the required informations abot the IoT service Host:

….and the SigFox API access:

Next we need now to configure how the message looks like which we getting from SiFox.

This config was for me one of the challenging points, kudos here from me to @Andrea Bisogna and Ralf Ackermann for the support !!! Well done guys !

Please refere here to the documentation for the “Device Payloda Handling”.

Vefor we can adjust the “sigfox.json” file to your needs we need to create “capabilties, a sensortype and a sensor”.

Note: with the “redesign” if the UI for the cockpit we will also have a new UI for the API access and u can download the “yaml” file to import all API calls e.g. into postman:

Postman view:

Our final Sensor looks now like this:

{
        "id": "31",
        "deviceId": "23",
        "sensorTypeId": "23e433-7c1a-4e68-8c60-09be91acf4b1",
        "name": "SensorSigfox_01",
        "alternateId": "6213be7870672e"
    }

And is based on the follwing SensorType (with three capabilities):

{
    "id": "23e433-7c1a-4e68-8c60-09be91acf4b1",
    "alternateId": "5",
    "name": "Sigfox_Sensor_01",
    "capabilities": [
        {
            "id": "23drfr44-5d2f-4d19-ab07-86fdb796675e", /Temperature
            "type": "measure"
        },
        {
            "id": "1234eddd-6b28-480a-ab93-45e561343337", /Humidity
            "type": "measure"
        },
        {
            "id": "3443ss-97b6-4ee6-91ad-1c20216e540e", /Altitude
            "type": "measure"
        }
    ]
}

The final “sigfox.json”:

{
     "discoveryDevicesPollingInterval": 60000,
     "deviceTypes": [{
                        "id": "59e5c2033c87894c075d4f37",
                        "iotServiceDeviceType": "My Device",
                        "pollingApiInterval": 60000,
                        "sensorTypeAlternateId": "5",
                        "stringMeasure": false,
                        "msbFirst": false,
                            "frameParsingData": [{
                                "sensorAlternateId": [ "6213be7870672e04", "6213be7870672e04", "6213be7870672e04"  ],
                                 "arrayChunkByteStart": [ 0, 1, 2 ],
                                  "arrayChunkBitStart": [7, 7, 7 ],
                                  "arrayChunkBitSize": [ 8, 8, 8 ],
                                  "measureByteSize": [ 4, 4, 4 ],
                                  "measureCapabilityAlternateId": ["64ce523c9eee6b65", "c4af70bbae8af387", "176a7368861387e6" ]
                                   }
                                   ],
                                   "commandSensorAlternateId": [ "0" ],
                                   "commandSensorTypeAlternateId": [ "1" ],
                                   "commandCapabilityAlternateId": [ "20" ]
                         }
     ]
}

We can see in the config, we refer here to our existing “Sensor/SensorType/Capabilities”.

Authentification and startup

Due the fact we are now ready to start the gateway we need now one little peace to make this happen, the Authorization between IoT Gateway Edge and the IoT service Tenant.

Lets go now to “new” cockpit and click on the right upper corner at the user and download the certificate:

After successfully download extract the “certificate” in the “config” an change the password in the password.properties file.

Now its time to save our changes and start up our “Gateway” and lets verify whats happen during the startup:

A new network with id 4 is created:
INFO  (GatewayStarter) - Start topology alignment for network 4
Connection an data retrival works:
INFO  (DeviceManagerService) - Adding sensors to device 00270000055be1
INFO  (AcsiLogNodeRsp) - Sensor 0.0.0.0 added to device 00270000055be1
INFO  (ConfigManager) - Creating SigFox config manager...
INFO  (SigFoxService) - Discovery Devices polling task scheduled every 60000 ms
INFO  (DiscoveryManager) - Initialization successfully finished, start loading API endpoint
INFO  (GatewayMediaComm) - Loading endpoint on address: https://backend.sigfox.com
INFO  (GatewayMediaComm) - load default JVM trustStore
INFO  (SigFoxService) - No callback ip in config file
INFO  (DiscoveryManager) - API endpoint loaded, start network configuration
And i we wait…..we can detect a message was getting from the SigFox backend:
INFO  (AcsiPhysNodeRsp) - Device of type Endpoint added to topology with address 2BD0
INFO  (SigFoxService) - Adding default sensor with address 0.0.0.1 to device 2BD0 to manage polling API
INFO  (DeviceManagerService) - Adding sensors to device 2BD0
INFO  (DeviceManagerService) - Starting update of device 00270000055be1
INFO  (SigfoxDataPollingTask) - Getting SigFox messages for device 2BD0 into interval Fri Oct 20 16:57:12 CEST 2017 - Fri Oct 20 16:58:11 CEST 2017
INFO  (SigfoxDataPollingTask) - 1 SigFox messages retrieved for device 2BD0

Check the rsult in the cockpit

Let´s go now back to the cockpit and check the device we can see some interesting data.

The Data which are retrieved from the SigFox Network:

The Measures (the device was the last days down LiPo empty ;o)):

Finally u can see the new ui which is now based on sap ui5 !

For this update and all other changes/new features/bug fixes check the release notes.

You´re now able to see the status which gateway is available:

cheers,

fabian

 

 

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply