It is one of many examples of different devices supplying environmental sensor data (temperature, humidity) to SAP Cloud Platform (SCP). Here Tessel 2 device is used. Sensor data will be send synchronously using HTTP REST protocol.Prepare your Tessel 2 device
Make sure your went through Tessel's Climate tutorial http://tessel.github.io/t2-start/modules/climate.html prior to continuing with this project.Make sure you have free developer account in SAP Cloud Platform
If you do not, please follow this tutorial first: https://www.sap.com/developer/tutorials/iot-part6-hcp-services.htmlConfigure virtual device for Tessel 2 in SCP
Follow the tutorial https://www.sap.com/developer/tutorials/iot-part7-add-device.html and then create a separate virtual device for your Tessel 2. Instead of "myDevice" you can call it "tessel2".
Note down technical ID of this tessel2 virtual device and its assigned authorization token.Modify the code
The lines in particular you will need to modify are the following:
var accountOwner = '<your account user>'; var messageTypeID = '<message type>'; var deviceId = '<device id>'; var authToken = '<auth token of the device>';
You should modify: - The
accountOwner line to add your own SAP Cloud Platform Account User ID which starts with either an
messageTypeIDis the ID of the message type you created, and not the name of the message type.
deviceIdis the ID of the device you created, not to be confused with the
authTokenline contains the token of the device (not the device type!). You received it in the pop-up window after creating your device. But if missed it, then regenerate this token from Device screen once again.
Save the file as scpiot_neo_tessel2_http.jsRun the code and check the results
Once you have saved your file, you will deploy and execute it from the command line (Windows) or terminal (Linux/Mac).
t2 is the command line interface for
Connect the device to the internet and run the following command:
If everything is correct, then you should see something like this as the output.
You can preview received data in the cloud in Message Management Service Cockpit and use the OData API link to now use this data in your applications!
Have a good weather!