Skill Level: Any Skill Level

Introductory know how of Watson IoT and TRIRIGA


Software Requirements:

  1. IBM Bluemix Account
  2. Watson IoT quickstart application with IoT sensor url
  3. Cloud Instance of TRIRIGA Server


  1. Architecture Overview:

  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.

    With the real-time sensor data, the monitoring of the critical parameters like temperature also becomes real-time. Any deviation from the standard process like temperature increase should trigger a work order. IBM TRIRIGA is used to raise that work order. This recipe guides you how to address such exceptions using IBM Watson IoT Platform on IBM Bluemix and IBM TRIRIGA smart facility platform.

  3. Recipe flow:

    This recipe is demonstrated and documented using IBM Bluemix. IBM Bluemix Watson IoT Boiler plate application provides sample node red flow which allows subscribing to device events. The URL (https://quickstart.internetofthings.ibmcloud.com/iotsensor/) simulates the device ID which becomes an Input to the Watson IoT Node Red App. Once the device ID is put in the Node Red input node, a JSON message is sent over MQTT to the Watson IoT. Based on the temperature threshold (>45 degrees) invokes TRIRIGA REST API, TRIRIGA OSLC receives the REST parameters with the JSON payload to create work order (work task) in TRIRIGA.

  4. Introduction to OSLC (Integration layer for TRIRIGA Application Platform):

    Open Services for Lifecycle Collaboration (OSLC) is an open community creating specifications for integrating tools. These specifications allow conforming independent software and product lifecycle tools to integrate their data and workflows in support of end-to-end lifecycle processes. Examples of lifecycle tools in software development include defect tracking tools, requirements management tools and test management tools. There are many more examples in software and product development and more still in IT operations (sometimes called service management) where deployed applications are managed.

    Integrating as an OSLC consumer

    Your application, an OSLC consumer, can be configured to support two interaction types: query and creation. The resource links are obtained by the consumer application from the provider application.

    The following figure illustrates the interactions between the consumer and provider applications. As an OSLC consumer, the application can query or create resources in the provider application and retain the links to those resources. With the links, the consumer application can make requests to the provider application to query, update, or delete the resources.

  5. Steps to follow:

    Create an Internet of Things Application in Bluemix using Internet of things boiler plate and provide the IoT sensor URL in the node red flow (Refer to the following recipe: https://developer.ibm.com/recipes/tutorials/ibm-maximo-asset-management-iot-foundation-bluemix)

    Figure depicts Node Red flow, the ones in blue border box are the addition to the standard quick start node red flow. Once the temperature reaches the threshold of 45 degrees, the 3rd condition will apply. It will trigger the REST call (create function) for TRIRIGA Work Order (work task)

    Sample URL: http://name or IP of TRIRIGA Server/context/oslc/so/triWorkTaskCF

    Node Red flow URL on Bluemix: http://<your-app-name>.mybluemix.net/red/#

    Node Red JSON:

    [{“id”:”3e77d543.c1882a”,”type”:”ibmiot in”,”z”:”29c88a9.2d8cc76″,”authentication”:”quickstart”,”apiKey”:””,”inputType”:”evt”,”deviceId”:”2cd00b033876″,”applicationId”:””,”deviceType”:”+”,”eventType”:”+”,”commandType”:””,”format”:”json”,”name”:”IBM IoT App In”,”service”:”quickstart”,”allDevices”:false,”allApplications”:false,”allDeviceTypes”:true,”allEvents”:true,”allCommands”:false,”allFormats”:false,”x”:251,”y”:291,”wires”:[[“ae0082ac.51ff8″,”c0c482df.3f3b8”]]},{“id”:”ae0082ac.51ff8″,”type”:”function”,”z”:”29c88a9.2d8cc76″,”name”:”temp”,”func”:”return {payload:msg.payload.d.temp};”,”outputs”:1,”x”:424.5,”y”:337,”wires”:[[“ff6ad0d9.00953”]]},{“id”:”ff6ad0d9.00953″,”type”:”switch”,”z”:”29c88a9.2d8cc76″,”name”:”temp thresh”,”property”:”payload”,”rules”:[{“t”:”lte”,”v”:”40″},{“t”:”gt”,”v”:”40″},{“t”:”gt”,”v”:”45″}],”checkall”:”true”,”outputs”:3,”x”:590.5,”y”:336,”wires”:[[“80621eff.7f9de”],[“8e1706a.f71e8f8”],[“67462d16.26f6a4”]]},{“id”:”5dad02b7.a252fc”,”type”:”debug”,”z”:”29c88a9.2d8cc76″,”name”:”cpu status”,”active”:true,”complete”:”false”,”x”:901.5,”y”:334,”wires”:[]},{“id”:”c0c482df.3f3b8″,”type”:”debug”,”z”:”29c88a9.2d8cc76″,”name”:”device data”,”active”:true,”console”:”false”,”complete”:”true”,”x”:441.5,”y”:247,”wires”:[]},{“id”:”80621eff.7f9de”,”type”:”template”,”z”:”29c88a9.2d8cc76″,”name”:”safe”,”template”:”Temperature ({{payload}}) within safe limits”,”x”:754.5,”y”:288,”wires”:[[“5dad02b7.a252fc”]]},{“id”:”8e1706a.f71e8f8″,”type”:”template”,”z”:”29c88a9.2d8cc76″,”name”:”danger”,”template”:”Temperature ({{payload}}) critical”,”x”:753.5,”y”:382,”wires”:[[“5dad02b7.a252fc”]]},{“id”:”67462d16.26f6a4″,”type”:”function”,”z”:”29c88a9.2d8cc76″,”name”:”tririga json payload”,”func”:”msg.payload={“spi:action”:”Create Draft”,n”spi:triTaskTypeCL”:”Corrective”, n”spi:triCurrencyUO”:”Indian Rupees”, n”dcterms:title”: “IoTF”,n”dcterms:description”: “The current temperature is “+msg.payload};nreturn msg;n”,”outputs”:1,”noerr”:0,”x”:511,”y”:457,”wires”:[[“27138fdc.f8a2c”]]},{“id”:”7143ec92.c83b54″,”type”:”debug”,”z”:”29c88a9.2d8cc76″,”name”:””,”active”:true,”console”:”false”,”complete”:”true”,”x”:902,”y”:456,”wires”:[]},{“id”:”27138fdc.f8a2c”,”type”:”http request”,”z”:”29c88a9.2d8cc76″,”name”:”triWorkTaskCF”,”method”:”POST”,”ret”:”txt”,”url”:””,”x”:735,”y”:457,”wires”:[[“7143ec92.c83b54”]]}]

    Figure shows the temperature threshold settings in Node Red switch node

    Figure shows the JSON payload which will be entered in the Node Red function node

    Sample JSON Payload:

    msg.payload={“spi:action”:”Create Draft”,”spi:triTaskTypeCL”:”Corrective”, “spi:triCurrencyUO”:”Indian Rupees”, “dcterms:title”: “IoTF”,”dcterms:description”: “The current temperature is “+msg.payload}; return msg;

    Figure shows the http request node settings in the Node red with the REST POST method, URL of the TRIRIGA REST call, user name and password of TRIRIGA

    Figure shows the call details and creation and confirmation of work order in debug section of Node Red

    Figure shows TRIRIGA UI confirmation of creation of work order (work task)

    Figure shows the description of the Work Order as temperature rise to 46 degrees

  6. Follow up actions:

    – Assign a service engineer to address the work task (work order)

    – Email / SMS notification to the service engineer

    – Service engineer close the work order and upload Image as proof of work completion and review

    – Use Real Time Insights to create rules and trigger actions

    – Update Location of the Work Order

  7. Outcome:

    With real-time sensor data – temperature as one of the parameters, the exception in temperature increase triggers a work order creation in TRIRIGA smart facility platform.

4 comments on"Work Order Creation using Watson IoT Platform and TRIRIGA REST API"

  1. Nicely done. Clear and crisp

  2. good information on integrating tririga with watson iot.

  3. DineshPamnani March 03, 2016

    Thanks Amar, Great functional use case and nicely defined recipe!

Join The Discussion