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.
- Go to the
- Enter a name for your
Flow. I'm going to call mine
Translate Sigfox Data.
- You will then be redirected to the Flow Studio.
- In the Flow Studio, drag over an Event trigger node from the panel on the left.
- Select the node, enter
sigfoxDataUplinkas the name of the Event in the panel on the right and click
- Drag over a
- Copy the code below into the
Code Blockand click
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;
- Drag over an
Eventoutput node from the panel on the left.
temperatureas the name of the Event.
- 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.
- Go to
Devicesand select the Device your would like to add the Flow to.
- Click on
Flowsin the subnav then click on
Enablebeside the Flow name.
Publish an Event from the Device and you will see the new
temperature Event come through.
If you wish to create multiple events, just follow the previous steps for your other data points.
That's all folks!
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.