Device events
Device events are reported when an event occurs on the device. The device manager reports this event as a message that will be collected by the routing service, which forwards it to the consumer. Business applications can use the listening channels (HTTP REST, MQTT client and Webhook) in order to have them.
Device created event
The deviceCreated events are generated by the Live Objects device manager when a device is provisioned.
These events are notifications and are not aimed at giving full provisioning details about the device. To retrieve the details about the device, you should use the Device Management Inventory REST API.
The deviceCreated notification is useful, for example, when devices are auto-provisioned in Live Objects (see MQTT devices and external connector mode).
The consumption of this event used with the Device Management REST API allow you to update your own business application database for example.
|
If you are not familiar with the device representation and device management in Live Objects, see Device inventory section. |
The event is a JSON object. Please find below a description of its fields.
| Field | Description |
|---|---|
type |
deviceCreated. This field is set by Live Objects in the routed event. |
version |
Version number. See the existing versions in the summary. |
deviceId |
Device identifier. |
timestamp |
Timestamp for the routing event. |
{
"type":"deviceCreated",
"version":1,
"deviceId":"urn:lo:nsid:mqtt:1234",
"timestamp":"2019-09-05T09:50:00.394Z"
}
Device deleted event
The deviceDeleted events are generated by the Live Objects device manager when a device is deleted.
These events are notifications and are not aimed at giving full provisioning details about the device. To retrieve the details about the device, you should use the Device Management Inventory REST API.
The consumption of this event used with the Device Management REST API allow you to update your own business application database for example.
|
If you are not familiar with the device representation and device management in Live Objects, see Device inventory section. |
The event is a JSON object. Please find below a description of its fields.
| Field | Description |
|---|---|
type |
deviceDeleted. This field is set by Live Objects in the routed event. |
version |
Version number. See the existing versions in the summary. |
deviceId |
Device identifier. |
timestamp |
Timestamp for the routing event. |
{
"type":"deviceDeleted",
"version":1,
"deviceId":"urn:lo:nsid:mqtt:1234",
"timestamp":"2019-09-05T09:55:00.004Z"
}
Device status event
This event is generated by Live Objects when a device interface’s status is changing. Examples :
-
When a LwM2M device recently created connects to Live Objects for the first time, a device status event is generated with the previous status : REGISTERED and the current status : ONLINE
-
When a MQTT device is disconnected, a device status event is generated with the previous status : ONLINE and the current status : OFFLINE
-
When the first JOIN REQUEST is received from a recently created LoRa device, a device status event is generated with the previous status : REGISTERED and the current status : INITIALIZING
This event is internally used by the device manager to update its connectors database. Also, it’s possible to route this event using Triggers and Actions feature. By doing this, a business application can listen and process this event.
| Please refer to the Connectivity section for the description of device status state machines on each connectivity (LwM2M, MQTT, LoRa, …). And to the interface status section for a summary of the supported device status. |
The device status event is a JSON object. Please find below a description of its fields.
| Field | Description |
|---|---|
type |
deviceStatus. This field is set by Live Objects in the routed event. |
version |
Version number. See the existing versions in the summary. |
deviceId |
Device identifier. |
updatedInterface |
Information about the interface. In status sub-section, information about the status of the interface with the previous and current state. |
timestamp |
Timestamp for the routing event. |
{
"type":"deviceStatus",
"version":1,
"deviceId":"urn:lo:nsid:mqtt:1234",
"updatedInterface":{
"connector":"mqtt",
"nodeId":"1234",
"enabled":true,
"status":{
"current":"ONLINE",
"previous":"OFFLINE"
}
},
"timestamp":"2019-09-05T09:50:00.394Z"
}
| Please refer to a global overview of supported event occurred on the interfaces of each connector, see Interface section. |
Command status events
This event is generated by Live Objects platform when a device command status change occurs. For example, when a command is acknowledged by a MQTT device, a command status event is sent by the platform with the status PROCESSED.
The command status events are triggers than can be mapped to supported actions (HTTP push, fifo…)
The command status event is a JSON object. Please find below a description of its fields.
| Field | Description |
|---|---|
type |
commandStatus. The type is set by Live Objects platform. |
version |
Version number. See the existing versions in the summary. |
id |
The id of the command. |
targetDeviceId |
The deviceId related to the command event. |
status |
The command status. Refers to command status chapter. |
deliveryStatus |
The delivery command status. Refers to command status chapter. |
errorCode |
The error code. Refers to command object model chapter. |
request |
The request associated to the command |
request.connector |
The connector used for the command (mqtt, lora…) |
request.value |
The request JSON object |
response |
The device response associated to the command (depends on command status and ackMode used). |
response.value |
The response JSON object |
created |
Creation date of the command - string ISO 8601 format in UTC. |
updated |
Update date of the command (status change) - string ISO 8601 format in UTC. |
| Please refer to a global overview of supported command statuses of each connector, see Command status section. |
{
"type" : "commandStatus",
"version" : 1,
"id" : "5d9ef867be84e3147f9db0a3",
"targetDeviceId" : "urn:lo:nsid:mysensor:16503",
"status" : "PROCESSED",
"deliveryStatus" : "REPLIED",
"request" : {
"connector" : "mqtt",
"value" : {
"req" : "reboot",
"arg" : {
"delay" : 30000,
"bootMode" : "safe"
}
}
},
"response" : {
"value" : {
"done" : true
}
},
"created" : "2019-10-10T09:22:47.765Z",
"updated" : "2019-10-10T09:23:53.318Z"
}