Observations

Observation definition

An Observation allows Live Objects to be notified when some Attributes change on the device. It can target:

  • a specific Attribute

  • an Object Instance

  • all Object Instances of an Object

  • several Attributes (Observation Composite)

Example of an Observation targeting an Object Instance:

{
    "id": "631f1190d4135d0066541e8b",
    "paths": [
        "/6/0"
    ],
    "status": "PENDING",
    "name": "Observation on the location Object",
    "created": "2022-09-12T11:02:29.811Z"
}
Field Example Comment

id

631f1190d4135d0066541e8b

Observation unique id, generated by Live Objects

paths

['/6/0']

Target paths of related device objects or attributes to observe

status

PENDING

Current status of the Observation among PENDING, OBSERVING and FAILED

name

Observation on the location Object

User-defined name for the Observation

created

2022-09-12T11:02:29.811Z

Observation creation date

Observation Lifecycle

An Observation is created using the API and its status will be available via the API too.
Once created, the Observation is sent immediately if the device is ONLINE or the next time the device sends an Update or Register otherwise.
Depending on the type of error, Observations that have failed can be automatically re-sent at the next Update. The number of attempts is nevertheless limited.
When a LwM2M device goes offline (de-registration or the lifetime of the registration expires), the Observations on Live Objects for this device go back to the PENDING state. They will be automatically re-sent when the device sends a Register, regardless of their status.
An Observation can be cancelled. Upon the user cancellation request, a Cancel Observation operation is sent to the device if it is ONLINE. Otherwise, the cancellation occurs at the next Notify.

LiveObjectsDeviceCUSTOMERLiveObjectsDeviceCUSTOMERLiveObjectsDeviceLiveObjectsDeviceCreate a new ObservationPOST/api/v1/deviceMgt/devices/{deviceId}/twin/observationsValidate and store the Observation<Observation created>The observation is in statusPENDINGalt[the device is ONLINE]send the Observation[the device is SLEEPING]lwm2m: updatesend the Observation[the device is OFFLINE]lwm2m: registersend the Observationalt[the Observation succeeds]response successthe Observation is activeGET/api/v1/deviceMgt/devices/{deviceId}/twin/observations/{observationId}<observation>The observation is in statusOBSERVINGnotifystore the new values[the Observation fails]response errorGET/api/v1/deviceMgt/devices/{deviceId}/twin/observations/{observationId}<observation>The observation is in statusPENDINGopt[the error can be recovered]lwm2m: updatesend the Observationopt[the maximum number of attempts has been reached]GET/api/v1/deviceMgt/devices/{deviceId}/twin/observations/{observationId}<observation>The observation is in statusFAILEDOn new Registerlwm2m: registersend all ObservationsCancellationDELETE/api/v1/deviceMgt/devices/{deviceId}/twin/observations/{observationId}OKalt[the device is ONLINE]cancel the ObservationOKnotifycancel the Observation
Figure 1. Observation sequence diagram
Twin Observations StatusPENDINGThe observation is not active yetOBSERVINGThe observation is activeFAILEDuser creation (north API)Observation successDe-registrationor Registration expirationor new RegistrationObservation failuremaximum number ofattempts reachedDe-registrationor Registration expirationor new Registrationuser cancellationuser cancellationuser cancellation
Figure 2. Observation state machine
status Comment

PENDING

The Observation has been created and is ready to be sent.

FAILED

The Observation has not succeeded after the maximum number of attempts.

OBSERVING

The Observation is active on the device.

Observation retry policy

For errors that are considered as unrecoverable, there will be only one attempt to send an Observation. The following errors fall in this category:

  • The device responded with a 4xx code

  • The device rejected the request

For other errors there will be 5 attempts. For instance, we can mention a 5xx response or a time-out.

Observation configuration

The parameters related to an Observation can be configured by the Write-Metadata operation.

Observation limits

The number of Observations per device is limited regardless of their status.