Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
22.5k Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

OTA Updates

LwM2M supports over-the-air (OTA) firmware and software updates using standardized objects. Before proceeding, read the OTA Updates guide to understand how to upload and manage packages in ThingsBoard.

LwM2M Object 5 (Firmware Update) handles firmware delivery and installation.

Configure these resource observations in the device profile to track update progress:

Resource Key Description
/3/0/3 firmwareVersion Current firmware version
/5/0/3 state Firmware update state
/5/0/5 updateResult Result of the last update attempt
/5/0/7 pkgVersion Target firmware package version

Select the strategy in Device profile → Transport configuration → Other settings:

Strategy How it works
Push via Object 5 / Resource 0 (Package) ThingsBoard pushes the binary directly to the device via block-wise CoAP transfer
Pull via Object 5 / Resource 1 (Package URI) ThingsBoard generates a CoAP URL; the device downloads the firmware from that URL
Push via Object 19 / Resource 0 (Data) Alternative binary push using Object 19

After the package is delivered, trigger installation using the Execute RPC:

{"method": "Execute", "params": {"id": "/5/0/2"}}

LwM2M Object 9 (Software Management) handles software delivery, installation, and activation as two separate phases.

Resource Key Description
/3/0/19 softwareVersion Current software version
/9/0/0 pkgName Software package name
/9/0/1 pkgVersion Software package version
/9/0/7 updateState Software update state
/9/0/9 updateResult Result of the last software update
Step State Result Description
1 INITIAL (0) INITIAL (0) Before any download
2 DOWNLOAD_STARTED (1) DOWNLOADING (1) Download in progress
3 DOWNLOADED (2) DOWNLOADING (1) Package downloaded and verified
4 DELIVERED (3) SUCCESSFULLY_DOWNLOADED_VERIFIED (3) Ready to install
5 INSTALLED (4) SOFTWARE_SUCCESSFULLY_INSTALLED (2) Installation complete
6 INITIAL (0) INITIAL (0) Returned to initial after uninstall
Strategy How it works
Push via Object 9 / Resource 2 (Package) Binary pushed directly to the device
Pull via Object 9 / Resource 3 (Package URI) ThingsBoard generates a CoAP URL; device downloads the software package

ThingsBoard optionally uses Object 19 to deliver OTA metadata before the actual package transfer. Enable it in Device profile → Transport configuration → Other settings → Use Object 19 for OTA file metadata.

When enabled:

  • ThingsBoard checks whether Object 19 is supported at device registration.
  • Creates an Object 19 instance (InstanceId 65534 for firmware, 65535 for software).
  • Writes a Base64-encoded JSON metadata payload to that instance.

Metadata structure:

{
"Checksum": "SHA256 hash of the file",
"Title": "OTA package name",
"Version": "Target version string",
"File Name": "Filename for device storage",
"File Size": "Size in bytes"
}

The ThingsBoard LwM2M Demo Client simulates Object 5, Object 9, and Object 19 for OTA testing.

  1. Clone and build:

    Terminal window
    git clone https://github.com/thingsboard/thingsboard.lwm2m.demo.client
    mvn clean install
  2. Run with OTA support enabled (-tota flag):

    Terminal window
    java -jar thingsboard-lwm2m-demo-client-{version}.jar -u coap://lwm2m.thingsboard.cloud:5685 -n MyClientNoSec -tota

The demo client logs all state transitions — use it to validate the firmware update strategy and Object 19 metadata delivery configured in the device profile.