|MQTT||v2.0||Apr 11 2019||645 KB||629238afd7cab9754bd166a1a141075a|
|JNIOR MQTT Topics Application Note||Dec 21 2018||558 KB||0bb178019ec0cdd967f5434613b74366|
The INTEG JNIOR automation controller is capable of being an edge device for the Internet of Things (IoT) applications using the MQTT protocol. The JNIOR can both publish and subscribe to topics using an MQTT broker.
The JNIOR implements the complete MQTT protocol including CONNECT, CONNACK, PUBLISH, PUBACK, SUBSCRIBE, SUBACK and UNSUBSCRIBE. The JNIOR can also provide all three Quality of Service levels.
What is MQTT?
This is what MQTT.org says:
MQTT is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.
Here is a great intro to MQTT.
NOTE: This application is in development and screenshot may appear different when released.
Use MQTT with the JNIOR
Currently the MQTT functionality is limited but we are always looking for suggestions. Currently will publish IO status by default. When the JNIOR boots up and successfully connects to a broker we will report the current status of the digital IO. Digital inputs will report state, usage meter and counter values. Relay outputs will report just state and usage meter values.
To successfully connect to a broker you will need to have selected a broker and entered its information. Information such as the Host URL, port number and whether the connection should be encrypted. The JNIOR implements MQTT across a TCP connection. The default port number for MQTT is 1883 when non-secure connection while it is 8883 when using a secured connection. There are several public test brokers out there. Do not use any free broker for sensitive information. Brokers that require sign up will most likely provide a user name and password.
There are two types of groups, Device Groups and Relay Output Groups. Both of these concepts are in BETA as of version 1.2 and we are looking for feedback.
Device Groups allow JNIORs to subscribe to topics that contain the Device Group name instead of the Serial Number. A JNIOR can be part of one or many Device Groups. By default a JNIOR will subscribe to topics that are meant for it by Serial Number, for instance,
jnior/618010001/set/... The JNIOR may want to be part of the pump stations group for example the JNIOR will subscribe to
Relay Output Groups allow the specification of more than one relay to be affected at once. To set relay channel 1 you can publish the
jnior/SERIAL_NUMBER/set/digital/outputs/1/state = true. But maybe you want channels 1 – 3 to be affected at once. To do this you will define a named Relay Output Group, “lights”, for example. Then, when the JNIOR receives the
jnior/SERIAL_NUMBER/set/digital/outputs/lights/state topic all defined relays will change at once.
Enhance the MQTT implementation!
You can enhance the MQTT implementation on the JNIOR with a custom application. Any topic that the JNIOR receives that is not part of our native implementation will be posted to the message pump for the consumption by another application. A custom application may also put topics with payload data to the message pump to be published by the MQTT application. This way the MQTT application performs the protocol logic while the custom application can worry about the logic.