File | Date | Author | Commit |
---|---|---|---|
configurator | 2017-11-30 | Javier | [e8a9f6] Repository updates |
fiware-cepheus | 2017-12-01 | Javier | [2fb839] Merge branch 'master' of |
iotagent-mqtt | 2016-10-26 | Javier | [dcfb04] Initial commit |
iotagent-node-lib | 2016-10-26 | Javier | [dcfb04] Initial commit |
README.md | 2016-11-29 | Javier | [d1d6c2] README edited |
Read Me
IoT Hub - ATOS
Table of contents
Introduction
This document contains the documentation of the IoT Hub provided by ATOS and it
includes the following parts:
- Description of IoT Hub from ATOS
- Documentation about how to start up the IoT Hub
- Documentation about how to use IoT Hub
Description
The IoT Hub is composed by a set of four sub-components that tackle three different
issues: communication, management of the devices and handling of data.
-
Both Protocol Adaptation and IoT Broker are subcomponents used for enabling the
communication between both IoT systems and C2NET platform, granting interoperability
and adaptation between different protocols and the matching between consumers and providers of data. -
For managing the different types of IoT devices that could be available at the companies,
a component called Device Management is presented. This module encloses generic information
about the devices and also addresses their security and connectivity. -
Supporting data handling functionalities, IoT Hub is also granted with a sub component
that ensures that the data obtained in the IoT world is pre-filtered before being passed
to C2NET platform, reducing the flow or the quantity of inaccurate data.
How to start up the system
Before starting up the system, all the required information (devices, entities, filtering
conditions, etc...) to run correctly the IoT Hub has to be recorded or filled in a form
provided by the Resource Manager User Interface (RM UI).
Once this information is stored, the RM UI will provide the IoT Hub with two endpoints to connect
to C2NET platform, one is in charge of gathering the configuration data and the other one allowing
the Hub to send data to the platform.
Prerequisites to run the system correctly:
C2NET Platform end-points (configuration end-point & data end-point),
Node.js, npm, Java8, Maven and a MQTT broker running.
Clone the repository
$ git clone https://opensourceprojects.eu/git/p/c2net/dcf/iot-hub/iot-hub-1/code IoTHub
Prepare iotagent-node-lib as a dependency of iotagent-mqtt
$ cd IoTHub/iotagent-node-lib $ npm install
Prepare iotagent-mqtt
$ cd IoTHub/iotagent-mqtt $ npm install
Copy iotagent-node-lib into node_module folder of iotagent-mqtt
$ cd IoTHub/ $ cp -r iotagent-node-lib/ iotagent-mqtt/node_modules/
Before starting the iotagent-mqtt, check config.json file, where it has to be set where the MQTT broker is
running and in which port will the agent be running:
config.mqtt = { host: 'localhost', port: 1883, defaultKey: 'C2NET', thinkingThingsPlugin: true } server: { port: 4041 }
Start iotagent-mqtt
$ cd IoTHub/iotagent-mqtt $ bin/iotagentMqtt.js
Add C2NET Platform data end-point and compile fiware-cepheus
$ cd IoTHub/fiware-cepheus $ nano cepheus-broker/src/main/resources/application.properties (at this point update values of c2net.uri & event.identifier) $ mvn clean install
Start cepheus-broker
$ cd IoTHub/fiware-cepheus/ $ java -jar cepheus-broker/target/cepheus-broker-0.1.5-SNAPSHOT.jar
Start cepheus-cep
$ cd IoTHub/fiware-cepheus $ java -jar cepheus-cep/target/cepheus-cep-0.1.5-SNAPSHOT.jar
Add C2NET Platform configuration end-point and compile configurator
$ cd IoTHub/configurator/ $ nano src/main/resources/application.properties (at this point update values of c2net.uri & event.identifier) $ mvn clean install
Start configurator
$ cd IoTHub/configurator/ $ java -jar target/configurator-0.0.1-SNAPSHOT.jar
How to use the system
Once the system has been configuration it is ready to be used. IoT Hub support the MQTT protocol to
receive data from devices or gateways.
MQTT topics are created following the next structure:
- For single attribute measurement: /C2NET/${deviceName}/attributes/+
- For multiple attributes measurements: /C2NET/${deviceName}/attributes
See an example below:
Consider the registration of a gateway that is capable to manage several devices or sensors that
can send readings of temperature and humidity, it could be called "plantGateway" as and example.
Once we register the specific configuration of the plantGateway in the Hub, it will be possible to
start sending measurements through the following topics:
Sending a single measurement:
Topic: /C2NET/plantGateway/attributes/temperature Data to topic: $ mosquitto_pub -h ${host} -t "/C2NET/plantGateway/attributes/temperature" -m "19" host: represents the host where the MQTT broker is running, typically localhost.
Sending multiple measurements:
Topic: /C2NET/plantGateway/attributes Data to topic: $ mosquitto_pub -h ${host} -t "/C2NET/plantGateway/attributes" -m "{'temperature':'25', 'humidity':'60'}" host: represents the host where the MQTT broker is running, typically localhost.