Blog

Make Sense of Your Sigfox Data Using Wia

Hey All, Today we're going to look at turning your Sigfox data into a human readable form that you can easily use in your applications. Before we start, have a look at the How To Integrate Any Sigfox Device With Wia tutorial to get your devices connected to Wia.

For this tutorial, my Event data will contain the hexadecimal string aabbccdd. We will show how to convert this to binary, take the first 6 bits as our temperature reading and create a new Event.

Create a Flow

  • Go to the Flows and click Create Flow.
  • Enter a name for your Flow. I'm going to call mine Translate Sigfox Data.
  • You will then be redirected to the Flow Studio.

Screen Shot 2018-01-01 at 14.48.11

Add a Trigger Node

  • In the Flow Studio, drag over an Event trigger node from the panel on the left.
  • Select the node, enter sigfoxDataUplink as the name of the Event in the panel on the right and click Update.

Screen Shot 2018-01-01 at 13.12.56

Add a Logic Node

  • Drag over a Run Function logic node from the panel on the left. This node allows you to inject your own Javascript and manipulate the data flowing through.
  • Copy the code below into the Code Block and click Update.
let sigfoxData = event.data.sigfoxData;
let binaryData = parseInt(sigfoxData, 16).toString(2);
let tempBinary = binaryData.slice(0, 6);
let result = parseInt(tempBinary, 2).toString(10);
event.data = result;

Screen Shot 2018-01-01 at 15.07.29

Add an Output Node

  • Drag over an Event output node from the panel on the left.
  • Enter temperature as the name of the Event.

Screen Shot 2018-01-01 at 15.07.21

Connect the Nodes

  • Click on the white diamond shape at the bottom of the Event node and drag the line to the input of the Logic node.
  • Click on the white diamond shape at the bottom of the Logic node and drag the line to the input of the Output node.

Screen Shot 2018-01-01 at 15.07.48

Add Flow to Your Device

  • Go to Devices and select the Device your would like to add the Flow to.
  • Click on Flows in the subnav then click on Enable beside the Flow name.

Run the Flow

Publish an Event from the Device and you will see the new temperature Event come through.

(Optional) Create Multiple Events in the Same Flow

If you wish to create multiple events, just follow the previous steps for your other data points.

Screen Shot 2018-01-03 at 10.12.58

That's all folks!

P.S. If you need any help with getting setup, tweet us or email support@wia.io

References
Sigfox is a French Internet of Things (IoT) company founded in 2009 that builds wireless networks to connect low-energy narrowband objects such as electricity meters, smartwatches, and washing machines, which need to be continuously on and emitting small amounts of data.


Recommended article

Ready to get started?
Talk to our sales team or setup an account.