Feliz / Happy #IoTDay2018!

Desde el equipo de Sofia2 os deseamos un feliz y fructífero día del IoT 2018! ¿Cómo es el proyecto que tienes ahora mismo entre manos? ¿Estás usando Sofia2 como plataforma IoT? Cuéntanos en los comentarios 🙂


We wish you a happy and fruitful IoTDay 2018! What’s your current IoT project? Are you using Sofia2? We would love to hear from you, please tell us in the comments section.




Para celebrarlo, hoy nos utilizarán los asistentes al workshop de The Things Network Madrid en Makespace Madrid, sirviendo de plataforma IoT a los nodos y gateways LoRaWAN que se construyan en el taller (siguiendo el contenido de este enlace):



Happy IoTDay!



Feliz / Happy #IoTDay2018!

Meetup on Sofia2 LPWA Integrations: SigFox, LoRaWAN & The Things Network

On February 28th, we scheduled one of our technical Meetups, this time on LPWA technologies and how easy is to integrate them on Sofia2 IoT Platform. Please join our Meetup group where we will keep you updated with our future meetup events. You may also find here the slides used during the presentation.

A big thank you also to THECUBE Madrid team for giving us free access and use of their building. They also contributed by composing this really nice video on the event, enjoy it!:

These time our speakers where Jorge Trallero and Mario Briceño from our Sofia2 Team. They highlighted how easy is to integrate data collected from IoT devices with LPWA technologies into Sofia2. 3 integrations scenarios were performed:

  • SigFox Integration
  • Private LoRa Network Integration
  • The Things Network Integration

We also had the luxury of having with us member of the core team of The Things Network Madrid Community, to present us their initiatives and to collaborate in the latter integration scenario.

Seguir leyendo “Meetup on Sofia2 LPWA Integrations: SigFox, LoRaWAN & The Things Network”

Meetup on Sofia2 LPWA Integrations: SigFox, LoRaWAN & The Things Network

Sofia2 participates in the SESIAD Virtual Laboratory



The Virtual Laboratory of the Secretary of State for the Information Society and Digital Agenda (SESIAD) was born under the standard UNE 178104 “Integrated management systems of the smart city” with the aim of becoming a benchmark for national and international platforms, being a place of experimentation in which companies and developers can evaluate the compatibility of their products with different Smart Cities platforms.




Currently, platforms that participate in the Virtual Laboratory are Sofia2, from Minsait by Indra, SmartBrain from Cellnex and Thinking City from Telefónica. They collaborate with SESIAD contributing their expertise and participating in the improvement of interoperability between platforms.




As we saw in IoT Data Models: Initiatives and Sofia2 Data Model, there are different Initiatives of standardization of a Data Model in IoT. A Data Model represents the structure of your data and relationships, and therefore, organizes the elements and standardizes how they relate to each other.




GSMA and FIWARE Data Models are defined in JSON, so their representation as Sofia2’s Ontology is immediate. We saw how they are supported and how easy it is to work with these entities in Sofia2


To achieve better interoperability between platforms, NGSI 9/10 v2 was selected as a common protocol for the Interoperability Layer. We saw in this document how they are supported and how to consume APIS modeled according to the semantic FIWARE Data Model and published in Sofia2 following the NGSI 9/10 v2 protocol.


In our experience with the Virtual Laboratory, in addition to making recommendations for new attributes and modifications in the Data Model, we had the opportunity to perform a Proof of Concept (PoC) by creating a connection  and transformation flow of real data from Smart City A Coruña to GSMA/FIWARE Data Model on Sofia2’s Platform.


In this example, Smart Coruña parking data is collected and is ingested in an Ontology on the Sofia2’s platform. Each time an instance of this ontology is received, a Script is launched and transforms this data adapting them to the Data Model and, consulting them, we see how, effectively, the Data Models are fulfilled.




Also in this Proof of Concept we could publish this data through the API MANAGER of Sofia2 to later see that anyone with the proper permits can access this data via API, Curl or through the Virtual Laboratory portal.





All this process is explained in the post Acquisition, transformation and consumption of data with GSMA/FIWARE Data Model, and has been captured in the demonstrator, which, in addition to parking data, collects data from beaches and museums.




You can find all the information related to the SESIAD Virtual Laboratory here, as well as all the necessary tools (Data Model, APIs, Security tokens, examples …) to develop on the platforms complying with this interoperability model here





Sofia2 participates in the SESIAD Virtual Laboratory

Beijing Institute of Technology (BIT) meets Sofia2



In the context of “Winter School”, the collaboration framework between Polytechnic University of Madrid (UPM) and Beijing Institute of Technology (BIT), students from BIT visited Indra’s facilities in Madrid. Different Indra’s technological solutions were presented, highlighting the IoT approach based on Minsait IoT Sofia2 platform.




Sebastián Gómez, Business Development manager and Ayla Ruiz, platform consultant, introduced Sofia2 to the students, explaining its origin, present and future, as well as its main characteristics and capabilities.




They also presented the different types of projects where Sofia2 can be applied. They got help from Mario Briceño and Lucía Fernandez, IoT engineers, to explain practical examples and some of the different solutions that use Sofia2 as a technological base.




BIT students showed great interest in creating their own projects using  CloudLabthe Sofia2’s experimentation environment.

See you soon!!

Beijing Institute of Technology (BIT) meets Sofia2

Acquisition, transformation and consumption of data with GSMA/FIWARE Data Model



In the post How to work with Data Model FIWARE/GSMA in Sofia2 we saw how the Sofia2 platform supports the GSMA and FIWARE Data Models. We learned how to create Ontologies according to these models and how to insert data and consult them using the tool available on the BDTR and BDH Console. We also saw how to publish this Ontology as a RESTFul API and how to consume the API.


In addition, we have the document Use of FIWARE Data Model and API NGSI9 publication, where we explain how to consume APIS modeled conformant FIWARE Data Model semantics and published in the Platform following the NGSI-9 protocol.


For the example, we use the Ontologies:

  • GSMA_OffStreetParking_Destino
  • GSMA_PointOfInterest_Beach
  • GSMA_PointOfInterest_Museum


Step by step we explains how to subscribe to these Ontologies, how to consult your Data through the BDTR and BDH Console, how to subscribe to NGSI-9 APIs and consume them through the API Manager developer portal and how to access these APIs via Curl.




With all this information, and knowing that Sofia2 allows you to create Rules Scripts (it is advisable to read the Scripting Engine Sofia2 User Guide) that will be executed before the arrival of instances of Ontologies or every so often, it is easy to understand how we can receive data with a determined structure and transform them to meet these Data Models.


We will check it through the following flow:




In this example, Smart Coruña car park data is collected, an Ontology is ingested on the Sofia2 platform, each time an instance of this ontology is received, a Script is launched that transforms this data adapting it to the Data Model and consulting it, we see as indeed, it is fulfilled with the GSMA and FIWARE Data Models.



Acquisition, transformation and consumption of data with GSMA/FIWARE Data Model

Client Code Generation in Test&Doc APIs


This new utility consists of a client code editor for the APIs of the Ontologies in the most popular programming languages, in this way we will only have to copy the code that it generates and insert it in our applications.

For this we must access the API of the Ontology that we want to invoke. In this example, it will be “APARCAMIENTOSPUBLICOSMADRIDES “. So we will access the “API MANAGER” menu, and the “APIs” submenu:

Image 001

Once here, we go to “My Subscriptions” tab:Image 004

We choose the API that we want to test. And click on the “Test & Doc” button:Image 007

Here we have information about the API and the functions it exposes for its consumption. We are going to choose the “getAll” function:

Image 010

Next we are shown the information referring to that function, and on the right part a drop-down menu called “API Invocation” will appear, in which we will choose the language we want to use to invoke the function:

Image 013

And this will generate the piece of code needed to invoke the function. We will only have to complete this code using the logged user’s token in the “x-sofia2-apikey” part:

Image 016

I have created a sample page in HTML using JQuery, to insert the code that generates us for the API method, the HTML code used for the example would be:


<!DOCTYPE html>

<meta charset=”UTF-8″>
<title>Test API</title>

$(document).ready(function() {
$(“#myButton”).click(function() {

var settings = {
“async”: true,
“crossDomain”: true,
“url”: “https://sofia2.com/sib-api/api/v1/aparcamientospublicosmadrides/getAll&#8221;,
“method”: “GET”,
“headers”: {
“x-sofia2-apikey”: “********************”

$.ajax(settings).done(function (response) {
var num = response.data.length;
$(“#helloWorldDiv”).html(“Request URL: https://sofia2.com/sib-api/api/v1/aparcamientospublicosmadrides/getAll
Num Result: ” + num);




<button id=”myButton”>Test API</button>




result could be something like this:

Image 028

Client Code Generation in Test&Doc APIs

Integration of Lora and Sofia2

The communication between Lora and Sofia2 is done through the Multitech kit, formed by a test node that simulates the transmissions between a Lora device and a Gateway. This Gateway is needed to communicate this type of devices within the network and to send the captured data.

Used Multiconnect Conduit Kit.

Before the integration in Sofia2, the configuration between the Gateway and the test node is needed. In this brief tutorial, the steps to develop both configurations are collected, as well as all the information needed in Sofia2 to receive and store the data sent by Lora.

Configuration of Lora technology

  • Gateway configuration

    In order to use the gateway without any connection problem, an initial configuration is needed. First access to the Gateway must be done by means of serial communication, though Putty or another similar tool. Credentials needed to access by console are admin/admin. We can get its IP address with the command ifconfig. Once the IP address is known, we use the explorer to access to the Multitech webpage, where we introduce the same credentials again.

    Acceso web al gateway
    Access to the gateway webpage

    Once we start the session, and only by the first time that we do it, we will find an assistant that requires us to change the password, to select the timezone and to configure the IP address. When the last window appears, we must to configure the static IP, to select the corresponding Gateway, and to add the DNS servers.

    Once we finish the IP configuration, we will configurate Lora. To do that, we have to access to Setup -> Lora. Then, we will see a screen where we will see some configurable fields. Anyway, we only need to modify Name and Passphrases.

    Lora configuration
  • Node-Red configuration

    Once we activate the Node-Red application, we can access though the “App” menu of the webpage. By default, a program that receives Lora test data and shows them is designed, but we have to modify it in order to send the information to Sofia2. Image shows the final flow diagram, with the option “Sofia2 API WEB encoder” added. This option is uncharged of giving the desired format, adding a header to the send message and an output HTTP.

    Node-Red diagram
  •  Configuration of test node

    To configurate the parameters of the test node is really simple. We only have to connect the mDot to the PC, by means of a USB, and to connect it to the test node with the kit programming cable. Then, we select the “Configuration” option in the mDot Box and we access to the device by using the Putty serial communication at 115200 baud.

    Lora tester

    We only need to configure two parameters, using the following AT commands:



    AT&W is used to save changes and  AT+Exit to exit the configuration mode.

    <Name> y <Passphrase> fields have to be the same values as used previously in the gateway.

    Configuración del tester
    Test node configuration

    In order to check if the configuration of both devices has been correct, we can do a test with the Node-Red.


Once that the devices have been configured, we have to develop the next steps in Sofia2. We need two new ontologies, an API rest and a rule script to deal with data. This section briefly explains with each of them.

  • Defining new ontologies

    First of all, we have to create an ontology that will receive the data sent by the test node. In this ontology we will insert raw data, without any previously filtering.

    Ontology example with raw data

    As we can see in the previous image, data usually have hexadecimal codifications, undesirable formats or information that needs to be treated before work with it. To do that, we have to create a rule script and a new ontology, where we will insert filtered data with the format required by the data base to correctly store it.


    Once the ontologies are defined, we will create an API REST of type POST, to insert data in the ontology of raw data. To do that, we have to go to the API MANAGER -> APIs, where we will find the option “New API”. There, we write the name of our API, and select the option “Publish Ontology as REST API” and the ontology desired. It is convenient to disable the maximum number of calls per minute, in order to assure that we do not lose information. At the end, we select the “POST” operation and create the API.


    The URL of the “Base Endpoint” field is the one that we have to insert in the Node-Red.

  • Rule script

    Once verified that the data sent directly from the device is correctly inserted in the desired ontology, we must create a script to filter them, extract all possible information and provide them with the corresponding format. To do this, we simply enter Rules-> Wizard New Rules and select the option “Generate rule using a template “. With this type of rules, each time the device sends new data to the ontology, the script will be executed and data will be processed and inserted into the final ontology.

  • Presentation on results

    We can use Sofia2’s visualization tools to show the data we’re storing quickly and easily. To do that, we have to go to the Visualization ->My Gadgets -> New Gadget, where we can select the optimal tool depending on our data. On the basic of measured data from Lora tester, the following representation could be interesting: to drawn the coordinates on a map or Signal to Noise Rate (SNR) along the time.

Coordinates shows on a map
SNR representation.
Integration of Lora and Sofia2