Search This Blog

Showing posts with label maximo iot rest node red. Show all posts
Showing posts with label maximo iot rest node red. Show all posts

Thursday, April 6, 2017

IBM Maximo integration with IBM Watson and IOT integration P2

 

This is the continuation of the part 1 of this IBM Maximo with WATSON and IOT series.

So till now, we are able to open the node red flow and can see our sensor wired to the nodes.

image

 

There are two flows, the upper one is to simulate a temperature sensor in case you don’t want to use the simulated sensor from WATSON and you need random readings.

For this demo, we have already connected the IOT sensor to our lower flow and we will be using that.The extreme right window is showing the debug messages which are being passed through the flow.

You can change the temperature on your simulated sensor and point to the first green node(device data), you will soon start getting the debug messages.

These messages come from a predefined format which you specify in the dark green debug node.

Let me show you

node red debug iot

 

 

Now this node sends out put to debug tab, on extreme right which I mentioned above and the output is the complete msg object.

* msg object is the actually message in JSON received from the sensor, you can play around the message payload and its contents using various other nodes from the node red editor.

 

So now we have a temperature function which is trying to get the temperature data out of the message JSON, as I mentioned above.

json node red watson maximo

Here we have another variable called payload == actual message. payload .d. temp (Now actual message is of type JSON and here we are parsing it to go to the temperature value)

Next we have a switch node which will switch the paths based on the temperature value, same like java switch.

image

Now since we have redefined the payload value of msg, it currently carries a numerical temperature value( else payload itself will be of type JSON , as explained above)

So if temperature >40 take 2nd route else first.

Second route has our Maximo’s REST API call which will create an SR object in Maximo.

Keep deploying the changes on the node red by clicking the deploy button on top right, else your changes will not be visible.

 

imageimage

Now as per danger node, we should see a message that – Temperature VALUE critical, which we can check from the debug tab.

image

 

By the way you can have multiple debug outputs, to make things clear you can disable other debug nodes by clicking on their node.

So till now you understood how node red is sending data from these wires based on different conditions.

Next we will trigger a REST call to Maximo if temperature is greater than 40.

 

Lets add a HTTP request node and assign the headers and payload for Maximo.

 

I am assuming you already have the payload ready for Maximo which will generate the SR request in case an event happens with the sensor( Real world scenario could be motor temperature is above the thresh hold and it needs a repair).

Now you should have a Maximo instance and you have the payload which will be sent to Maximo.

Usually payload will be the body which will go in the http post object.

You can get the http post body template from the Maximo object structures.

You need to generate schema xml for that object structure and it will show you the complete payload which will go to our HTTP request object.

 

For this demo I will be using the Maximo preview site and will generate the template from there.

 

maximo rest watson iot

Now remove the fields which are not required.I finally came up with some thing like this.

 

Code

=================================================================================

<?xml version="1.0" encoding="UTF-8"?>
<max:CreateMXSR xmlns:max="
http://www.ibm.com/maximo" creationDateTime="2008-09-29T07:19:45" >
  <max:MXSRSet>
    <max:SR action="Create" >
  
      <max:ASSETNUM changed="true">11200</max:ASSETNUM>
  <max:AFFECTEDPERSON changed="true">MAXIMO</max:AFFECTEDPERSON>
  <max:STATUS maxvalue="string" changed="false">NEW</max:STATUS>
   <max:REPORTDATE changed="true">2017-04-06T11:24:06</max:REPORTDATE>
    <max:REPORTEDBY changed="true">MAXIMO</max:REPORTEDBY>
    </max:SR>
  </max:MXSRSet>
</max:CreateMXSR>

=================================================================================

 

So these are the minimum fields required to create an SR and we need to go this to node red msg.payload object.

Lets see how

First create a function node and an http request node which will route the request, as shown below.

 

image

 

Both the nodes, Maximo SR Payload and the Maximo Create SR (HTTP REQUEST) node should look like this as shown below.

 

 

image

Make sure if Maximo has https , you need to select the SSL connection and uncheck the verify certificate option in the TLS configuration, click on pencil mark to edit.

 

Also make sure your payload looks like this and remove all new line characters and bring them in same line using notepad ++

 

 

image

 

Once every thing is done, try to raise the sensor temperature to 41 degrees and monitor the debug output.

 

 

image

 

 

 

Congrats, your SR is created. Please dispatch the agent to fix this, you might want to make a workflow to create a Work order also for this in Maximo.

 

Login to Maximo to check your SR

image

 

So this demo explained how you can use sensors and IBM Watson node red flow to create the SR and other objects in Maximo.

 

In next section of this series, we will see how we can integrate GPS data from a vehicle and integrate it with Maximo using WATSON.

 

Keep Reading !

 

Action Item:  Share and Subscribe.

Wednesday, April 5, 2017

IBM Maximo integration with IBM Watson and IOT integration P1

 

Chapter 1 - IBM Maximo with Watson Integration for IOT

Maximo takes care of our assets and helps us manage them.But recently there has been a lot of buzz on the IOT thing which can give real time insights on the health of the assets.

A lot of debates came around, why to do time based preventive maintenance and waste resources.How do we know if the maintenance was actually required ?

 

Well, the point is right. Half of the times frequency based PMs waste a lot of man power and resources and doesn’t give a bang for a buck to clients.

So the concept of health insights was brought up IBM where, they have integrated assets with the sensors and the data is fed to Maximo via the Watson platform.

Basic things that are used to get this working are:

  • Maximo asset health insights from IBM
  • Some sensor and sensor data, use quick start from WATSON.
  • Configure the sensor on WATSON to save historic data on cloudant db.
  • Configure the cron tasks, system properties and WATSON configuration on Maximo.

 

There is another detailed article on how to get this thing working, which is explained here.

There is another kind of integration which is being used in context of Maximo.

 

Maximo and Watson Architecture using Node red

image

 

So I will take you through the setup process which includes WATSON and node red.

 

Step 1 – Get Your sensor

If you have a raspberry pi or some other SOC like this which can send directly to WATSON ,its well and good else you can use a simulator.

Please check on the quick start from IBM WATSON which can give you a quick simulator.

Checkout this link.

https://quickstart.internetofthings.ibmcloud.com/iotsensor/

image

The device id will be generated automatically and your device is ready.

If you want to check, how the sensor data is sent to IBM IOT platform, check below.

Click on the device id on the top and open the link, you will see the data streaming on IOT platform.

http://quickstart.internetofthings.ibmcloud.com/?deviceId=bfbd1f732191

This was my device id(bfbd1f732191)which is appended on the above URL.

image

 

Step 2 Setup your node red flow which will wire the business process to trigger alerts.

Now you need to create a blue mix account so that you can create an IOT app on blue mix.

image

 

 

Once the account is activated, login to the dashboard.

Go to the catalog and create a starter app.

 

image

 

Enter name of your application and click on create, select the node kit.

image

 

You app will be created and it will start running.

image

 

 

You will see a green sign which indicates app is started and you will find that two services are connected to this app – cloudantNoSQL and iotf service.

 

image

 

Now if you open the app by clicking on the link above,you will see a node red flow.

Lets click and see how the node red flow looks like, please note  - this being a starter boiler template for IOT, the node red flow is already populated to accept our simulated sensor.

image

click on the red button and you will be able to see a work flow designer kind of application as we see in Maximo, its built on HTML5 and nodejs.

image

This will be our main work area, where we will wire the IOT piece together and will generate alerts for Maximo.

For our demonstration purpose, we will be making a function node and a HTTP request node to fire the REST frame work of Maximo.

To be continued….

Check out Chapter 2 for more information.

 

Action Item : Subscribe