MQTT and event distribution
All Broox Controller instances use a MQTT broker
to send and receive messages.
Every device gets a single MQTT address of the form /device/device-id
(where device-id
is a random identifier generated online).
The Broker should run on the same host as the controller, at least on port 1883.
The message payload is a JSON-encoded string.
When received by the Controller those are converted to internal Events.
Trigger Messages (sent)
{ "cmd": "trigger", "class": "<trigger-class>", "action": "trigger-action", "id": "<trigger-id>", … }
- Trigger messages SHOULD be sent upon detection of some external event.
- The command will always be "trigger".
- The
class
determines the kind of sensor triggered. Possible values (open list):- rfid
- marker
- face
- profile
- media
- The action can be generic or class-specific. Generic ones include:
- in
- out
- move
- In case of different actuators, id will contain a string identifying each.
- In case of RFID tags, the RFID tag in hex.
- In case of faces, a generic counter identifying the person or a vector.
- In case of markers, a preset identifier.
- In case of onevent, a finger number to track (suggested, not enforced).
- Extra arguments can be added to the payload object.
- Face attributes (age, gender, glasses…)
- Positional attributes (x, y, rotation, size…)
- etc.
Reload request (received)
{"cmd": "reload" args: []}
- Upon reception, the device
- MIGHT send an offline message
- SHOULD request its own configuration again
- SHOULD reconnect to MQTT or check for changes in the device channel
- SHOULD apply any new configuration received
- SHOULD send an online message