Blog

Getting started with the Thingstream test button and flow library [video]

In this video, we’ll show you how to get started with the Thingstream button. You’ll learn how to connect your button and other IoT-enabled hardware to the Internet of Things via the Thingstream platform.

You’ll also learn how to download pre-built flows (programs that run inside the Thingstream platform) from the Thingstream flow library.

If you’d like more information on the Thingstream platform or information or you’d like to find out if Thingstream global IoT connectivity is the right choice for you, please get in touch.

Get in touch

Audio transcript

In this demo, I’ll show you how to get started with the thing stream button. This will help you get your bearings in the Thingstream platform, as well as showing you how to create and connect your things.

The Thingstream button gives developers and engineers a ready connected device that can be used to develop proof-of-concept solutions for the Internet of Things.

It only takes a few minutes to get the button up and running and communicating with the Thingstream platform, meaning you can start developing IOT solutions faster.

Let’s get right to it.

Setting up the Thingsream test button

Firstly you’ll need to log in at thingstream.io. Once logged in, click on “Things” in the menu on the left-hand side. You should see your button listed there.

By default, the device name is blank. You can change this to anything you like. You’ll also see a reference number next to this that will match the number on the bottom of your button.

If you’ve just received your button, the status on the right-hand side should say, “Shipped”. It will need activating before you can use it.

To activate your button, just click on the overflow menu – that’s the three dots on the right-hand side of the list – and select “Activate”. In a couple of seconds so your button will be ready
to use.

Using the Thingstream flow editor

Next, click on “Flows”. In here you’ll find the programs which run when a device, in this case, your button, sends messages to the platform. To help you get started, a number of ready-made flows are available to download without leaving the platform. Let’s download one now.

Click on the “Create flow” button in the top right-hand corner of your screen. From the options
given, choose “from public flow library”. This will open a pop-up showing a list of flows that are available for download.

Locate the flow named “Email CSDK Tracker Location” and press the “copy” button immediately to its right. This will copy the program to your flows window. You’ll see it there as soon as the pop-up closes.

Your button has GPS capability built-in and this particular program sends an email to an address of your choosing containing the GPS location of the button if it’s available. If not, it will send an estimated location based on cell tower information.

To the right of the newly downloaded flow, you’ll see three dots. Click here to open the menu. From the menu, choose “Edit flow”, and this will open the flow for editing.

Before we deploy the flow and get it running let’s take a look at some of the components, or “nodes”, as they’re called.

In the flow on the left, here you will see a node called “Thingstream Subscribe”. This node represents a subscription to an MQTT topic, to which the flow is subscribed. The topic is set when the flow is deployed. In this case, we’ll be subscribing to the topic to which the button publishes. We’ll come to that later.

Next to that is a “JSON” node. This converts the byte array sent from the Subscribe node to JSON, making the data easier to work with. From here, we pass the data to a logic node. In this case, the node is looking to see whether the property “msg.payload.gps-location” contains a value or not. If it doesn’t contain a value, the first output will be selected, triggering that part of the flow and passing the resulting value to the corresponding output. Simply put, if the button can find a GPS location it will then trigger programming to pull that GPS data out and send it to the email address specified in the email node at the end of the flow. If the button can’t find a GPS location, for some reason, this node will then switch on the other half of the flow which gives an estimated position based on data from cell towers.

You can see the specific programming functions for these actions by clicking into any of the pink function nodes. For example, here the function node is taking the GPS data and converting it into a format that will produce a Google Maps URL.

This node here is a debug node. When you’re building and testing flows, this node is used to catch messages and send them to the debug window on the right. You’ll see that in action when you press your button at the end of this demo.

Before we deploy, go to the green email node, put in your own email address and press save.

Now let’s deploy the flow and see it in action. Click on “Deploy”, top right, and then “Deploy to test”. This will open a pop-up where you can select the MQTT topic or thing to which the flow subscribes. In this case, select “a thing”. To connect the flow directly to the published topic of your button, locate your button in the list and select it, and then click “Deploy”. All that’s left now is to press it and see what happens. if you followed the steps here closely, your button should now send you an email with its location, each time it’s pressed.

And that’s all there is to it. Thank you for watching.

If you’d like more information on the Thingstream platform or information or you’d like to find out if Thingstream global IoT connectivity is the right choice for you, please get in touch.

Get in touch

Author

Lee Stacey, Content Lead at Thingstream

Lee Stacey

Content & Community Lead @ Thingstream

Connect with Lee Stacey on Linkedin

Ready to get started with Thingstream's IoT Connectivity Platform?