Gravio Blog
October 14, 2021

[Tutorial] Visualizing IoT edge data on the Kaa Platform, an IoT platform with rich data visualization

Tutorial on how to connect and send IoT edge data to the Kaa Platform, and IoT and Dashboards platform. It will show you one way how Gravio IoT Platform can easily visualize data using a third party platform. We will be gathering CO2 sensor readings at the edge, and then displaying the values on the cloud-based dashboard.
[Tutorial] Visualizing IoT edge data on the Kaa Platform, an IoT platform with rich data visualization

Introduction

This article is part of a series to show how to integrate Gravio with different Dashboard or Data visualization platforms and using different techniques to show your data in new and interesting ways, while also enabling you to use your existing dashboards or introduce new ones.

Approach

tldr; we are using a Gravio CO2 sensor and HTTPS API requests, with the aim to visualise Time Series data of sensor readings over time and in real-time.


Note: if you have a Gravio Basic subscription, you could use a Temperature Sensor instead, as that will also provide Time Series data, though the data is sent less frequently.


We use HTTPS to send the data because this is usually the minimum that a Dashboard provider needs to support; it doesn’t require an MQTT broker setup and allows us to focus on the Dashboard’s core purpose: showing information. 


We’ll be sharing MQTT examples in future posts, follow us on Twitter or join our Gravio Slack community to find out when.

About Kaa Platform

Website: https://www.kaaiot.com/

The Kaa Platform provides a range of pricing options to suit all kinds of projects and installations, check out their pricing info here to get a better idea. The cloud offering is called Kaa Cloud.

Pricing & Account information

Links

Account information

  • Type: Free - no expiration
  • Name: Kaa Cloud 5
  • Limitations: 5 x Devices

Tutorial

Requirements

Steps

Part 1 - Setting up the platform to receive data

1. Once logged into Kaa Cloud
  1. Navigate to Applications via the left-hand menu:
    Device Management > Applications
  2. Click Add application



2. In the Add application dialogue box
  1. Enter a name for the application e.g. CO2 Readings
  2. Click Create



3. After the application has been created you will see it in the Applications list
  1. Click the arrow toggle button for your application to expand its configuration
  2. Click the (+) icon next to versions - to open add a new version



4. In the new version dialog box
  1. In the Name field, enter v1
  2. In the Display name field, enter V1
  3. Click Create



5. While still in the Applications list for your application
  1. Select your new V1 version
  2. Copy the application version name to somewhere for later use
  3. Click epts (aka Endpoint Time Series service) - to open the service configuration



6. In the application configuration view
  1. Check Autoextract - a helpful feature to automatically extracts your data 
  2. Click Save, and click Save again to confirm
  3. Click Close in the confirmation dialogue box



7. Navigate to Devices via the left-hand menu: Device Management > Devices
  1. Click the ‘Application’ dropdown
  2. Select your application - e.g. CO2 Readings



  1. Click ‘Add device’



9. Add your CO2 device information
  1. Click Create

Note: we will accept the auto-generated Endpoint token in the next screen



10. Copy your endpoint token from the success dialogue box to somewhere for later use
  1. Then close the dialogue box by clicking the X in the top right corner OR Go to device



Now you’re ready to set up your Gravio Hub or HubKit to send the data to Kaa!

Part 2 - Sending data from Gravio


Note: for this part, we assume that you’ve already set up Gravio HubKit and Studio for your environment and added your CO2 (or Temperature) device - similar to the Air layer with its associated device below:


1. In Gravio Studio, open the Actions window



2. In the Actions view, Click the [ + ] button to create a new Action



3. In the new Action dialogue window:
  1. Enter a name and description for your Action
  2. Click OK to save



4. Open your new Action by double-clicking it in the Actions view:



5. Click the large [ + ] button to add a new step



6. Now we will add an HTTP Request step:
  1. Click the Network tab
  2. Click to select the HTTP Request step
  3. Click Add



7. Now we will set up the HTTP request to send data to the Kaa Project as per the below screenshot:
  1. Select your HTTP Request step
  2. Change the Method dropdown to POST
  3. Update the following URL text with the information you saved earlier for your environment:

    https://connect.cloud.kaaiot.com:443/kp1/{your-application-version-name}/dcx/{your-endpoint-token}/json
  4. Copy the updated URL text and paste it into the URL field
  5. Change the Content-Type dropdown to application/JSON
  6. In the Pre-Mappings section click the (+) button and add the following: cv.Payload = "{\"value\": + tv.Data + "}"
  7. Close this Action Editor view (it will automatically save your changes)



8. Next, we will create a Trigger that will call this Action when we receive a new date from the CO2 sensor.
  1. Close the StreamCO2Data action, and close the Actions window
  2. Click on the Trigger tab in Gravio Studio
  3. Click on the Add new event Trigger button (lightning bolt with a +)
  4. Enter a Name e.g. ‘CO2 Update’ 
  5. In the ‘Conditions’ tab, select your Area from the Area dropdown e.g. ‘Inside’
  6. Select the CO2 Layer in Key Layer e.g. CO2 (as per Conditions tab screenshot below)
  7. In Physical Device ID, click the ‘+’ button, which should populate with your CO2 device, then check that box
  8. Then in the ‘Action’ tab, select the ‘StreamCO2Data’ action in the Action dropdown  (as per the Action tab screenshot below)
  9. Then click Add - done


Conditions tab


Action tab

Done!

Now that your Trigger and Action are set up, your Kaa graphs should now start updating as CO2 data starts coming in and being pushed out to Kaa by Gravio:

Via Kaa Dashboard > Device Management > Devices > select CO2 endpoint.


Summary

The Kaa Project has a range of functionality for combining and visualising your data, of which we’ve only scratched the surface with here! As you can see the setup is relatively straightforward for this kind of integration, and there is a rich documentation site to support whatever you are trying to create with Kaa.

References

Latest Posts
[Tutorial] Using Eniscope, an Energy Monitoring Device and Gravio to Measure and Log your Energy Consumption with MQTT.
Tutorial on how to use Gravio, MQTT, and Eniscope to build a simple Energy reporting and logging system without coding. Connect data points to Line for notifications and writing to a CSV file for logging.
Thursday, November 14, 2024
Read More