[Kuzzle IoT] Manage Sigfox devices with Kuzzle IoT

Hello everybody and welcome to this new Kuzzle.io demo. We often say that Kuzzle is an IoT backend because its real-time and multi-protocol capabilities make it suitable for an IoT project. So today we will dig into a simple demo to set up a communication between an IoT device and a Kuzzle exposed over the Internet. I have here a Sens'it which is a device developed by Sigfox. It is able to detect temperature, light, door opening movement and magnetic fields, and each time its sensor gets something, this asset will send a binary frame through this Sigfox network. Within the Sigfox network, the cloud servers will route this frame to our account, because they are aware that this particular device is associated to our account Now, once it's in our account the cloud servers from the Sigfox network will look for something called a callback. A callback is a simple function that will take the raw data payload sent by the Sens'it to a URL that we specify. Now that's where Kuzzle comes into play. I will have a Kuzzle server exposed to the Internet and I will configure the callback to call my Kuzzle and create a new document with the payload sent by the Sens'it inside the document. So that each new measure sent by this device will be stored into a new Kuzzle document. Now, let's take a look at how to do it. Now this is my Kuzzle I accessed it through the admin console and I have a Sens'it index with a data collection inside. This is where we will put our documents. And here is my Sigfox backend right into the management of my own Sens'it. And here is where I specify the callback So I create a new callback. I specify it's a custom one. It would be of type : data bidirectional And here I specifiy my URL which is iot.uat.kuzzle.io:7512/sensit/data/_create So this is the way that we reach the API endpoint that tells Kuzzle to create a new document. And it's a POST request. If you don't understand what we are doing here because you're not familiar with the Kuzzle API, I strongly encourage you to take a look at the video that explains how the API works. Now I have set up my callback here with the URL and the method, I have to specify the content type which would be application JSON. And I have here a tiny error That allows me to write the content of the document that I want create. So first field is of course the deviceId. And here I use a special syntax defined by the Sigfox network that allows the servers To interpolate this in place of this device string, the actual ID of my device. So it's basically a template. And then, along with the deviceId, I want raw data. I say raw because it will be binary. And we we will need if we want to use this data, we will need to parse it. And here I specify data. So I think that's pretty much it. Lets check. Data, bidirectional, URL. This is the URL with the correct index, collection and action. This is the correct verb the correct content type and this is the body. So if I create my new callback I can see it here as enabled. Now if I go back to my Kuzzle here I choose to watch my collection in order to be notified of whatever happens on this collection. So I subscribe to my collection. Now, I have configured my Sens'it here on magnetic field. And I have here a small magnet. What I expect that will happen, whenever I reach my Sens'it with my magnet, is that a new document will be instantly created on my Kuzzle instance So let's do it. Ok, you can see it gets lit means it detected something and if I take a look at my Kuzzle here, I see a new document created, notification with the correct deviceId and row data fields that are specified So this is pretty much everything from my demo I just let you imagine how many things you can do with such a simple solution. And while you imagine how to make your dreams come true you may have questions and you might be confused. In this case, I really encourage you to reach us on Gitter and ask whatever you need. We'll be glad to help. So it's enough for now. I hope I see you on the next video.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *