MQTT API Specification
TAPPER can communicate over MQTT using JSON messages.
Topic
Every MQTT Topic starts with tapper/$id/, where id is the hardware address of TAPPER.
Payload
TAPPER uses JSON-formatted payloads.
Each Payload includes a timestamp.
Events
TAPPER has multiple events defined in the API.
| Topic | Payload |
|---|---|
tapper/$id/event/boot | {"timestamp": float} |
tapper/$id/event/tamper | {"timestamp": float, "state": "active" | "inactive"} |
tapper/$id/event/tag | {"timestamp": float, "id": str} |
TAPPER sends the NFC tag UID as a big-endian hex string.
Interfaces
TAPPER has an RGB LED and a Buzzer for interaction with the user.
These can be activated using a request sent through MQTT following this specification.
Request
The request topic is tapper/$id/control/request.
Request payload:
{
"timestamp": 1747951200,
"id": 1,
"output": {
"command": "activate"|"deactivate"|"pulse",
"duration": int
},
"visual": {
"state": "off" | "on/red" | "on/green" | "on/blue" | "on/yellow",
"pattern": "p1/red" | "p2/red" | "p3/red" | "p4/red" |
"p1/green" | "p2/green" | "p3/green" | "p4/green" |
"p1/blue" | "p2/blue" | "p3/blue" | "p4/blue" |
"p1/yellow" | "p2/yellow" | "p3/yellow" | "p4/yellow"
},
"acoustic": {
"pattern": "p1" | "p2" | "p3" | "p4"
}
}
Timestamp
This is the unix timestamp of the request, expected as a float/integer.
ID
This is the ID of the request, an integer is expected.
Output
This section is for the relay output.
- Command can be:
activate,deactivate, orpulse- The
pulsecommand requires thedurationelement to be set as well (in seconds), an integer is expected.
- The
"output": {
"command": "activate"|"deactivate"|"pulse",
"duration": int
}
Relay is coming in hardware r2.
Visual
This section is for the on-board LED.
It can either have a state" or a "pattern element.
-
State can have the following values:
off, oron/with the colorred/green/blue/yellowfollowing.
Example:on/red"visual": {
"state": "off" | "on/red" | "on/green" | "on/blue" | "on/yellow",
} -
The
patternis very similar, with the optionsp1/,p2/,p3/, orp4/with the colorred/green/blue/yellowfollowing.
Example:p4/bluePattern Description p1one long blink p2two long blinks p3three long blinks p4four long blinks "visual": {
"pattern": "p1/red" | "p2/red" | "p3/red" | "p4/red" |
"p1/green" | "p2/green" | "p3/green" | "p4/green" |
"p1/blue" | "p2/blue" | "p3/blue" | "p4/blue" |
"p1/yellow" | "p2/yellow" | "p3/yellow" | "p4/yellow"
}