Devices
A beacon (a player's position from a GPS box on the vest) or a prop (a capture box, a mine, a target) gets its own key when it is paired. A person's password, session or API key never goes into hardware, and a device key can be revoked on its own.
| Kind | Its key | What it does |
|---|---|---|
beacon |
gt_play_ |
Reports as the player who carries it, in the game it is assigned to. Your own beacon needs no assigning: its first post binds it to the live game you play (with several, the one you were last heard in), and it moves with you when you play another; a club beacon still needs a loan. It reports position, status and SOS through the Player view calls. It never reads the side's picture, places marks or acknowledges orders (device_key_scope): whoever holds a beacon's key, such as the club that owns it, cannot see the player's map or speak for them beyond the beacon's own reports. Its positions outrank the player's phone: for 30 s after a beacon position, the phone's positions are not used (its status and SOS still are). The player's entity then carries src: "beacon" in the team and dashboard views, and the GridTac app stops reading GPS while it does. |
prop |
gt_prop_ |
An object in the game, speaking GT-Link (the device protocol, published separately). |
gateway |
gt_gw_ |
BETA, for LoRa from 1.8. A radio on the field that forwards the encrypted frames of LoRa beacons and props to GridTac. It holds none of their keys, cannot read or change what they send, and never acts in a game itself. See A gateway online. |
A device is owned by a player or by a club. A club beacon is lent to a member for one game, only once the member accepts that loan, and comes back to the club by itself when that game ends. Every pairing, loan, answer and return is logged.
Pairing a device that has a screen and internet
The device shows a code, and you type it into GridTac: the same way you connect a TV to a streaming service (OAuth device authorization, RFC 8628).
1. The device asks for a code (no key yet):
POST /api/v1/devices/announce
Content-Type: application/json
{ "kind": "beacon", "model": "acme.beacon", "fw": "1.0.0" }
{ "userCode": "KX7M-Q2RP", "deviceCode": "…secret…", "expiresIn": 600, "interval": 5 }
Show userCode on the display. Keep deviceCode in memory: it is the device's secret.
2. The owner types the code, signed in on gridtac.com or in the app (or POST /api/v1/devices/approve with { userCode, label, clubId? }). clubId registers it as the club's;
only a manager of the club may do that.
3. The device polls every interval seconds:
POST /api/v1/devices/token
Content-Type: application/json
{ "deviceCode": "…secret…" }
202 { "status": "pending" } until the owner has typed the code, then once:
{ "deviceId": "dev_k7q2m9x4h3pd", "key": "gt_play_…" }
Store both in flash. After that answer the pairing is gone, and only one poll ever gets the key: a
second poll racing it gets pairing_not_found. A code is valid for 10 minutes (pairing_expired
after that); once the owner has typed it, the device has 10 more minutes to collect its key.
Pairing through the phone
A box that only speaks LoRa has no internet, and a device without a screen cannot show a code. Then
the GridTac app pairs it over Bluetooth: you prove you stand next to it (the code on its screen,
or hold its button for three seconds and check that it blinks the same colours as the app shows),
and the app registers it for you (POST /api/v1/devices) and writes its id back over Bluetooth. A
LoRa prop or beacon hands its own radio key over once (to the app, or over USB from the web
installer); GridTac stores it encrypted and never gives it out again. The answer's radioAddr is the
device's 4-byte radio address, which it writes into the header of every frame it sends
(Radio frame and gateways). A gateway never gets a radio key.
A prop online
A prop speaks GT-Link, GridTac's device protocol (overview, every field in the message reference, a walkthrough in Build a prop). With its own key it connects to the broker:
POST /api/v1/prop/mqtt-credentials
Authorization: Bearer gt_prop_…
The answer has an MQTT username and password (a JWT) that let it publish only under
gridtac/dev/<its id>/ (hello, evt, state, tele, ack, lwt) and subscribe only to its own
cmd and game topics. Fetch new credentials before expiresAt.
- Events are deduplicated on the device's boot counter and sequence number, so sending one again, or over both MQTT and HTTPS, never counts twice.
- The device has no trusted clock. It sends milliseconds since boot; GridTac dates each event from the freshest message it has had from that boot. An event queued while offline is back-dated by at most 15 minutes; an older one waits for the game master.
game(retained) tells the prop the phase, kickoff, end and server time, and is refreshed on every change.cmdcarries configuration, outputs, identify, disable and update notices; the prop answers each onack.- The game master can switch every prop of a game off at once. The props get a
disablecommand and their events are ignored until it is lifted. - The key decides over MQTT too. A prop whose key is revoked, paused or blocked is ignored on every message, within a few seconds, even on a connection opened before. Over MQTT each input event counts against the key: 120 a minute, and a key that keeps going past that is paused and blocked exactly as over HTTPS (rate limits).
- Revoking a device's key unpairs the device: it leaves its game and shows as revoked. Pair it again for a new key.
A gateway online
BETA, for LoRa from 1.8. A gateway pairs like any device ("kind": "gateway" in the announce,
or through the app) and gets a gt_gw_ key. With it, it fetches its broker credentials:
POST /api/v1/gw/mqtt-credentials
Authorization: Bearer gt_gw_…
The answer is the same shape as a prop's. The token lets the gateway publish only
gridtac/gw/<its id>/up, tele and lwt, and subscribe only to gridtac/gw/<its id>/down;
<its id> is its dev_ id. It can publish nothing under another device's topics. What goes on those
topics is in Radio frame and gateways.
A prop that cannot keep an MQTT connection posts the same messages over HTTPS:
POST /api/v1/prop/events
Authorization: Bearer gt_prop_…
Content-Type: application/json
{ "tele": { "b": 7, "s": 40, "ms": 912000, "bat": { "pct": 81 } },
"evts": [{ "b": 7, "s": 41, "ms": 905300, "c": "red", "e": "hold", "x": 3000 }] }
Send state or tele with every batch: its ms is what dates the queued events. The answer carries
accepted, the commands waiting for the prop, and the game clock.
Using a device in a game
| Call | What it does |
|---|---|
GET /api/v1/devices |
Your devices and those of every club you manage, never their keys. Each has online (a prop connected over MQTT right now; false for a beacon, which only posts), battery (percent from its latest tele, or for a beacon from the battery on its latest position; null when none) and lastSeenAt. loans lists the beacons someone else lends to you; assignment.accepted: false means one waits for your answer. |
POST /api/v1/devices/{id}/assign { gameId, playerId? } |
A beacon: your own for yourself (only needed to pick a game yourself: it otherwise follows you), or your club's lent to a member who plays in that game. POST /api/v1/devices/{id}/return takes a beacon out of its game, and it does not follow you back into that game while it is live. A loan waits for the member to accept it in their own app (assignment.accepted: false); the beacon's key does nothing until then, and the member is told by a push notification. A prop: into a game you run as game master. |
POST /api/v1/devices/{id}/accept |
The member accepts a beacon lent to them; only they can, on their own session. |
POST /api/v1/devices/{id}/decline |
The member declines it; the loan ends. |
POST /api/v1/devices/{id}/return |
Take it back (the owner, a club manager, or the player who has it: that is how a member withdraws a loan they accepted; for a prop, also the game master of the game it plays in). Its key stops acting in the game at once. |
DELETE /api/v1/devices/{id} |
Unpair: the key stops and the device leaves any game. |
These calls use your normal signed-in session. Pairing your own device or your club's needs no two-factor sign-in, because a device key does far less than a script's: a beacon's sends only position, status and SOS for the player who carries it (never reads their map), a prop's only its own events in a game its game master put it in. You can unpair any time. Plain API keys for your own scripts still need two-factor (Authentication).
Limits: at most 10 new devices an hour per account (too_many_devices); 20 devices per account
and 200 per club (device_limit, unpair one first); one beacon per player in a game
(beacon_limit); at most 100 props in one game (game_device_limit). SOS from a player's keys and
beacons together: 6 a minute; the phone's own SOS button is apart and always works.