Skip to Content
Author's profile photo W. Snoep

Basic IoT scenario using HCP – part 3 – Integration with HCP

This blog is part of a series which is related to a end-to-end IoT scenario. This is the full scenario used for the mini CodeJam that was organised at the SAP Inside Track 2016 Belgium #sitBRU.

Basic IoT scenario using HCP and Particles and UI5 – the explanation

Part 3 – Integration with HCP

Welcome to part 3. In this blog we will connect our particle to HANA Cloud Platform.

Before we can actually start creating the user interface, we have to configure the particle cloud to the HANA Cloud Platform. We already connected the particle to the particle cloud, and configured our device and messages etcetera in HCP, but now we have to connect the particle to HCP.

To communicate between the particle cloud and the HANA Cloud platform we have to use a webhook.

An integration component inside the particle cloud which can call webservices.


Go to the Particle Dashboard and perform the last steps.

On the dashboard site, select the Integrations option.


In the integration tab, select the option to create a new integration.


In the next step, select the option of “Webhook”


In the top-right select the option of “Custom JSON”.


Replace the existing code with the following code.  Rename the “EVENT” to the name of the webhook you used with your Photon Code. This should be something like “WebHook_**”.
Be aware that you are not able to change the webhook after you’ve created it. You can only remove it and create a new one once again.

“headers” : {
“Authorization”: “Bearer {{HCP_BEARER}}”,
“Content-Type” : “application/json;charset=utf-8”
“requestType” : “POST”,
“deviceID”: “”,
“mydevices”: true,
“json”: {
“messageType”: “{{HCP_MTYPE}}”,
“messages”: [
“Humidity”: “{{HUM}}”,
“Temperature”: “{{TEMP}}”,
“Light”: “{{LIGHT}}”

Your code should look like this. So by now your HCP setting should be finished. Your particle is pushing data to the particle cloud. And the webhook is created to push the event data from the particle to your HCP IoT service.


Select the Logs option to view the data traffic from the photons to the HCP IoT service. The log show the traffic of all the photons active in your account.


The dashboard should show you the following:

  • WebHook_**
  • hook-sent
  • hook-response

The hook-response contains the response from HCP. The data from the response should look like the picture below.


Return to your HCP Message Management Service Cockpit and select the tile “Display stored messages”.


If all the code and settings are correct, then there should be a table named “T_IOT_[your message type id]”. Select the table and have a look
at the values that are being stored from your Photon.


Congratulations, you have just implemented your first part of the Internet of Things scenario with SAP HANA Cloud Platform!


Now let’s try to push a message towards the Photon. We’ll be doing this just to prove that you’re able to toggle a led”on the board. Grab the “led_test.html”, which is attached to this blog. Open the led_test.html in notepad. Change the Device ID within the led_test.html file to the device ID of your photon. You should use the particle device ID, not the IoT services device ID.


Use the particle device id available here:


Save your html file and open it in a browser. Select the “Turn the LED on” radiobutton and hit the “Do it!”


Your Photon has a test-led onboard on port D7. While you toggle the Led on and Led off on your HTML page, the led should respond.
This was just to show you the ease of the Particle API. Time to move over to the UI and create the scenario.


Congratulations! Let’s move over to the next blog and create a simple user interface.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Wim,

      I'm getting an error from my integration log because the humidity value is nan, maybe a hardware error or a mistake i  my configuration in Hana message?

      "LIGHT": "59.000000", "TEMP": "0.000000", "HUM": "nan"

      ook-response/WebHook_03/0{"msg":"Parse error. Expected [Humidity] of type [FLOAT] but received [\"nan\"]"}June 19th at 6:55:27 pmparticle-internal

      {"data":"{\"msg\":\"Parse error. Expected [Humidity] of type [FLOAT] but received [\\\"nan\\\"]\"}","ttl":"60","published_at":"2016-06-19T21:55:27.621Z","coreid":"particle-internal","name":"hook-response/WebHook_03/0"}

      Author's profile photo W. Snoep
      W. Snoep
      Blog Post Author

      hi Fadel,

      Great you came this far. Sorry for the delayed response because of holidays.

      Regarding your challenge, there could be various reasons behind the 'nan' value. For example a broken sensor, or wrong setup of the breadboard with the connected humidity sensor. Did you explicitly specifify the library as shown in blog 1. You need to include "ADAFRUIT_DHT".