Using the SAP HCP IoT Services
As a Product Manager for HCP, focusing on IoT, I have been asked to do a lot of CodeJams. Most of the CodeJams have been on Getting Started on SAP HCP, but with the new release of the SAP IoT Services, we can do IoT CodeJams. For the CodeJams and other events, we need a step by step process on how to get started. Using Michael Ameling’s great “how to” post as a starting point, and trying to re-use as much of his team’s code as possible, I created a number of tutorials. And since I also wanted to help people get started before they had hardware, I added in how to test your IoT Services using Postman (a REST Client). If you, never used one of these, it will help get you started with APIs.
I shared them with colleagues to get them proofed and tested. They gave me great feedback and then passed them around internally here at SAP. So I figured that I could just post them here and share with the wider SAP Community.
Here they are:
- Getting Started with the IoT Services– Just like is says, this gets you going.
- Connecting a Java HTML UI5 GUI– Creating a simple graph and how to upload it.
- Connecting a UI5 GUI using WebIDE– This uses the SAP WebIDE to build everything. –added details on how have both the WebIDE and Java working
- Nodejs and Python– Writing the python or node.js code that you will need.
- Building up the hardware– Using a Tessel-
- Completing the Round Trip- Using the messaging to send messages to your devices.– coming soon
Links:
Rui’s Fish Import/Export – how to build a full project using SAP HCP
The SAP HCP Podcast
SAP Insurance’s IoT House Video
Where SAP HCP is traveling
Gamification Service– How get started with SAP Gamification
The tutorials are easy to follow and helpful especially when you don't have any hardware device at hand.
Thank you for this awesome post!
you are welcome...
Great tutorial. I used it along with the "Starter Kit for the SAP HANA Cloud Platform Internet of Things (IoT) Services" (https://github.com/SAP/iot-starterkit).
I purchased a GrovePi+ Starter Kit For The Raspberry Pi from Dexter Industries (Raspberry Pi Internet of Things Kit). Their team was very responsive to get my GrovePi+ up and running. Then I adapted the example provided in the Starter Kit - I have a rotary angle sensor rather than a slider... no code change here) and I used a LCD RGB display instead of the OLED one. Only very minor change required.
Here is a photo of my computer. You can see the UI5 app that displays the data on the HANA Cloud Platform, my Raspberry Pi console, and my webcam showing the output on the LCD.
I plan to use the button from the kit to trigger the start/stop of data collection instead of having to crank up the sensor to the max to start and then to 0 to stop. I would also like to do some statistical analysis of the values... things like average, max, min, rate of change, etc.
More to follow.
In closing, thanks to the community for sharing so much knowledge that getting up and running was very easy!
David
David, this is great, you really should create a blog post for it, so that more people can see it and learn from it!
Thanks Aaron - will do when I get something a bit more substantive up and running.
Aaron - you did it again end-to-end tying all of the innovations together from iot device management to ui5 user experience.
To me the gem in this series is the transition from the hana table exclusively used by the mms service to an xs service exposing odata such that analytics tools from Microsoft (like PowerPivot) or SAP (Smart Business) can make use of it.
Thanks. As much as I would like to take full credit for that, I got about 95% of the code from one of our great Architects, @Anton Levin
Aaron, excellent post, thank you for that. I have a question regarding IoT Services:
In MMS, according to the documentation (SAP HANA Cloud Platform Internet of Things (IoT) Services (beta)), the websocket secure protocol is used to connect to the service.
Will it be possible to access a websocket endpoint using ws protocol instead of wss?
No you have to use wss. For good or bad, everything that the IoT services does has to use the "secured" part of the protocol (so https- yes, http- no, wss- yes, ws- no)
Hope that helps...
Yes, this helps, thanks!
Excellent post!
Thank you!
Hi Aaron, these are very convenient procedures. Thanks a lot!
But I encounter an issue in part 1 when using sample client to send data with the message type which I created. It shows code 202 and 409, and when I check the stored message, there is no such table matching to the message type that I created. Is this a bug currently or did I miss some steps? Thanks
Hi Ji,
"roomstatus" is a wrong value for the "messageType". You should use its ID instead not the name.
Regards,
Anton
Hi Anton,
Thanks for your help. That is the reason.
Best Regards,
Ji JING
For those interested, Philip Mugglestone of the SAP HANA Academy has posted a blog about the new hand's-on tutorial series on the IoT Services:
Hand's-On Video Tutorials for Internet of Things (IoT) Services
Hi Aaron, I still have an issue regarding to field with date type in message type.
What data format should be for the type of date? Now I send the message with data "2015-12-14 09:00:14", I will get the reply said that "400 {"msg": "Parse error. Expected [timenow] of type [Date]"}".
Thanks and Best Regards,
Ji JING
Hi Ji, as documentation says, dates should be ISO-8601 compatible strings or unix time in seconds SAP HANA Cloud Platform Internet of Things (IoT) Services
Regards,
Anton
Hi Anton, thanks for your help. Now it is solved 🙂
Use UTC or local time with timezone in ISO8601 format. I tried IoT Services with a timestamp with datatype Date and this sample is from now and it works: 2015-12-15T09:34:59Z
Hi Marcus, thanks for your help. Now it is solved 🙂
Hi, Any one tried to link any user created table to be used to store IOT data?
By default the tables are created by MMS according to message types, but what is the way that we link user created HANA tables to be used instead of auto generated table?
Regards
Srivatsan
Hi Srivatsan,
it is possible with the MMS Processing API. See intro documentation here SAP HANA Cloud Platform Internet of Things (IoT) Services
And more detailed information with some snapshot is directly available in your MMS instance. Open in browser https://iotmms<your-user>trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/processing/api
Regards,
Anton
Update
Also this link will be helpful SAP HANA Cloud Platform Internet of Things (IoT) Services
Hi Anton,
Thanks for the Links but I find that these are not to use any custom defined table as is (Replace the MMS table with our table directly) but they allow us to change the column names and table names..
Regards
Srivatsan
But isn't it exactly what you want? For example, you have your custom defined table CT with columns C1, C2, C3 and your IoT Message Type MT with fields F1, F2, F3
With the following mapping:
{
"deviceType":"DT",
"messageType":"MT",
"processingService":"sql",
"properties":{
"mms.processing.sql.mappings":{
"table_name":"CT",
"column_names":{
"F1":"C1",
"F2":"C2",
"F3":"C3"
},
"add_default_columns":false
}
}
}
MMS will store all incoming messages to a table that you have created. Maybe, I understood you usecase wrong?
Regards,
Anton
When enabling IoT service I get this
Any ideas ?
sorry I don't. Is this in the trial version? If so, it would seem that the service was down for some reason when you tried to enable it.
Did it magically start working again?
Replied in this thread http://scn.sap.com/docs/DOC-63811#comment-642386
Hello,
I am trying to run a demo but I came across a weird problem.
Problem occurs in HCP, with my trial account. There seems to be a problem when trying to access the service of IoT, within the Services available in HCP. Every time I try to access the service cockpit (“Go to service” link) I get 6 errors, such as “Could not load hierarchies”, “Could not load data types” etc. Due to the above errors and as far as I understand, I am not able to add new message types or device types etc…
Any ideas about a solution?

Hello Athanasios, please check with IoT FAQ https://help.hana.ondemand.com/iot/frameset.htm?a012a3788b6e498a8971dd27c97ce6bf.html
Cause: Your trust settings are wrong.
Solution: SAP HANA Cloud Platform cockpit > select your account > select Trust in the left menu. The option Principal Propagation must be Enabled.
Regards,
Anton
Hello Anton and thank you for the reply,
The Principal Propagation is enabled already but I still get the same errors…

I disabled it, signed out of HCP, signed in and enabled it again, but no luck…
Any other suggestions?
I could suggest to re-check your Trust settings -> Trusted Identity Provider (are you using custom one?) and also your role assignments for IoT RDMS under Subscriptions -> iotrdms -> Roles
This is a very nice tutorial!
Excellent Job
Hi Aaron ,
I am new to IOT services. I searched how to proceed with initial steps. Mean while I got this blog but the given link for Getting Started with the IoT Services and also other link  is not working. Can you please help me on this.
Regards
Jitendra
Please, see this blog [1] and official online documentation [2]
[1] https://blogs.sap.com/2015/04/29/try-out-the-sap-hana-cloud-platform-internet-of-things-iot-services/
[2]Â https://help.hana.ondemand.com/iot/frameset.htm