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
- Download urllib3 1.14 ,unzip it and place the contents of the folder inside iot-starterkit-for-desktop folder.
- 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.
- 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.
Sending Push Notifications to Simulator
- Open MMS cockpit.
- Click on “Push messages to devices” tile.
- Enter the “Device ID” and “Message to push” details. Then press “Push” button.
- The message should reach the simulator.
- You could also control the LED of the simulator by changing the message as given below.
- 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.
- Click on “Display stored messages” tile in the MMS cockpit.
- Select the table T_IOT_D*** to view the value coming from device.
Other SCN spaces to follow:
SAP Solutions for the Internet of Things
Regards, Midhun
SAP Technology RIG
great overview, Midhun, thanks for sharing!
Hi Midhun,
The document is very easy to follow, thanks for posting it.
I am stuck in the below step.
I don't see IoT simulator starting up, is there a way to troubleshoot? and also where i can find logs?
Thanks,
Doak Regis
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
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.
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
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.
Great material, Midhun. Congrats!
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