duress_appAPI Behavior (MQTT)
The Duress Management duress_appexposes REST endpoints for device assignment, but all actual device communication happens via MQTT. Understanding the exact MQTT commands the duress_apppublishes allows the assistant to reproduce the same behaviour without direct duress_appaccess.
1. Simple Assign (POST /simple-assign)
Section titled “1. Simple Assign (POST /simple-assign)”Assigns a device to a user and provisions the home screen.
What the duress_appdoes (MQTT):
- Publishes three
fdldcommands sequentially to downloadallocdata.json,unallocdata.json, anddvs/duresshome.json.
// Command 1 – download allocdata.json{ "devwork": { "actions": [ { "a": "fdld", "p": { "file": "allocdata.json", "url": "https://api.infrafon.cloud/ife/rest/v1/file/<file_id>/download" } } ] }}// Command 2 – download unallocdata.json{ "devwork": { "actions": [ { "a": "fdld", "p": { "file": "unallocdata.json", "url": "https://api.infrafon.cloud/ife/rest/v1/file/<file_id>/download" } } ] }}// Command 3 – download duresshome DV{ "devwork": { "actions": [ { "a": "fdld", "p": { "file": "dvs/duresshome.json", "url": "https://api.infrafon.cloud/ife/rest/v1/file/<file_id>/download" } } ] }}- Sends a reboot after all downloads complete.
{ "devwork": { "actions": [{ "a": "reboot" }] } }The files contain:
allocdata.json– setsduresshomeas the home DV, includes the assigned user’s name inuser.visitorand in theduresshome.jsonDV.unallocdata.json– fallback configuration for the unallocated state.dvs/duresshome.json– the wearer’s home screen withuser_nameanduser_roleset to the assigned user.
2. Full Assignment (POST /device-assignments)
Section titled “2. Full Assignment (POST /device-assignments)”Same as simple assign, plus additional files (visite.json) and pre‑flight
checks (device connectivity, MQTT health, existing assignment).
3. Return / Deactivation (DELETE /device-assignments/<id>)
Section titled “3. Return / Deactivation (DELETE /device-assignments/<id>)”Deactivates the assignment and returns the device to an unallocated state.
MQTT command sent:
{ "devwork": { "actions": [{ "a": "return_local" }] } }This triggers the device to load unallocdata.json and return to the
unallocated home screen.
4. Update Assignment (PUT /device-assignments/<id>)
Section titled “4. Update Assignment (PUT /device-assignments/<id>)”Updates the database record only – no MQTT commands are sent.
To update the name on the device itself, a separate app.duress or
allocation update would be needed. However, for the notification name
(the subj field in duress alerts), the duress_appuses its own database
assigned_to field, not the device’s vname. So updating the portal
record is sufficient for future alerts.
How the assistant can use this
Section titled “How the assistant can use this”- When a user asks to assign a device, the assistant can mimic the
simple assign flow by sending the same
fdld+rebootcommands. - For debugging wrong notification names, the assistant can explain that
the portal’s
assigned_tofield (not the device’s own data) controls thesubj, and suggest updating it via the duress_appUI. - For returning a device, the assistant can send
return_localdirectly.
Related
Section titled “Related”- User Association – how the
portal’s
assigned_tobecomes the notification name - MQTT file operations –
fdld - Device actions –
reboot,return_local