Giter Club home page Giter Club logo

proto-map's Introduction

hello.nrfcloud.com/map Protocols npm version

GitHub Actions semantic-release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

Documents the communication protocol between devices, the hello.nrfcloud.com/map backend and 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 to fully qualified LwM2M object representations which can then be processed further, e.g. stored in a database.

This allows the hello.nrfcloud.com/map web application to visualize this data in a meaningful way to users without the need for custom implementation.

LwM2M rules

  • LWM2MVersion must be 1.1
  • LwM2M objects are defined in the ID range from 14200 to 15000 (non-inclusively).
  • The URN must have the prefix urn:oma:lwm2m:x:.
  • The ObjectVersion must be appended if it is not 1.0, which is the default.
  • All objects must define one Time property.
  • Objects must be Multiple instance.
  • Objects must be Optional.
  • Resources must be Single instance. Multiple could 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.
  • RangeEnumeration is only supported for Float and Integer and must be specified as <min>..<max>, where min must be smaller than max and both must be a number.
  • Objlnk resource 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: bn and n fields 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 ID 0 is always appended, because multiple resource instances are not supported right now.
  • Use the custom property blv to specify the object version, 1.0 is the default and should not be specified.
  • Timestamps are to be expressed in the base time property bt and are mapped to the LwM2M object's timestamp property and must not be send as a property.

Model definition rules

  • device models are identified using a model name, for example kartverket-vasstandsdata
  • a README.md must be provided that describes the model

The conformity to the rules is checked using the script ./models/check-model-rules.ts.

Usage

npm i --save-exact @hello.nrfcloud.com/proto-map

Setup

Install the dependencies:

npm ci

Install xmllint.

Run tests

npm test

Update generated code

npx tsx generator/lwm2m.ts
npx tsx generator/models.ts
npx tsx generator/types.ts

proto-map's People

Contributors

coderbyheart avatar mlopezj avatar renovate[bot] avatar

Watchers

 avatar

Forkers

mlopezj

proto-map's Issues

[lwm2m] Fix generated resource docs

        /**
         * Humidity (%)
         *
         * Environmental humidity in percent. Examples: 44.2, 72.
         */
        /**
         * Minimum: 0
         * Maximum: 100
         */
        1?: number;

This should be one comment. Happens in e.g. 14205.

Implement Range

We need the RangeEnumeration to improve rendering of history charts, so for example a percentage chart can be render with min=0 and max=100, instead of looking just at the min/max of the history.

image

The format for RangeEnumeration should depend on the resource type:

  • Integer: <integer>..<integer> (integer can be negative)
  • Float: <float>..<float> (float can be negative)
  • String: not supported
  • Boolean: not supported
  • Opaque: not supported
  • Time: not supported

Shadow not handled unexpectedly

{"state":{"reported":{"roam":{"v":{"band":20,"nw":"LTE-M","rsrp":-90,"area":33129,"mccmnc":24201,"cell":21679616,"ip":"100.73.120.2","eest":7},"ts":1701900276787},"env":{"v":{"temp":20.794578,"hum":9.73001,"atmp":101.054242187,"bsec_iaq":199},"ts":1701900276736},"fg":{"ts":1701900277007,"v":{"V":4161,"SoC":89,"I":null,"T":null,"TTE":null,"TTF":null}},"sol":{"v":{"gain":0,"bat":4.15999984741211},"ts":1701900277005}}}}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Fallback to renovate.json file as a preset is deprecated, please use a default.json file instead.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/build-and-publish.yaml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/update-repo-info.yaml
  • actions/checkout v4
  • ubuntu 22.04
npm
package.json
  • @bifravst/eslint-config-typescript 6.1.0
  • @bifravst/prettier-config 1.0.0
  • @commitlint/config-conventional 19.2.2
  • @swc/cli 0.3.12
  • @swc/core 1.5.7
  • @types/node 20.12.12
  • @types/xml2js 0.4.14
  • chalk 5.3.0
  • globstar 1.0.0
  • husky 9.0.11
  • lint-staged 15.2.5
  • prettier-plugin-organize-imports 3.2.4
  • remark 15.0.1
  • remark-frontmatter 5.0.0
  • tsmatchers 5.0.2
  • tsx 4.11.0
  • xml2js 0.6.2
  • yaml 2.4.2
  • @sinclair/typebox ^0.32.31
  • node >=20.0.0
  • npm >=9.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.