Skip to Content
Author's profile photo Ferry Gunawan

A Simple Door Monitoring System with HANA XS and Raspberry Pi


I have built a simple door sensor with SAP HANA and Raspberry Pi to monitor the door-opening events. The wireless door sensor is a magnetic gap sensor that will send the RF 433 Mhz signal to the receiver when someone open the door. The Raspberry Pi with the receiver within the range listens for the incoming signal from the sensor. Once the signal is detected, the Raspberry Pi will send the ODATA http post request  to the HANA server. You can monitor the events status from the web app (backend).

If you never heard of Raspberry Pi, you may refer to its website at . Building the receiver will not be covered in this blog. Please refer to this blog to build it: Adding 433 to your Raspberry Pi | Ninja Blocks



HTTP POST Command: Curl

On the Raspberry Pi, there is a command line tool in Linux to post the http request: curl with the JSON data: body.json.

if (mySwitch.getReceivedValue() == 13981149 ) {

                system(“curl -H ‘Content-Type: application/json’ –data @/home/pi/433Utils/RPi_utils/body.json


The body.json contains the current timestamp, date and STATUS = Open. The timestamp and date will be auto-populated by the insert procedure on the HANA XS side.


To run the receiver, just type sudo ./RFSniffer on the Raspberry Pi command prompt. This command listens to the incoming signal from the sensor and sends the http post ODATA request to HANA XS. On the HANA XS side, the insert procedure will update the HANA table.


Project Structure: Key Components

The structure and explanation is pretty much the same as in my earlier blog here:


Let’s focus here on the key components:

  • The RpiSensor table to store the status of the door events:/wp-content/uploads/2014/07/b_493537.jpg
  • The  XSODATA:
  • The InsertRowRPISensor procedure:
  • And also the web app backend SAPUI5 to view the information:

A complete source code can be found on GitHub: ferrygun/HANADoorSensor · GitHub


You could make an internet of things by combining the power of SAP HANA and the micro-computer/controller like the Raspberry Pi/Arduino with other sensors (e.g,. GPS, temperature/humidity, contact sensors, etc) and create a dashboard to present the status of the sensors.

Thanks for reading my blog. I hope you enjoy it.

Assigned Tags

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

      Hi, Ferry! Nice post 🙂 . I am trying to use a Raspberry Pi to measure temperature and send the values to HANA, and I have one question: do I need to install a HANA client in the RPi to connect to the database? Thank you very much in advance.

      Author's profile photo Ferry Gunawan
      Ferry Gunawan
      Blog Post Author

      Thanks Caroline

      In the above blog, I did not install the HANA client. I am just using the linux command: Curl to post the ODATA request to the HANA server. The request will be captured by the RPISensor.xsodata. But it depends on your setup, you also can install the HANA client to write a record in the HANA table. I am doing it in my other blog when integrating the IVR with HANA (it's also using Raspberry Pi).

      Pls let me know if you have any question.

      Regards, Ferry 

      Author's profile photo Former Member
      Former Member

      Hello, Ferry. Many thanks for your answer. I solved my problem using Python and the library 'requests' to send HTTP post messages with the data in json format to an OData service inside HANA that manages this petition and inserts this data into my table. It was much easier than I expected at first, because I am new with all this, but OData is simplifying my work so much 🙂 . Thanks again for your great post that was a big help for me. Kind regards,


      Author's profile photo Ferry Gunawan
      Ferry Gunawan
      Blog Post Author

      Hi Carolina,

      It's great to hear that you finally success in your setup. If you don't mind, please share your creation in the SCN so everyone can learn too. Thanks



      Author's profile photo John Astill
      John Astill

      Awesome blog. Can't believe I did not see this yet. I also have Ninja blocks and Pi setup for home automation, along with Smartthings and Iris.

      I am loving playing with iOT. Last year at TechEd we hooked some wearable sensors to HANA but used a mobile phone as the wifi router.

      Looking forward to seeing your next blogs

      I really should blog the details on our setup from last year.


      Author's profile photo Ferry Gunawan
      Ferry Gunawan
      Blog Post Author

      Thanks John

      I love to see your setup too.  I have just finished my new blog under Hana cloud platform on the Internet of Things with WhatsApp and off course, HANA: