Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Current »

Introduction

MQTT (Message Queue Telemetry Transport) is a publish-subscribe-based lightweight messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a small code footprint is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker. The broker is responsible for distributing messages to interested clients based on the topic of a message.


Overview of MQTT topics

The communication among the modules is done through the MQTT broker using a set of topics and subtopics. The following table gives you a general overview of the topics that you can observe in our broker. Knowing this is important in order to do installation and configuration tests, as it gives you real time information of the status of the system. If you are going to connect to the broker you can use any MQTT tool that is available. We recommend using MQTT.fx, a JavaFX based MQTT client that will allow you connect to the broker, subscribe to topics and publish messages.


MQTT topic/subtopic
Used for
Description
config/completeSystem ConfigurationThis topic contains the complete XML configuration of the system, as published by the Config Provider. When the config provider receives a new configuration (in the topic config/complete_update) and the configuration is confirmed to be valid, it publishes it in this topic as the latest valid configuration. Please do not use it for configuration changes, use the topic config/complete_update instead. You can use it to know the latest configuration that was distributed in the system.
config/complete_updateSystem ConfigurationThis topic is used to update the configuration. An update configuration job will publish here the configuration in order to be received by the Config Provider. Technicians will also use this topic for quick tests during installation.
config/module/%ModuleName%/%CompleteOrUpdate%Module configurationEvery module receives after starting a configuration from the module Config Provider. This configuration consists of a list of topics to subscribe to in addition to obtain the configuration of related sensors, gateways, actions, rules etc.  includes which gateways, sensors and actions the module is responsible for. With this information, each module can build its internal configuration and start performing its tasks.
jobs/#JobsJobs are scripts and/or data that are passed from the cloud server to the Site Controller in order to perform a task. They are managed by the Job Processor module. A job can be anything, for example a new configuration, update of the system, change in an access control list for a site, etc. Please refer to our Jobs guide in order to get more information.
raw_result/%GatewayName%Raw resultsRaw results are provided by the gateways and publish the information that they gather to a topic with the gateway name. Internally, modules publishes values to this topic in order to be processed by the Raw Results Demultiplexer. These results are measurements that come in a yet to be calibrated raw format as they come from the devices, put into a json structure that allows grouping and evaluation in a later step.
calibrated_result/%SensorName%Calibrated resultsCalibrated results are the outcome of the processing of the Raw results by the Raw Results Demultiplexer module. They can also be directly generated by some modules, like the Automation Controller or Virtual Sensor Provider. The content of a Calibrated result is a meaningful piece of data, that belongs to a sensor. This information will be processed by the Calibrated Results Evaluator module to generate events depending on its value and a set of rules provided with the sensor's configuration.
events/%SYSID%/%SensorName%EventsEvents are special situations or changes of state on calibrated results. An event can be generated by the Calibrated Results Evaluator, an Action or the Automation Controller. They are immediately delivered to the cloud and reflect the current state of a sensor (its value will be in the calibrated_result).
cloud/%SYSID%/exec_action/%ActionName%Action executionWhen an action is published in this topic (do not be confused by the topic name, it is internal to the MQTT broker), an Actuator Module responsible for the action will execute them. Examples of actuator modules are the Modbus Daemon, Virtual Sensor Provider, SNMP daemon, Trap daemon. Actions can be published by the Automation Controller and the data_store (if the action has been requested to be executed from the cloud).

Notes about the table

%SYSID% is the serial number of the table.

%ModuleName% is the name of the module involved. Normally it corresponds to the service name.

%GatewayName% is the name of a sensor gateway as specified in the device's section of sensor_config.xml a.k.a. Site Configuration that was deployed to the SiteController

%SensorName% is the name of a sensor as specified in the sensor_config.xml a.k.a. Site Configuration that was deployed to the SiteController

%ActionName% is the name of an action as specified in the sensor_config.xml a.k.a. Site Configuration that was deployed to the SiteController

%CompleteOrUpdate% is either complete or update. A module starting up subscribes to the complete variant and gets the full configuration, then may unsubscribe from complete and instead subscribe to the update variant to only receive changes to the previous configuration when a new configuration is deployed.

"#" is the wildcard when performing subscriptions to MQTT topics. Refer to mqtt protocol documentation for further details. Please handle it with care, as this will probably overload your MQTT client with messages. Do not use the pound sign # for publishing, use the real topic name instead!

Next Steps


  • Link to a further read
  • Link to other articles
  • and more links
  • No labels