@hello.nrfcloud.com/proto-lwm2m v3.3.0
hello.nrfcloud.com LwM2M Protocols 
Documents the LwM2M communication protocol between devices, the
hello.nrfcloud.com backend and the web application.
The lwm2m folder contains the LwM2M objects that devices publish.
LwM2M object definitions are shared between models and can be re-used. Some
objects provide special behavior (for example object
14201 (Geolocation) will place the device's location on
the map).
Devices publish LwM2M objects using SenML directly, which needs to map to the defined LwM2M objects (example).
The SenML payload will be expanded(./senml/senMLtoLwM2M.spec.ts] to fully qualified LwM2M object representations which can then be processed further, e.g. stored in a database.
This allows the hello.nrfcloud.com web application to visualize this data in a
meaningful way to users without the need for custom implementation.
LwM2M rules
LWM2MVersionmust be1.1- LwM2M objects are defined in the ID range from
14200to15000(non-inclusively). - The URN must have the prefix
urn:oma:lwm2m:x:. - The
ObjectVersionmust be appended if it is not1.0, which is the default. - All objects must define one
Timeproperty. - Objects must be
Multipleinstance. - Objects must be
Optional. - Resources must be
Singleinstance.Multiplecould be useful in some cases, e.g. IP addresses, but until it is really needed, we do not support it. - Resources should only be marked as mandatory in case they must be published together (e.g. latitude and longitude). This allows devices to only update the values that have changed.
RangeEnumerationis only supported forFloatandIntegerand must be specified as<min>..<max>, whereminmust be smaller thanmaxand both must be a number.Objlnkresource type is not supported
The conformity to the rules is checked using the script
./lwm2m/check-lwm2m-rules.ts.
SenML rules
- The implementation follows the recommendation outline in section 7.4.5. of the
LwM2M v1.1.1 Technical Specification:
bnandnfields are combined to form the unique identifier for a resource in the form of/<object ID>/<object instance ID>/<resource ID>/0. The resource instance ID0is always appended, because multiple resource instances are not supported right now. - Use the custom property
blvto specify the object version,1.0is the default and should not be specified. - Timestamps are to be expressed in the base time property
btand are mapped to the LwM2M object's timestamp property and must not be send as a property.
Model transform definitions
Optionally, a set of JSONata expression can be defined per model which allows to convert from the data format that is published by the devices to the SenML data format used to describe LwM2M objects (example mapping.
Model definition rules
- device models are identified using a model name, for example
PCA20035+solar - a
README.mdmust be provided that describes the model - transforms may define transforms that convert the data sent by the device
using JSONata for JSON payloads in one or more Markdown files
(Example):
- The
Match Expressionthe must evaluate totruefor theTransform Expressionto be applied to the input message - an
Input Exampleand aResult Examplemust be supplied to validate the expression - The result of the Transform Expression must be SenML according to the rules outlined below.
- The
The conformity to the rules is checked using the script
./models/check-model-rules.ts.
Usage
npm i --save-exact @hello.nrfcloud.com/proto-lwm2mSetup
Install the dependencies:
npm ciInstall xmllint.
Run tests
npm testUpdate generated code
npx tsx generator/lwm2m.ts
npx tsx generator/models.ts
npx tsx generator/types.ts2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago