Skill Level: Any Skill Level

Introductory know how of Watson IoT and TRIRIGA


Software Requirements:

  1. Bluemix Account
  2. Java Client Library for Watson IoT Platform
  3. Cloud Instance of TRIRIGA Server v10.5


  1. Architecture Overview:

    Figure shows Flow of Data

  2. Description:

    In a smart building, it is imperative to monitor smooth functioning of facilities operations. One of the critical parameter to monitor is temperature of the facility. TRIRIGA is an integrated workplace management system, which increases the operational, financial and environmental performance of facilities.

    Temperature sensor will detect sudden increase in temperature. Events like door left open in case refrigerators and vending machines can lead to damage of food and grocery. Real time event demands real time action and with IBM Real time insights service along with Watson IoT can not only detect the event but also instantiate an action. The action can be in the form of web hook (http) to another application or Email or IFTTT (IF This Then That) action. In this recipe we will initiate a work task in TRIRIGA, initiate IFTTT and send email to close the fridge door.

  3. Recipe flow:

    This recipe is demonstrated and documented using IBM Bluemix. To simulate the sensor data, Java client library for Watson IoT is used. Device definition is done in the Watson IoT service. Real time insights service bind to a Bluemix application that already has Watson IoT service. Define Watson IoT as data source to Real time insights. Configure device and schema mapping in Real time insights dashboard. Create rules and analytics (alerts) in the real time insights dashboard Also setup a TRIRIGA SaaS instance with public IP and IFTTT trigger and action and Email configuration.

  4. Steps to follow:

    1. Create an Internet of Things Application in Bluemix using Internet of things boiler plate
    2. Add Real time Insight Service to the application

    3. Setup Java client library in local machine. Refer to the following recipe (https://developer.ibm.com/recipes/tutorials/use-the-java-client-library-to-connect-to-the-ibm-internet-of-things-iot-foundation/)

    4. Define a temperature parameter in the Java client library. e.g temp = 30 Since we need stream of data from the Java client library, add while loop in the Java program.

    Figure 1 shows Java client library for Watson IoT platform in Eclipse with the addition of while loop


    myClient.publishEvent(“blink”, event);

    try {


    } catch (InterruptedException e) {

    // TODO Auto-generated catch block



    System.out.println(“SUCCESSFULLY POSTED……”);


    //Disconnect cleanly


    5. Launch Watson IoT Platform service dashboard and add a new device. E.g TempDevice 1. Open the node red flow and link Watson IoT Service to message to check the real time events generated from Java client lbrary.

    Figure 2 shows sample node red flow to check the real time events generated using Java client libraries of Watson IoT platform

    6. Launch Real time Insights dashboard and add check the status of your new created device e.g TempDevice 1

    Figure 3 shows launch of the Real time Insights Dashboard

    Figure 4 shows list of devices and connected device e.g TempDevice1

    7. Define schema mapping of the incoming event for TempDevice1

    Figure 5 shows schema mapping e.g Temp

    Figure 6 shows schema mapping e.g Temp Device and Data Point as temp

    Figure 7 shows schema mapping e.g Temp Device

    Figure 8 shows schema mapping e.g Data Point as temp

    8. After schema mapping check the real time data events on the connected device

    Figure 9 shows real time events for TempDevice1

    9. Click Analytics and define the Rules

    Figure 10 shows New Rule definition, e.g TRIRIGA Work Task

    Figure 11 shows New Rule definition with temp as 30 and subsequent action in TRIRIGA

    Figure 12 shows IF Temp = 30, Then create TRIRIGA Work Task

    Figure 13 shows frequency and time period to trigger action

    Figure 14 shows setting the frequency requirement for the rule, which is one time in one hour

    Figure 15 shows New Rule definition, e.g Add Action: TRIRIGA Work Task with option as Webhook

    10. Click Analytics and define the Actions

    Figure 16 shows New Action definition, e.g TRIRIGA Work Task with webhook configuration,

    sample IP: http://yourIP/tririga/oslc/so/triWorkTaskCF

    Figure 17 shows json as customized body of the webhook, the description can also contain: The Refrigerator door is left open resulting into increase in temperature. Take Action: Close the door

    Sample json payload:

    “spi:action”:”Create Draft”,
    “spi:triCurrencyUO”:”Indian Rupees”,
    “dcterms:title”:”The fridge door is open”,
    “dcterms:description”:”The Refrigerator door is left open resulting into increase in temperature to 30. Take action: Close the door”

    11. Activate the rule and check TRIRIGA for work task creation

    Figure 18 shows to execute the Real time insights, Activate the Rule

    Figure 19 Login to TRIRIGA and open the task search and provide The fridge door is open as task name

    Figure 20 shows new work task created

    12. Configure IFTTT (If this then that) for SMS & Email notification to the service person

    Figure 21 shows new actions created like IFTTT Integration and Send Email

    13. Create an account in IFTTT and create a recipe using Maker option in IFTTT. Follow the recipe the following recipe to configure IFTTT (https://developer.ibm.com/recipes/tutorials/perform-actions-in-ibm-watson-iot-platform-analytics-real-time-insights/)

    Figure 22 shows IFTTT recipe which is if the event is detected from RTI then send SMS to Android Mobile Number

    Figure 23 shows IFTTT recipe event name fridge_door_is_open and mobile number configuration

    Figure 24 shows IFTTT recipe Message

    Figure 25 shows IFTTT configuration as Real Time Insights Action

    Figure 26 and 27 shows IFTTT SMS delivered from Real Time Insights, Note: If you have the mobile app of IFTTT running, then you will receive sent and receive message

    14. Configure Email notification to the service person using Realtime Insights

    Figure 28 shows Email configuration in Realtime Insights

    Figure 29 shows Email configuration in Realtime Insights

    Figure 30 shows Email delivered from IBM Real Time Insights

  5. Follow up actions:

    – Assign a service person to address the work task and close the Refrigerator door in TRIRIGA

    – Service person close the work task and upload Image as proof of work completion and review

    – Update Location of the Work Task

  6. Outcome:

    With the help of the real-time sensor data with temperature as one of the parameters, the exception in temperature increase due to the door left open – triggers a work task creation in TRIRIGA smart facility platform, Invoke IFTTT event action and send email.

Join The Discussion