UPDATE 12-Feb-2019: HAT will no longer support the functionality described in this blog. There is now an alternative feature in SAP Web IDE Full-Stack called “IoT Enablement”. You can refer to the blog post here: https://blogs.sap.com/2018/01/15/how-to-build-an-iot-app-on-top-of-sap-cloud-platform-iot-application-enablement/
Few weeks back Hybrid Application Toolkit (HAT) version 1.16 was released. This comes with an experimental feature around the Internet of Things. This is currently available only in trial SAP Web IDE instances.
I think it’s a great step in simplifying the consumption of IoT services for developers within Web IDE. We no longer need to switch to IoT service cockpit to manage devices and message types. Everything can be done within your Web IDE.
Ensure that you have enabled the Internet of Things service.
From the IoT service cockpit, create a device type, message type and device.
In the HCP Destinations, add the below two destinations.
URL : https://iotmms<account>trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/
Launch SAP Web IDE and enable the HAT plugin. You will be able to see “SAP HANA Cloud Platform Services” under tools menu.
The system will give you a screen which helps you to manage Device, Device Types and Message types. In the below screen, it shows the existing device type and device created earlier in the IoT service cockpit.
You can add more device types and message types directly from this screen without the need to switch to the IoT service cockpit.
To be able to invoke APIs related to IoT services, right-click on the project and click on “Inject Internet of Things API library”.
The system will generate IOT.js file. You can change the namespace and adapt the code if required.
To be able to use the destinations created in the HCP destinations, add the below entries in neo-app.json file
There are several APIs which have been made available to directly interact with the IoT services. You will be able to find the list of APIs in SAP Help. Go ahead and start consuming IoT services within Web IDE using the above steps.