Getting Started With Octoblu – IoT Automation No Code Required
Nodes are the foundation that Octoblu is built on, so what exactly is a node?
A node is a representation of something that you want to interact with.
In some cases a node may do the interacting by comparing data, getting/sending new data, and sending commands to web services and physical devices.
Thats a really technical way of saying, a node is anything that can speak or listen. I like to think of each node as a question or an answer, and sometimes both.
That might be a literal microphone or speaker, or it may be a figurative one as in an online chat session.
If you haven’t had a chance to go over our “What is the Internet of Things?” into, take a second to go do that now. Here.
In the example where a washing-machine can speak to a bathroom door the washing machine is a node because its listening. The sensor on your bathroom door is also a node.
In an example where you phone talks to your nest thermostat, your phone is a node, and so is the Nest Thermostat.
In an example where your Twitter account can send instructions to your Spotify Account, Twitter is a node, and Spotify is also a node. To expand this example, if you wanted to have Spotify play on your wireless home speakers, your home computer and your Sonos Speakers are both “nodes” too!
No matter what language it speaks, or what languages it understands… if it speaks or listens – Its A Node!
Ok, now that you know all about nodes… Lets get started. From here on out Im going to try to avoid using the word node. I will try to describe web services, platforms, services, and devices by their proper real world names, and in most cases by the brand name we are interacting with. Just know that if what I’m referring to either sends or receives info – you can call it a node. But, I will apologize upfront for how many times I will have to say – node, node nodey node, node.
There are some services that are available to you as soon as you sign up, without you having to do a whole lot to make good use of them.
If you haven’t already signed up, go create an account at Octoblu
The easiest way is to login with Facebook or GitHub, if you choose to use your email you’ll have to verify your account.
Now, that were all ready to go, what can we do?
At the time of this video, when you sign up you’ll be redirected to the Design page, and you’ll be presented with a simple yet powerful demo flow. If you’re logging in and are not redirected to the Design page, choose “Design” from the main navigation window. Once you’ve arrived make sure that the Demo Flow is selected from the Flow Name Drop Down menu in the header of the page.
On the page, you’ll see a few little icons, some of them will be connected with squiggly lines, and others are just sort of floating in space.
What are these things? These are the nodes I’ve been talking about. Well, they’re not really the node, but they do represent it. You can think of it kind of like the node’s avatar. It’s got all the same properties & attributes as the service or device, but the service or device exists somewhere in the real world… and these are just here on the screen.
Each icon represents 1 action in the IoT. Looking at the demo flow that Octoblu gave us Id like to take a minute to go over what actions these icons represent.
But before we jump in the weeds here, What am I actually looking at?
I get that there are Icons and stuff but what does it actually DO?
Well, this Demo is going to:
listen – for you to tell it to start
ask Yahoo – “What is the price of google’s stock at this very moment?”
ask weather.com – “What temperature is it in Chandler Arizona?”
Show us the answers that Yahoo and Weather.com gave us
This Demo was created to demonstrate 3 fundamental techniques….
1. Using the building blocks provided by Octoblu to create some real world interaction
1. A Trigger is a tool provided by Octoblu to let you kick off any of your flows, from anywhere, at any time
2. How to use web services to get answers to the questions you’re asking.
2. Each of the Icons presented is going to ask a different webpage for some information
a. Yahoo Stock Price Info
b. Weather.com Weather info
3. How to inspect the data that is returned to you from an outside source.
Ok lets go over these Icons… the ones that are “people” are just comments to help you along the way. In this case they give us some important things to note.
1. You need to click the “Play” button in order to see anything happen.
While your flow is in the stopped state, its not gonna work, no matter how hard you wish
2. You can click on the trigger to make a flow DO something
3. You can add a node who’s only job is to listen for what you tell it, and print that on to the screen.
4. The note about pulsing is a little more cryptic
Its trying to tell you that using the heartbeat, you wont have to physically press a button to “hit the trigger”.
Generally I like to use the trigger until I’m done testing, and then hook up the stopwatch in flows where something needs to happened over and over again every few seconds, like asking twitter for new tweets.
The button Icon, is really called the Trigger Node
The Trigger Node –
A trigger is a virtual button. You can imagine that once you trip the trigger it starts a chain reaction 1 time, and then sits around waiting to be poked again. The Trigger in the Octoblu Flow Designer could literally be tied to a button in the real world, but thats beyond the scope of this intro. Octoblu provides a mobile app called Blu which will allow you to “press” any trigger from any flow that your account has access to in the designer.
When Blu loads the triggers from our flows into buttons on our phone, they are displayed on the phone with the name that has been applied in the designer.
By default all triggers start out with the name “Trigger” so the first thing you’ll want to do is give the trigger memorable or applicable name. To rename the node, mouse over the trigger, and click to select it. The “Node Inspector” window should then load up the details of the Trigger.
In the TextBox marked Name, that has the text “trigger” inside of it is where we can define the unique name for our node.
I named mine DF-Stock&Weather.
I chose this name, as part of a naming convention because it will cause the triggers to be grouped by the flow the belong to when I load the buttons in the Blu App.
The naming convention is:
DF – 1 Capital Letter for each word in the name of the flow – in this case it was “Demo Flow”
Stock&Weather – Name of each icon that the trigger touches, with an & in between
The TextBox named Topic is a place where we can add some additional information to for the trigger to say, when we tell it to speak.
Below that is an area for “payload type”. In our case, when we just want to use the trigger as a button to start a series of actions, so the payload type doesn’t matter, but as we start to build more complicated flows, it may be a cool option to timestamp the trigger, or send the name of the trigger as part of the data that gets sent forward.
At the time of this writing Octoblu is still in beta. but below the Payload type it says.
“There are two ways to trigger your web hook:”
For our purposes we will ignore this section, but if you want to trigger your button press by sending an email, like anytime a customer sends an email to the the listed address, you can extract the message, and use the action of receiving an email to trigger the change of a lightbulb in the customer service office, and then forward on the body of the message to the customer service email.
Now that we know a bit about the trigger node, lets explore the squiggly lines coming out of the side of the trigger. At the time of this writing there are 2 lines coming out of the DF-Stock&Weather Trigger. One connects to the Stock Price node, and the other connects to the Weather Node.
These lines are how Octublu tells a node which other things it can talk to. Its kind of like a direct phone line to a person waiting to listen to a question & provide an answer, or help out in some other way. When the phone rings they answer the call to get some instruction. Then they try to ask the question they’re responsible for answering, and if they’re told to. Then if there are squiggly lines connected to the other side of the node, it’ll send that answer somewhere.
The StockPrice node is fairly straight forward, so lets click on it to bring it up in the Node Inspector window. You’ll notice the TextBox on top is very similar to the one we saw on the Trigger. Its just a place for us to name this stop along the track, so that we can organize the information they report back to us.
Lets go ahead and change the name in the TextBox to “Citrix Stock Price”. The next item down the page inside of the Node Inspector is a toggle switch for “forward message” we wont need to forward the message so lets leave that switch in the off position. Continuing you’ll see a TextBox for Filtering the Endpoints, and an endpoint list below that.
What is an endpoint? It’s basically a question that you can ask of a web service.
In this case, the only endpoint available is “Get Last Trade Price” so the only question that this node can ask is “What is the last price of this stock <insert stock name here >”. For this example we will use Citrix since Octoblu is a Citrix company. Thanks Citrix!
So, in the TextBox labeled “Symbol” we will put Citrix Stock Symbol “CTXS”.
Now that we know about Endpoints, and names, the Weather Service will be a breeze. Go ahead and click on the Weather node to bring it up in the Node Inspector window. Lets rename this like we did the others, but in the name TextBox for this one lets write – “Weather – Miami Florida”. Just like with the Stock Price, we aren’t going to forward the message so we can leave that toggle switch in the off state, and then select the endpoint that we want. In this case there are only 2 questions we can ask:
What is the temperature in Fahrenheit ?
What is the temperature in Celsius ?
But if we scroll down a little further we can see that the weather service needs some more info to be able to properly answer that question.
This is how you can imagine the conversation going:
You hit the trigger and know that you want to find out the temperature but the weather service says “What area on earth are you asking about? — include the location, and we will give you an answer instead of another question”.
Since Octoblu knows that will be the answer, they’ve given you the option to tell the Weather Service up-front, what area on earth you’re asking about.
We can give Octoblu the details in the Node Inspector Window, and then it will know how to tell the weather service what area were asking about.
In the TextBox for City lets type “Miami”, for state lets enter – “Florida”, and for Country lets enter USA.
We can leave the toggle for “debug” in the off state, because the next action in the chain will print out the information anyway.
Now lets make sure to hit the Play button to bring the flow to life, and once Octoblu tells us we are good to go, by making the play button solid green… we can hit the trigger, and get our new stock & weather data.
Click on the Debug window to see the Output and confirm that Your shown a stock price for CTXS and the Temp in the MIA. If you got it all lined up right and go the answers to:
“What’s the temperature is it in Miami?”
“Whats was the last price of Citrix Stock?”
Then you’re an IoT Solutions Developer – Can I get a … What?!? What?!?