Routed Data Message and data‑processing events

How it works

Data event detection is useful for monitoring business data collected by Live Objects to trigger alerts when needed.

Interactive
Figure 1. Routed Data Message flow

The routed Data Message is a JSON object. Please find below a description of its fields.

Field Description

type

dataMessage. This field is set by Live Objects in the routed Data message. In the store/search section, this field is not set.

version

Version number. See the existing versions in the summary. In the store/search section, this field is not set.

streamId

String identifying a timeseries /stream. Enriched by default if not set. Should not contain following characters: ' " \ ; { } ( ) and ' ' (space).

timestamp

Timestamp associated with the collected information. Generally set by the device, enriched by default if not set. Should follow ISO-8601 date time format.

created

Timestamp reflecting the date on which the data was collected by Live Objects.

location

Geo location (lat, lon, alt, accuracy, provider) associated with the collected info.

model

String used to indicate which schema is used for the value part of the message, more about model field. Can be empty, but can not contains ' ' (space) or '.' (dot) character.

value

Structured representation (JSON object) of the transported info. This field is usually filled with the useful payload (device measurements). Be a JSON object (not a primitive like number or string). Do not contains field name with '.' (dot) character. Size in bytes can not exceed 1 MiB (1024*1024 bytes).

tags

List of strings associated with the message. Used for extra-information.

extra

Enriched by Live Objects and can contains device inventory information like device’s properties.

metadata

Section enriched by Live Objects.

* source: unique identifier of the device, usually the URN (urn:lo:nsid:<namespace>:<id>) * group: group to which the device belongs, defined by its id and its path * connector: lora, mqtt, …​ * network: information from the network, depends on the connector

Standard Data message (MQTT example)

Data Message example : Original message sent by device or published by business application through MQTT interface

payload sent by device :

{
      "revmin":9992,
      "CO2":683,
      "doorOpen":false,
      "hygrometry":45,
      "temperature":139,
      "pressure":1367
}

stored data :

{
   "type":"dataMessage", <=== Message type
   "version":1,          <=== Message version
   "metadata":{
      "connector":"mqtt",
      "source":"urn:lo:nsid:mqtt:12345",
      "transformation": {
        "published": {
            "location": {
            "provider": "GPS",
            "lon": 2.30886,
            "lat": 48.81839
            }
        }
      },
      "group":{
         "path":"/",
         "id":"root"
      },
      "network":{
         "mqtt":{
            "clientId":"<my_mqtt_client_id>"
         }
      }
   },
   "streamId":"urn:lo:nsid:mqtt:12345",
   "created":"2019-09-26T08:03:09.394Z",
   "extra":{
      "propertyDevice1":"12:1b:2e"
   },
   "location":{
      "provider":"GPS",
      "alt":null,
      "accuracy":null,
      "lon":2.30886,
      "lat":48.81839
   },
   "model":"demoDevGuide",
   "id":"5d382598a1a7e8315ce82499",
   "value":{
      "revmin":9992,
      "CO2":683,
      "doorOpen":false,
      "hygrometry":45,
      "temperature":139,
      "pressure":1367
   },
   "timestamp":"2019-09-26T08:03:09.390Z",
   "tags":[
      "tag1",
      "tag2"
   ]
}

MatchingFired event

The Data Message flow goes through the Simple Event Processing service. This service can apply custom binary logics (written in jsonLogic syntax) on each message to detect specific events. These events will be sent as Live Objects MatchingFired event according to firing policies.

  • type field: matchingFired

  • version field: see summary for the available versions

  • This event can be consumed by a business application using Triggers and Actions feature. In this case, the event contains a type and a version. See first example below

  • Also, this event is stored in Live Objects database (if your commercial offer allows storage). In this case, the event is encapsulated in a Data message format. See second example below

  • More details about the feature, see Simple Event Processing section

MatchingFired event example - case: event retrieved by a business application (FIFO, httpPush)
{
   "type":"matchingFired",
   "version":1,
   "tenantId":"12345",
   "timestamp":"2019-09-05T08:51:06.691Z",
   "firingRule":{
      "id":"18d55812-22ae-4ff7-a632-6c4451069c26",
      "name":"firingTestDevGuide"
   },
   "matchingContext":{
      "tenantId":"12345",
      "timestamp":"2019-09-05T08:51:06.624Z",
      "matchingRule":{
         "id":"298502e0-4dc3-489b-ac21-08c98ad066d3",
         "name":"testEventProcessingDevGuide"
      },
      "data":{
         "type":"dataMessage",
         "version":1,
         "streamId":"urn:lo:nsid:mqtt:1234",
         "timestamp":"2019-09-05T08:51:06.583Z",
         "value":{
            "temp":100,
            "pressure":36575
         },
         "tags":[
         ],
         "extra":{
         },
         "metadata":{
            "source":"urn:lo:nsid:mqtt:1234",
            "group":{
               "id":"CdoJOs",
               "path":"/europe"
            },
            "connector":"mqtt",
            "network":{
               "mqtt":{
                  "clientId":"1234"
               }
            }
         }
      }
   }
}
MatchingFired event example - case: event encapsulated in a data message format and stored in Live Objects
{
   "metadata": null,
   "streamId": "event:urn:lo:nsid:mqtt:1234",
   "created": "2019-09-05T08:51:06.703Z",
   "extra": null,
   "location": null,
   "model": "event",
   "id": "5d70cc7aa1a7e85c6b9b587d",
   "value": {
      "matchingContext": {
         "matchingRule": {
            "dataPredicate": "{\">\":[{\"var\":\"value.temp\"},99]}",
            "name": "testEventProcessingDevGuide",
            "id": "298502e0-4dc3-489b-ac21-08c98ad066d3",
            "enabled": true
         },
         "data": {
            "metadata": {
               "connector": "mqtt",
               "source": "urn:lo:nsid:mqtt:1234",
               "group": {
                  "path": "/europe",
                  "id": "CdoJOs"
               },
               "network": {
                  "mqtt": {
                     "clientId": "1234"
                  }
               }
            },
            "streamId": "urn:lo:nsid:mqtt:1234",
            "extra": {},
            "value": {
               "temp": 100,
               "pressure": 36575
            },
            "timestamp": "2019-09-05T08:51:06.583Z",
            "tags": []
         },
         "tenantId": "12345",
         "timestamp": "2019-09-05T08:51:06.624Z"
      },
      "tenantId": "12345",
      "timestamp": "2019-09-05T08:51:06.691Z",
      "firingRule": {
         "name": "firingTestDevGuide",
         "matchingRuleIds": [
            "298502e0-4dc3-489b-ac21-08c98ad066d3"
         ],
         "id": "18d55812-22ae-4ff7-a632-6c4451069c26",
         "aggregationKeys": [
            "streamId"
         ],
         "firingType": "ALWAYS",
         "enabled": true
      }
   },
   "timestamp": "2019-09-05T08:51:06.691Z",
   "tags": [
      "event"
   ]
}

StateChange Event

The Data message flow goes through the StateChange Processing service. This service can detect changes in devices' states, for example geozone location changes. These events will be sent as Live Objects State Change event.

  • type field: stateChange

  • version field: see summary for the available versions

  • This event can be consumed by a business application using Triggers and Actions feature. In this case, the event contains a type and a version. See first example below

  • Also, this event is stored in Live Objects database (if your commercial offer allows storage). In this case, the event is encapsulated in a Data message format. See second example below

  • More details about the feature, see State Processing section

StateChange event example - case: event retrieved by a business application (FIFO, httpPush)
{
   "type":"stateChange",
   "version":1,
   "tenantId":"12345",
   "stateKey":"urn:lo:nsid:mqtt:1234",
   "previousState":"normal",
   "newState":"hot",
   "timestamp":"2019-09-05T08:51:06.616Z",
   "stateProcessingRuleId":"fa1ff947-7855-4249-a5fe-f5bafe53efe2",
   "stateProcessingRule":{
      "id":"fa1ff947-7855-4249-a5fe-f5bafe53efe2",
      "name":"temperature state rule"
   },
   "data":{
      "type":"dataMessage",
      "version":1,
      "streamId":"urn:lo:nsid:mqtt:1234",
      "timestamp":"2019-09-05T08:51:06.583Z",
      "value":{
         "temp":100,
         "pressure":36575
      },
      "tags":[

      ],
      "extra":{

      },
      "metadata":{
         "source":"urn:lo:nsid:mqtt:1234",
         "group":{
            "id":"CdoJOs",
            "path":"/europe"
         },
         "connector":"mqtt",
         "network":{
            "mqtt":{
               "clientId":"1234"
            }
         }
      }
   }
}
StateChange event example - case: event encapsulated in a data message format and stored in Live Objects
{
   "metadata": null,
   "streamId": "event:urn:lo:nsid:mqtt:1234",
   "created": "2019-09-05T08:51:06.621Z",
   "extra": null,
   "location": null,
   "model": "event",
   "id": "5d70cc7a5705d87bd1b66a8a",
   "value": {
      "stateProcessingRuleId": "fa1ff947-7855-4249-a5fe-f5bafe53efe2",
      "data": {
         "metadata": {
            "connector": "mqtt",
            "source": "urn:lo:nsid:mqtt:1234",
            "group": {
               "path": "/europe",
               "id": "CdoJOs"
            },
            "network": {
               "mqtt": {
                  "clientId": "1234"
               }
            }
         },
         "streamId": "urn:lo:nsid:mqtt:1234",
         "extra": {},
         "value": {
            "temp": 100,
            "pressure": 36575
         },
         "timestamp": "2019-09-05T08:51:06.583Z",
         "tags": []
      },
      "tenantId": "12345",
      "newState": "hot",
      "stateKey": "urn:lo:nsid:mqtt:1234",
      "previousState": "normal",
      "timestamp": "2019-09-05T08:51:06.616Z",
      "stateProcessingRule": {
         "stateKeyPath": "streamId",
         "name": "temperature state rule",
         "stateFunction": "{\"if\":[{\"<\":[{\"var\":\"value.temp\"},0]},\"cold\",{\"<\":[{\"var\":\"value.temp\"},100]},\"normal\",\"hot\"]}",
         "id": "fa1ff947-7855-4249-a5fe-f5bafe53efe2",
         "enabled": true,
         "filterPredicate": "null"
      }
   },
   "timestamp": "2019-09-05T08:51:06.616Z",
   "tags": [
      "event"
   ]
}

DeviceActivity event

The Activity processing feature aims to monitor device inactivity. When a device is "SILENT" or goes "ACTIVE" again, an event is generated. These events can be listened with a business application using FIFO or httpPush. In the web portal, these events are displayed as "notifications".

  • type field: deviceActivity

  • version field: see summary for the available versions

  • This event can be consumed by a business application using Triggers and Actions feature. In this case, the event contains a type and a version. See first example below

  • Also, this event is stored in Live Objects database (if your commercial offer allows storage). In this case, the event is encapsulated in a Data message format. See second example below

  • More details about the feature, see Activity Processing section

DeviceActivity event example - case: event retrieved by a business application (FIFO, httpPush)
{
	"type": "deviceActivity",
	"version": 1,
	"deviceId": "urn:lo:nsid:mqtt:1234",
	"deviceAdditionalInfo": {
		"deviceName": "sensor #12",
		"groupPath": "/europe"
	},
	"activityRule": {
		"id": "683bb813-495f-423a-87f6-d87656c8b02c",
		"name": "test 10 min"
	},
	"state": "SILENT",
	"previousState": "UNKNOWN",
	"timestamp": "2020-06-09T07:47:00.004Z",
	"numberOfAlarmReminders": 0
}
DeviceActivity event example - case: event encapsulated in a data message format and stored in Live Objects
{
   "metadata":null,
   "streamId":"event:urn:lo:nsid:mqtt:1234",
   "created":"2019-09-05T09:35:00.019Z",
   "extra":null,
   "location":null,
   "model":"event:DeviceActivity",
   "id":"5d70d6c4a1a7e85c6b9b58ab",
   "value":{
      "deviceAdditionalInfo":{
         "deviceName":"Auto-created device (mqtt / 1234)",
         "groupPath":"/europe"
      },
      "numberOfAlarmReminders":0,
      "state":"SILENT",
      "deviceId":"urn:lo:nsid:mqtt:1234",
      "activityRule":{
         "name":"test 10 min",
         "id":"683bb813-495f-423a-87f6-d87656c8b02c",
         "silentPolicy":{
            "duration":"PT10M",
            "repeatInterval":"PT10M"
         },
         "targets":{
            "deviceIds":[
               "urn:lo:nsid:mqtt:1234"
            ],
            "groupPaths":[
            ]
         },
         "enabled":true
      },
      "timestamp":"2020-06-09T07:47:00.004Z"
   },
   "timestamp":"2020-06-09T07:47:00.004Z",
   "tags":[
      "event"
   ]
}