Lightweight M2M (LwM2M) is a REST-based protocol from the Open Mobile Alliance (OMA) for M2M & IoT device management that defines the application layer communication protocol between an LwM2M server and an LwM2M client running on an IoT/embedded device.
While LwM2M v1.0 was published in early 2017, we first covered the new protocol a year earlier as Imagination Technologies released the source code for the LwM2M stack running on MIPS Creator Ci40 development board. Since then we’ve mostly seen the LwM2M protocol supported in cellular LTE IoT modules including Quectel BC66 and u-Blox Sara-R410M, as well as the now-defunct Samsung Artik WiFi IoT modules.
LwM2M v1.0 was followed by v1.0.1 and v1.0.2 for bug fixes, and v1.1, but OMA has now announced LwM2M v1.2 protocol that adds the following new features:
- New transports for LwM2M: MQTT and HTTP
- Optimizations for the bootstrapping and registration interfaces to reduce the amount of data transmitted during the bootstrapping and registration exchanges respectively.
- Observation attributes may now be included in an Observe operation.
- LwM2M gateway functionality – This allows non-LwM2M IoT devices as well as LwM2M devices behind a gateway to be connected to the LwM2M ecosystem and to manage those devices remotely.
- New, highly optimized encoding format based on CBOR (Concise Binary Object Representation) called LwM2M CBOR.
- Enhanced functionality for firmware updates.
- Definition of new notification attributes:
- Edge allows notifications to be triggered on rising and falling edges.
- Confirmable notifications allow the control of reliable transmissions of notifications.
- Maximum historical queue allows the control of time-series data usage.
- Clarifications of object versioning rules.
- Updates to use the latest communication security protocols based on TLS and DTLS 1.3 (as well as the use of the Connection ID).
- Flexibility to control the use of TLS and DTLS 1.3 through configuration information.
- Untangling the relationship of security credentials and their server configuration.
Many of the new features and optimizations are designed to make LwM2M more efficient, and the addition of MQTT and HTTP transport protocols and gateway functionality will make it work with a much wider range of IoT and M2M devices.
But then that begs the question: If LwM2M did not support HTTP and MQTT before which transport protocols did it use? The answer is in the transport bindings specifications:
LwM2M version 1.0 supported multiple transport bindings, namely CoAP over UDP, and over SMS. The UDP and SMS
transports can be used with or without DTLS. This specification, LwM2M version 1.1, adds support for CoAP over TCP /
TLS, and CoAP over Non-IP, namely 3GPP CIoT and LoRaWAN. CoAP over TCP / TLS, as defined in [CoAP_TCP], offers
better firewall traversal, as explained in Section 1 of [CoAP_TCP].
That explains why we’ve mostly seen it implemented on cellular IoT modules mostly. Despite support for LoRaWAN in version 1.1, we’ve yet to cover LoRaWAN modules with LwM2M support. CoAP over TCP/TLS mainly targets enterprise networks.
On the software side, you’ll find LwM2M in the Eclipse Leshan project produced a Java-based LwM2M server implementation, and several open-source LwM2M clients can be found including Wakaama, Mbed Client, and Zephyr’s LwM2M client implementation. I’m not sure those have been updated to support LwM2M v1.2 just yet.
You’ll find the specifications here.