Sofia2

Sofia2 is a middleware developed by Indra that allows the interoperability of multiple systems and devices, offering a semantic platform to make real world information available to smart applications (Internet of Things).

It is multi-language and multi-protocol, enabling the interconnection of heterogeneous devices. It provides publishing and subscription mechanisms, facilitating the orchestration of sensors and actuators in order to monitor and act on the environment.

Configuration

The plugin to connect Meshlium to Sofia2 platform is in the Manager System menu:

Cloud Connector -> Basic Cloud Partner -> Sofia2

Figure : Sofia2 configuration

Registering the Meshlium device in Sofia2 is a previous step required to connect the Meshlium with Sofia2. At the end of the registration process you will obtain the configuration parameters needed to set up the Meshlium plugin properly.

This configuration includes the following information:

  • Measures Ontology: Collection (table or storage) where the measures from Waspmote sensors sent by Meshlium (the gateway) will be stored into the platform.
  • Monitoring Ontology: Collection (table or storage) where monitoring values (internal temperature, battery level...) of the Waspmotes connected to Meshlium, will be stored into the platform.
  • Client Name: Name of the Meshlium unit to be identified by Sofia2 platform, checking if it has permission to write on the ontologies.
  • Client Identifier: Identifier of the Meshlium unit to differentiate between several Meshliums using the same Client Name.
  • Authentication Token: Token to authenticate the Meshlium device during the establishment of a session with Sofia2 platform.

Register Meshlium in Sofia2

To register Meshlium in Sofia2, click on the link Get Configuration From Sofia2.

Figure : Sofia2 configuration link

You will be redirected to the following page:

Figure : Sofia2 configuration portal

Where:

  • Login using your Sofia2 account.
  • Create a new account if you do not have a valid login user.

Logging in Sofia2 platform will redirect to the following page that suggests a name for your collections of measures and monitoring data, and for your gateway identifier (KP in Sofia2 terms):

Figure : Sofia2 configuration information

Finally, after creating the configuration, you will obtain a JSON file containing all configuration values ready to be pasted on the Manager System, in order to setup the Sofia2 Cloud Connector:

Figure : Sofia2 JSON configuration

Configure the Cloud connector

The configuration from Sofia2 can be setup in Meshlium just by clicking Paste configuration received from Sofia2 and pasting the JSON generated in the previous step.

Figure : Sofia2 pasting JSON configuration

Configuring the plugin this way, the fields for Measures Ontology, Monitoring Ontology, Client Name, Client Identifier and Authentication Token will be completed.

Alternatively, these fields can be filled in manually, with the information received from the configuration page of Sofia2 showed in the first step.

Select communication protocol

REST

REST is a stateless communication protocol over HTTP. Using this protocol, the Cloud Connector is a client of the Sofia2 platform, that periodically opens a connection with the platform to send an HTTP POST operation containing the sensor measurements.

The parameter of the REST protocol are:

Endpoint: URL of the REST Gateway of Sofia2 platform. It is the REST server that will receive requests from clients.

Figure : Sofia2 REST protocol

MQTT

MQTT is a stateful communication protocol over TCP. Using this protocol, the Cloud Connector is a client of the Sofia2 platform, that initially opens a connection with the platform, maintains it alive during that time, and periodically sends an MQTT packet containing the sensor measurements. In case of disconnection, the connector periodically tries to reconnect.

The parameters of the MQTT protocol are:

  • Server: IP or machine name of the MQTT gateway in the Sofia2 server.
  • Port: Port of the MQTT gateway in the Sofia2 server.
  • KeepAlive: Interval in seconds that the connector will use to check the status of the connection.
  • Connection Timeout: Timeout to establish a connection.
  • Response Timeout: Timeout to wait response from the Sofia2 server.
  • Auth user: Optional. MQTT protocol authentication user.
  • Auth password: Optional. MQTT protocol authentication password.

Figure : Sofia2 MQTT protocol

Websocket

It is a stateful communication protocol over HTTP. Using this protocol, the Cloud Connector is a client of Sofia2 platform, that initially open a connection with the platform, maintains it alive during a defined time, and periodically sends a HTTP packet containing the sensor measurements. In case of disconnection, the connector periodically tries to reconnect.

The parameters of the Websocket protocol are:

  • Endpoint: URL of the Websocket gateway of Sofia2 platform. It is the server that will receive requests from clients.
  • Timeout: Timeout for any operation with the server.

Figure : Sofia2 Websocket protocol

Save the configuration and start the connector

Once all configuration and connection parameters are setup, they can be stored and the connector can be started to send information to Sofia2.

To save the configuration, click on the "Save" button:

Figure : Sofia2 save configuration button

After saving the configuration, the Cloud Connector can be started by clicking on the "Start" button:

Figure : Sofia2 synchronization service running

You can stop the process at any moment by clicking on the "Stop" button.

Figure : Sofia2 synchronization service stopped