Technical Blog Post
Lets turn on lights with Maximo...
It's been awhile since my last blog and I wanted to get something different posted then what I usually would talk about. Ok, well this will actually be a lot different as I'm going to talk about how we are going to be turning lights on with Maximo...Yes you read that right, we will discuss Maximo and IoT and how we can turn a light on when a ticket is entered. I will start by saying, this is something a colleague (@Cechovsky3100003ATC) and I decided to do to bring Maximo in to the IoT space in our own way and have some fun with it, there may be easier ways to do this and harder ways but I wanted to share with you the path we took combining multiple IBM products.
I'm not going to go in to the fine details of the Maximo\Integration configuration as that will turn this blog in to a Novel, but I will provide a overview and if you have any questions I will do my best to answer in the comments, so lets start.
Currently we have an external HTML form used to post data to Maximo via the REST API, if your not sure how this works head on over here. When the data gets to Maximo an escalation picks up the ticket and notifies the end user that its assigned to based on a set of criteria. This user then logs in to Maximo and actions the ticket. Now what if the user is looking at a different monitor or doesn't see the email notification to action the ticket in time? We got that handled now as will shine three bright lights at them until they pick up the ticket. The amount of lights is your choice, but I found three to be the magic number.
The what's required is more of the what I used section, we aren't restricted to this software or hardware, there are other options and many more possibilities when it comes to IoT. I will note however I added other layers in to combine different IBM products to allow for different functionality in the future.
Raspberry Pi : Lets call it a tiny computer
Node Red : This is a development GUI which allows you to wire together physical hardware devices with ease. Node Red is available on the latest Raspberry Pi update and also part of the IoT Foundations service on Blue Mix.
WebSphere MQ: I'm using WebSphere MQ to handle outbound transactions from Maximo. I went this route as Node Red can make MQTT connectivity as well as IBM MessageSight
IBM MessageSight: The reason I'm using IBM MessageSight in this scenario is simulate this running on a larger scale using multiple topics\subscribers and incorporating other software, we are pulling data from WebSphere MQ in to MessageSight Topics, then subscribing to these Topics from Node Red. If your interested in what IBM MessageSight can do for you check it out here.
Node Red can make MQTT and WebSocket connections, MessageSight is not required.
Again I'm not going to go in to the fine details but just an overview. This is something we did for fun here and I wanted to share this to get others thinking about the possibilities of IoT and Maximo.
1. The first thing we need to do is connect our lights to the Raspberry PI, we did this using a breadboard. There is a lot of documentation online to assist with the pin mapping. Node Red gpio nodes will also provide which pins map to which gpio mode commands.
2. Now we can configure Maximo to send outbound messages, without thinking about the REST portion I discussed in the scenario, the same functionality would happen if the ticket was created in the application itself. We created a Object Structure and Publish Channel with an Event Listener on the object this way when a new record is created the data is sent to the sequential outbound queue which we have configured with WebSphere MQ automatically. If your not sure what WebSphere MQ is or how to configure it check out one of my previous blog posts here.
*Note* If you don't have MQ or MessageSight, there are other ways you could make connection.
3. Now that we got our message in the sequential outbound queue we are going to pick it up with IBM MessageSight, depending on the outbound queue MessageSight will move that Message to a topic, our topic is just called 'maximo'. MessageSight can read from multiple queues, so depending on how your sending data outbound you could move those messages in to multiple topics, one for each color of light. This could be used to define severity of the ticket.
I'm not going to go in to the MessageSight configuration in this blog. If your interested in learning more about it, how it works and some configurations the IBM Messaging YouTube channel has some good tutorials and information.
4. Now MessageSight is configured, it's picking up our outbound messages whenever a ticket is created in Maximo and sending it to a topic. Our next step is to turn Node Red in to a subscriber and have it subscribe to our 'Maximo' topic to pick up the outbound message and process it.
The tricky part here is the GPIO commands only accept the binary values of 1 and 0, so we need to turn the XML message from Maximo in to a 1 or a 0. We do this using an XML node and a SWITCH node to parse the XML and switch it to a 1, which is then put in to the GPIO command for that pin.
The flow for the above Node Red wiring is the following.
1. Our MQTT node connects to MessageSight and subscribes to the Maximo topics, when a new message is sent outbound by our publish channel from Maximo it is picked up by Node Red.
2. Once Node Red picks up the messages it reads the XML using the XML Node, without this node the message would not come through correctly for formatting. You would receive a white space error.
3. Once the XML is received we use the debug node to output the message payload to our console, then a switch node to covert that XML to the binary value of 1.
4. This value is then sent to 3 separate GPIO nodes which are mapped to different pins on the Raspberry Pi, turning on our lights.
5. The lights are then turned off with a switch.
There are many ways to complete these types of scenarios using IoT, the goal of this was to use multiple IBM Products and bring them together to turn on a physical light. You don't have to follow this, you can let creativity flow, use other combinations and other scenarios to allow Maximo to integrate and connect to physical objects. We used lights now, but tomorrow Maximo could be turning on our coffee maker. Have some fun with it and see what you can do.
We will post smaller blogs going forward with more detailed configuration notes and other things we come up with. Any questions or comments please feel free to leave them below.