Introduction
This quick guide discusses the MQTT functionality available on Irisys Vector devices, and how to configure it.
MQTT is just one of the many different methods of retrieving count data from a Vector device. It works by pushing out selected data ‘topics’ whenever new data is available. This means that as soon as there is a change, data is received within a few seconds. MQTT data is accessed via an MQTT ‘broker’ which is a kind of middleman for moving the MQTT JSON messages around.
MQTT Configuration
Once you are connected to the Vector, the MQTT settings are accessed via the ‘Settings’ tab, then ‘MQTT’. Click the ‘Add’ button to enter new MQTT Broker details:
There can be multiple MQTT broker settings configured, each either pointing to different brokers and/or sending different data topics, as required. For example, you could send the ‘Counts’ data topic to a server at head office, and ‘Live Count’ data to an on-site Occupancy Reporting system.
The Field meanings are as follows (Note also the short help descriptions for each field displayed on the right of the MQTT tab):
- Address: This is the IP address or hostname of the MQTT broker. If using a hostname, ensure that the Vector’s ‘IP Settings’ tab is configured with valid and accessible DNS server(s).
- Port: MQTT is on port 1883 by default (with port 8883 being typically used for secure connections over TLS), but any valid port can be set here, as required.
- Keep Alive (seconds): This configuration option dictates how regularly the device sends a keep alive message to the broker. This is part of the MQTT protocol.
- Max History (hours): In the event that the device cannot communicate with the broker, it will retain any messages not yet sent. To limit storage requirements, any messages exceeding the max history will be discarded.
- Max Size (bytes): This option limits the amount of the data that the device can send to the MQTT broker in a single transmission. Any data not sent in a transmission due to this limit will be retained in the history and will be the priority for sending in the next transmission. Irisys recommend that the limit is set to no more than 256Kb, with a much lower value preferred.
- Credentials: Enable credentials if your broker requires a Username and password.
- TLS: Transport Layer Security. Enable if required for your MQTT Broker, and choose the certificate to use from the dropdown. Additional TLS Certificates can be uploaded to the device on the ‘Security’ tab if required.
- Register Filter: To minimise the amount of data being sent each time, it is recommended to select only the required register values. For example (from a device configured to be a SafeCount unit):
Topics
- Counts: Sends all/selected current register values at a configurable interval period (in seconds).
- Status: Sends connection and disconnection events.
- Targets: Sends live target X & Y positional data over this topic - streamed at 15 frames per second. This is a Vector Analytic Only feature.
- Live Counts: Sends all/selected current register values whenever there is any change.
- Device Info: Sends various device settings and parameters sent on connection and change, e.g. IP address, MAC address, Product ID, Sitename, etc.
- Events: A stream of information about each individual targets movements across lines and in and out of zones etc. Extremely useful for "Customer Journey" type applications where multiple Vectors are covering a large area containing different products/stands/demos etc. This is a Vector Analytic Only feature. The following options are available under the Events stream topic:
Event type descriptions are:
Target Birth - this is when a target first appears (initializes) within the whole field of view.
Target Death - this is when a target disappears (leaves the field of view).
Line Count - this is a line increment event. Note due to the configurable count mode associated with each line, this may not correspond to the actual line crossing. I.e. the Deferred count mode only increments when a target leaves the field of view.
Line Forward Crossing - a target crossing a line in the configured direction. This is an immediate output message and can therefore be different to the Line Count message above, dependent on register settings.
Line Reverse Crossing - a target crossing a line in the opposite direction to the configured direction.
Polygon Birth - a target appearing (initializing) within a configured zone.
Polygon Enter - a target entering a configured zone.
Polygon Exit - a target leaves a configured zone.
Polygon Death - a target disappears when inside a configured zone.
Retain State
To help prevent extra costs/processing of MQTT messages, the Retain State can be disabled if required:
QoS
Each topic has a Quality of Service (QoS) value that can be altered if required:
- 0 – Best effort delivery with no guarantee. Often referred to as “fire and forget”. Effectively provides the same guarantee as the underlying TCP protocol. I.e. minimum quality.
- 1 – Guarantees delivery at least one time to the receiver. Messages could be sent/delivered more than once.
- 2 – Highest level of service. Guarantees that each receiver gets the message exactly once. Safest but slowest level.