Skip to content
Stand with Ukraine flag

Data Model

ThingsBoard maps LwM2M object resources to its own Attributes and Time-Series Data via the device profile. No code is required on the device side — the mapping is fully configured in ThingsBoard.

See Getting Started for device profile setup and connection details.

Check the Attribute box for an LwM2M resource in the device profile to store its value as a ThingsBoard attribute. ThingsBoard reads the value during device registration and on each Registration Update.

Example: Resource /3/0/2 (Device Serial Number) → ThingsBoard attribute serialNumber.

Optionally check Observe alongside Attribute to subscribe to real-time changes. The attribute value is then updated whenever the resource changes on the device.

Check the Telemetry box for a resource to store its values as time-series data. Typically combined with Observe so ThingsBoard receives push notifications on value change.

Example: Resources /3/0/9 (Battery Level), /6/0/0 (Latitude), /6/0/1 (Longitude) → telemetry keys batteryLevel, lat, lon.

To push configuration updates to a device, map an LwM2M resource as an Attribute and enable Observe. When the corresponding ThingsBoard shared attribute is changed (via the UI, REST API, dashboard widget, or Rule Engine), ThingsBoard automatically sends a Write operation to the device.

Example: Change the timezone shared attribute in ThingsBoard → ThingsBoard sends WriteUpdate to /3/0/15 (Timezone resource).

The Observe strategy controls how ThingsBoard groups observation requests sent to the device. Configure it in the LwM2M Model section of the device profile’s Transport configuration tab.

StrategyDescriptionTrade-off
Single (default)Each resource is observed individuallyBest accuracy · Higher traffic
Composite AllAll resources observed in one Composite Observe requestLowest traffic · Less granular
Composite by ObjectResources grouped per object typeBalanced

Changes to the observe strategy take effect immediately if the LwM2M session is active, or on the next Registration Update if not.

Notification Attributes (NOTIFICATION class)

Section titled “Notification Attributes (NOTIFICATION class)”

Notification attributes fine-tune when the device sends observation notifications. Set them via the WriteAttributes RPC command or in the device profile.

AttributeDescription
pminMinimum period (seconds) — minimum time between two notifications
pmaxMaximum period (seconds) — device must notify at least this often, even if the value has not changed. 0 means disabled.
gtGreater Than — notify when the resource value rises above this threshold
ltLess Than — notify when the resource value falls below this threshold
stStep — notify when the resource value changes by at least this amount

Example — set pmin and pmax on resource /19/0/0:

{
"method": "WriteAttributes",
"params": {"id": "/19/0/0", "attributes": {"pmin": 10, "pmax": 120}}
}

RPC commands and attribute references can use either the full resource path or a user-defined key:

FormatExample
Resource ID/3/0/9
Resource ID + version/3_1.2/0/9
Key (custom name)batteryLevel

To use a key, assign it to the resource in the device profile (Transport configuration → LwM2M Model → Attributes → key name).