Skip to Content
Author's profile photo Midhun VP

Little known Ways to Try HCP IoT Services using Simulator – Part 3

In the part 1 and part 2 of the blog series you learned how to create device information in IoT cockpit and deploy Message Management Service to HCP.

In this final part of the blog series you learn how to setup an IoT simulator and push notifications to the device.

Setting Up IoT Simulator

  • Python is pre installed on Mac. If you are on a windows machine install python by following the instructions here: Python For Beginners.
  • Download the “IoT starterkit for desktop” folder from here: IoT Starter Kit · GitHub

/wp-content/uploads/2016/02/2016_02_01_14_02_21_878119.png

  • Download urllib3 1.14 ,unzip it and place the contents of the folder inside iot-starterkit-for-desktop folder.

/wp-content/uploads/2016/02/2016_02_01_13_41_24_878074.png

  • Place the config.py file inside the folder “iot-starterkit-for-desktop”.
  • Edit the config.py file – change the values according to the details in your IoT cockpit.

/wp-content/uploads/2016/02/2016_02_01_13_25_52_878111.png

  • Open command window and navigate to the folder “iot-starterkit-for-desktop”.
  • Then execute the command “python iot_starterkit_desktop.py” to start the IoT simulator.

/wp-content/uploads/2016/02/2016_02_01_13_56_01_878113.png/wp-content/uploads/2016/02/2016_02_01_13_58_00_878118.png

Sending Push Notifications to Simulator

  • Open MMS cockpit.
  • Click on “Push messages to devices” tile.

/wp-content/uploads/2016/02/2016_02_01_14_12_04_878135.png

  • Enter the “Device ID” and “Message to push” details. Then press “Push” button.
  • The message should reach the simulator.

/wp-content/uploads/2016/02/2016_02_01_14_13_43_878136.png/wp-content/uploads/2016/02/2016_02_01_14_16_54_878140.png

  • You could also control the LED of the simulator by changing the message as given below.

/wp-content/uploads/2016/02/2016_02_01_14_18_35_878170.png/wp-content/uploads/2016/02/2016_02_01_15_02_43_878184.png

  • Given below is the video that shows sending push notifications to the device from MMS cockpit.

View Data from Device Simulator

The data from the simulator could be viewed in the MMS cockpit.

  • On the IoT simulator slide the slider to 100 to start sending data to MMS cockpit application. By changing the slider position we could see different values under stored messages in MMS cockpit.

/wp-content/uploads/2016/02/2016_02_02_08_37_24_878879.png

  • Click on “Display stored messages” tile in the MMS cockpit.

/wp-content/uploads/2016/02/2016_02_02_08_42_20_878839.png

  • Select the table T_IOT_D*** to view the value coming from device.

/wp-content/uploads/2016/02/2016_02_02_08_50_58_878880.png

Other SCN spaces to follow:

SAP Solutions for the Internet of Things

SAP HANA Cloud Platform

Regards, Midhun

SAP Technology RIG

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ervin Szolke
      Ervin Szolke

      great overview, Midhun, thanks for sharing!

      Author's profile photo Former Member
      Former Member

      Hi Midhun,

      The document is very easy to follow, thanks for posting it.

      I am stuck in the below step.

      • Then execute the command "python iot_starterkit_desktop.py" to start the IoT simulator.

      I don't see IoT simulator starting up, is there a way to troubleshoot? and also where i can find logs?

      Thanks,

      Doak Regis

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Doak Regis

      Can you once again verify iot_starterkit_desktop.py and iot_starterkit_push_ui.py files content? I remember there were some html code in those files when i saved them on my machine, later i manually copied the contents and it worked fine.

      Regards,

      JK

      Author's profile photo Former Member
      Former Member

      Thanks, it worked, i am able to see the simulator.

      I try to push a message to the device, the server reply was success but i didn't received that message in the device. What could be the reason? Also, i noticed that the simulator is not showing the slider bar.

      Author's profile photo Anton Levin
      Anton Levin

      Hi Doak,

      if you use "http" method with Push API then your message first lands in the T_IOT_HTTP_PUSH table and a device have to pull it from there afterwards. Please see "Receiving Messages from MMS" section here SAP HANA Cloud Platform Internet of Things (IoT) Services

      In case of "ws" method, a device will get the message directly (device should establish a WS connection first).

      Regarding slider bar, need to check myself first. Never experienced such issues.

      Regards,

      Anton

      Author's profile photo Former Member
      Former Member

      Thanks Anton, it was my bad. When i was copying the file content, i wrongly copied the content of iot_starterkit_push_ui.py into iot_starterkit_desktop.py that's why slider bar was not showing in the simulator.

      The real issue was, i didn't removed the dummy proxy_url in config.py file that was preventing connection.

      Now i am able to see the simulator and also the data i pushed from the message service.   

      Author's profile photo Daniel Silva
      Daniel Silva

      Great material, Midhun. Congrats!

      Author's profile photo Ashutosh Shrivastava
      Ashutosh Shrivastava

      Hi Midhun,

      URL for  "iot starter kit" is not found but i found some similar pages on github. unfortunately there is no clone / download option.

      1> https://github.com/SAP/iot-starterkit/tree/master/neo/examples/python/iot-starterkit-for-desktop

      could you please suggest.

      Thanks,

      Ashutosh