Search This Blog

Showing posts with label maximo sensor iot. Show all posts
Showing posts with label maximo sensor iot. 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.

Tuesday, March 28, 2017

Maximo asset health insights , WATSON iot quick start

I have been doing a lot of work on IOT and one interesting thing that came to me was Maximo asset health insights which collects real time asset data and on based of a scoring system shows the asset health.

I will give you a brief on what all i did to get this working.
Create a bluemix account – 30 days free account will work , don’t move it to lite account
remain a standard account, ibm recently started giving suggestions via bots to move to lite account.(This poc won’t work with lite account it has to be standard bluemix account)

Boiler plates –> IOT quick start, give a unique id and create the app.
It will generate two services also , cloudant and iotf service.
Both of them will be used to get this poc going.

Now create a new device type , lets say temperate sensor and save it , now register new devices under this device types.

Note down the device details generated after adding the device, like org, api etc.
Org, api token will be used while sending data to this device via the simulator explained below.

Use the watson temperature simulator to connect the device virtually.
http://watson-iot-sensor-simulator.mybluemix.net/
You will see the device is connected.
image

Now click on manage schema and add the schema from the connected device.
image
image

All the fields of schema will be auto created, please note the value we are interested is d.temperature  and this will be used later.
Now attach your cloudant service to your iot platform dashboard –>Extensions.
bind your cloudant to your iot, and click confirm(popup will open , make sure popups allowed)
image

After configuring it will show configured.
Now go back to your app which you created and note down the credentials.
image


Note down both the credentials and this will be used while configuring maximo in next
Now attach a meter to an asset and configure the watson parameters in the work center.
make sure you create system properties, crontask and endpoints for historian.
I faced one OSLC error on chrome console while performing this poc, reason was that the mapping i did while adding meters were wrong. (It has to be d.temperature not d.Temperature)