Working with MQTT

MQTT Basics

MQTT is a method of transferring data from the hub to a computer system.  The hub will act as a MQTT Publisher.  To access this mode, the hub OPT switch needs to be set to 3. The hub has got to know the IP address of the MQTT broker, and in order to do this you need to "pair" the hub with the broker.  This is done by using the special Ping command with a length of 40.  The Ping command should be issued from the computer which is to act as the MQTT broker. 

MQTT Topics

The hub sends MQTT information with the following topics.  
  • RFID/data  This is data when a tag either goes into, or out of, a RFID reader field. Edge types R and U
  • RFID/data/continue This is data sent every 15 seconds or so, when a tag is static in a RFID reader field - Edge type C
  • RFID/system This is sent every 5 seconds or so, just to make sure that the MQTT connection is valid - Edge type S
By using widlcards in the appropriate way, any combination of these three topics can be displayed.

MQTT packet format

Each complete MQTT packet starts with a "[" symbol (0x5b), and ends with a "]" symbol (0x5d). The packets can have one or more messages inside, and each message is separated by a comma, "," (0x2c).  

A message has the following format {"S":"082","E":"R","U":"082B278907"}
  • { is the start of message character 
  • "S": is the Sensor field
  • "082", is the Sensor number - this can be any number from 001 to 512, depending on the reader and the address of the hub.
  • "E": is the Edge field
  • "R", is the type of edge - R indicates a tag entering a reader field, U indicates a tag exiting a reader field, C indicates a tag static over a reader field, S indicates a system field.
  • "U": is the Unique identifier field
  • "082B278907" is the Unique 5 byte identifier of the tag when the edge field is R,U or C. When the edge field is S, the last 8 bytes, in hex, indicate the active  reader channels attached to the hub, so 00000F0000 will indicate channels 17-20 are connected.  
  • } is the end of message character