Skip to content
Stand with Ukraine flag

LwM2M API

ThingsBoard Edge supports the OMA LwM2M 1.0 and 1.1 specifications. Edge acts as the LwM2M server — devices register with Edge over the local network, and Edge relays telemetry and alarms to the ThingsBoard server over gRPC.

Default ports:

RolePlainSecured
LwM2M server5685 UDP (NoSec)5686 UDP (DTLS)
LwM2M bootstrap server5687 UDP (NoSec)5688 UDP (DTLS)

LwM2M devices require a device profile configured with:

  • Transport type: LwM2M
  • LwM2M server URI: pointing to the Edge node (e.g., coap://192.168.1.10:5685)
  • Security mode: NoSec, PSK, RPK, or X.509

To configure a LwM2M device profile: go to Profiles → Device profiles → Add device profile, select LwM2M as the transport type.

LwM2M supports four security modes. Configure the matching credentials on both the device and the device profile in Edge:

ModeDescription
NoSecNo security — for development and trusted networks only
PSKPre-shared key — identity and key defined per device
RPKRaw public key — asymmetric, no certificate authority required
X.509Certificate-based — requires a CA chain

To set credentials: go to Entities → Devices, open the device, click Manage credentials, select the LwM2M security mode.

LwM2M resources are mapped to ThingsBoard attributes and telemetry in the device profile. Each object/resource ID maps to a ThingsBoard key.

For example, Object 3306 (Presence), Resource 5500 maps to a boolean telemetry key digital_input_state.

Edge stores and processes these values locally and syncs them to the server when the gRPC connection is available.

Edge supports OTA firmware and software updates for LwM2M devices using:

  • Object 5 (/5) — Firmware Update
  • Object 9 (/9) — Software Management

Assign an OTA package to the device via Entities → Devices → OTA updates on the Edge node. Edge pushes the firmware to the device using the LwM2M PUSH or PULL delivery method defined in the device profile.

Send commands to LwM2M devices via the ThingsBoard RPC API. Supported operations:

RPC methodLwM2M operation
ReadRead object or resource value
WriteWrite a resource value
ExecuteExecute a resource (e.g., reboot)
ObserveStart observing a resource
Cancel ObserveStop observing a resource
DiscoverList available resources on the device