Skip to content

telefonicaid/iotagent-json

Repository files navigation

FIWARE IoT Agent for a JSON-based Protocol

FIWARE IoT Agents License: APGL Docker badge Support badge
Documentation badge Status

An Internet of Things Agent for a JSON based protocol (with AMQP, HTTP and MQTT transports). This IoT Agent is designed to be a bridge between JSON and the NGSI interface of a context broker.

It is based on the IoT Agent Node.js Library. Further general information about the FIWARE IoT Agents framework, its architecture and the common interaction model can be found in the library's GitHub repository.

This project is part of FIWARE. For more information check the FIWARE Catalogue entry for the IoT Agents.

📚 Documentation 🐳 Docker Hub

Contents

Background

This IoT Agent is designed to be a bridge between an MQTT/HTTP+JSON based protocol and the FIWARE NGSI standard used in FIWARE. This project is based in the Node.js IoT Agent library. More information about the IoT Agents can be found within the library's GitHub repository.

A quick way to get started is to read the Step by step Manual.

As is the case in any IoT Agent, this one follows the interaction model defined in the Node.js IoT Agent Library, that is used for the implementation of the Northbound APIs. Information about the IoTAgent's architecture can be found on that global repository. This documentation will only address those features and characteristics that are particular to the JSON IoTAgent.

If you want to contribute to the project, check out the Development section and the Contribution guidelines.

Additional information about operating the component can be found in the Operations: logs and alarms document.

Install

Information about how to install the JSON IoTAgent can be found at the corresponding section of the Installation & Administration Guide.

A Dockerfile is also available for your use - further information can be found here

Usage

Information about how to use the IoT Agent can be found in the User & Programmers Manual.

API

Apiary reference for the Configuration API can be found here More information about IoT Agents and their APIs can be found in the IoT Agent Library documentation.

The latest IoT Agent for JSON documentation is also available on ReadtheDocs

Command Line Client

The JSON IoT Agent comes with a client that can be used to test its features, simulating a device. The client can be executed with the following command:

bin/iotaJsonTester.js

This will show a prompt where commands can be issued to the MQTT broker. For a list of the currently available commands type help.

The client loads a global configuration used for all the commands, containing the host and port of the MQTT broker and the API Key and Device ID of the device to simulate. This information can be changed with the config command.

In order to use any of the MQTT commands, you have to connect to the MQTT broker first. If no connection is available, MQTT commands will show an error message reminding you to connect.

The Command Line Client gets its default values from a config file in the root of the project: client-config.js. This config file can be used to permanently tune the MQTT broker parameters, or the default device ID and APIKey.

Testing

Mocha Test Runner + Should.js Assertion Library.

The test environment is preconfigured to run BDD testing style.

Module mocking during testing can be done with proxyquire

To run tests, type

npm test

Requirements

All the tests are designed to test end to end scenarios, and there are some requirements for its current execution:

  • Mosquitto v1.3.5 server running
  • MongoDB v3.x server running

License

The IoT Agent for JSON is licensed under Affero General Public License (GPL) version 3.

© 2018 Telefonica Investigación y Desarrollo, S.A.U