Triggers data structure
Each trigger contains a JSON data structure with several fields. The meaning of each field is explained below. The trigger data structure will differ a bit from event to event.
Field definitions
id
: string
The id of the registered event.
payload.tag.id
: string
The ID of the tag that triggered the event. The tag ID can be set through the Pozyx Device Configurator (https://docs.pozyx.io/enterprise/Configuring-the-tags.1224015986.html#Configuringthetags-General), and can also be found in the web application.
payload.tag.coordinates.x
: number
The x-coordinate of the tag, expressed in mm.
payload.tag.coordinates.y
: number
The y-coordinate of the tag, expressed in mm.
payload.tag.coordinates.z
: number
The z-coordinate of the tag, expressed in mm.
payload.tag.labels.text
: string
The label of the tag.
payload.tag.labels.color
: string
The color of the label of the tag expressed in hex color code
payload.zone.id
: string
The identifier of the zone on which the trigger is configured
payload.zone.name
: string
The name of the zone on which the trigger is configured. The zone name can be set through the web application
payload.type
: string
The type of event that occurred.
payload.timstamp
: number
The timestamp of when the position was calculated in Epoch time. You can convert it to a more human readable time with the following snippet:
import datetime
ts = datetime.datetime.fromtimestamp(1616424015.121358).strftime('%Y-%m-%d %H:%M:%S')
print(ts)
Example enter or exit event
{
"id": "61a9e8f3b97ef08b72520dd7_enter",
"version":"1.1.0",
"payload": {
"tag": {
"id": "7241",
"coordinates": {
"x": 9932,
"y": -19651,
"z": 5000
},
"labels":[
{
"text":"label",
"color":"#000000"
}
]
},
"zone": {
"id": "61a9e8f3b97ef08b72520dd7",
"name": "PRODUCTION ZONE"
},
"type": "enter",
"timestamp": 1639047352.966
}
}
Example increase or decrease event
{
"id":"8835ce32-69fa-46e0-8b76-f6426f86d440",
"version":"1.0.0",
"payload":{
"zone":{
"id":"61a9e8f3b97ef08b72520dd7",
"name":"PRODUCTION ZONE"
},
"type":"threshold_increase",
"threshold":3,
"timestamp":1649836051.808
}
}