npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nordicsemiconductor/asset-tracker-lwm2m

v1.0.18

Published

Converts a JSON document containing the asset_tracker_v2 device and sensor data encoded as LwM2M to the JSON document required by nRF Asset Tracker.

Downloads

31

Readme

asset_tracker_v2 LwM2M JSON to nRF Asset Tracker JSON npm version

Test and Release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

Converts a JSON document containing the asset_tracker_v2 device and sensor data encoded as LwM2M to the JSON document required by nRF Asset Tracker.

LwM2M to JSON mapping

Data transition from asset_tracker_v2 LwM2M to nRF Asset Tracker reported

| LwM2M ID | LwM2M Obj Version | LwM2M version | Name | nRF Asset Tracker Reported | | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------- | ----------------------- | ---------------------------------------------------------------------------- | | 3 | 1.2 | 1.1 | Device | bat, dev, roam | | 4 | 1.3 | 1.1 | Connectivity Monitoring | roam | | 6 | 1.0 | 1.0 | Location | gnss | | 3303 | 1.1 | 1.0 | Temperature | env | | 3304 | 1.1 | 1.0 | Humidity | env | | 3323 | 1.1 | 1.0 | Pressure | env | | 50009 | | | Config | cfg |

Installation

npm i --save-exact @nordicsemiconductor/asset-tracker-lwm2m

Running the tests

After cloning the repository:

npm ci
npm test

Example usage

import {
	converter,
	type LwM2MAssetTrackerV2,
} from '@nordicsemiconductor/asset-tracker-lwm2m'

const lwM2MAssetTrackerV2 = {} as LwM2MAssetTrackerV2 // Object with Asset Tracker v2 objects...
const result = converter(lwM2MAssetTrackerV2)
console.log(result)

See ./src/example.ts for more details.

Example input

A JSON document containing the asset_tracker_v2 device and sensor data encoded as LwM2M, following the schema in lwm2m-types-js.

import {
  Device_3_urn,
  ConnectivityMonitoring_4_urn,
  Location_6_urn,
  Temperature_3303_urn,
  Humidity_3304_urn,
  Pressure_3323_urn,
  Config_50009_urn
} from "@nordicsemiconductor/lwm2m-types";

export const input = {
	[Device_3_urn]: {
		'0': 'Nordic Semiconductor ASA',
		'1': 'Thingy:91',
		'2': '351358815340515',
		'3': '22.8.1+0',
		'7': [2754],
		'11': [0],
		'13': 1675874731,
		'16': 'UQ',
		'19': '3.2.1',
	},

	[ConnectivityMonitoring_4_urn]: {
		'0': 6,
		'1': [6, 7],
		'2': -85,
		'3': 23,
		'4': ['10.160.120.155'],
		'8': 34237196,
		'9': 20,
		'10': 242,
		'12': 12,
	},

	[Location_6_urn]: {
		'0': -43.5723,
		'1': 153.2176,
		'2': 2,
		'3': 24.798573,
		'5': 1665149633,
		'6': 0.579327,
	},

	[Temperature_3303_urn]: [
		{
			'5601': 27.18,
			'5602': 27.71,
			'5700': 27.18,
			'5701': 'Cel',
			'5518': 1675874731,
		},
	],

	[Humidity_3304_urn]: [
		{
			'5601': 23.535,
			'5602': 24.161,
			'5700': 24.057,
			'5701': '%RH',
			'5518': 1675874731,
		},
	],

	[Pressure_3323_urn]: [
		{
			'5601': 101697,
			'5602': 101705,
			'5700': 10,
			'5701': 'Pa',
			'5518': 1675874731,
		},
	],

	[Config_50009_urn]: {
		'0': true,
		'1': 120,
		'2': 120,
		'3': 600,
		'4': 7200,
		'5': 8.5,
		'6': false,
		'7': true,
		'8': 2.5,
		'9': 0.5,
	},
}

Example output

The output is the nRF Asset Tracker Reported object.

const result = {
	bat: { v: 2754, ts: 1675874731000 },
	dev: {
		v: {
			imei: '351358815340515',
			modV: '22.8.1+0',
			brdV: 'Nordic Semiconductor ASA',
		},
		ts: 1675874731000,
	},
	env: { v: { temp: 27.18, hum: 24.057, atmp: 10 }, ts: 1675874731000 },
	gnss: {
		v: {
			lng: 153.2176,
			lat: -43.5723,
			acc: 24.798573,
			alt: 2,
			spd: 0.579327,
		},
		ts: 1665149633000,
	},
	roam: {
		v: {
			nw: '6',
			rsrp: -85,
			area: 12,
			mccmnc: 24220,
			cell: 34237196,
			ip: '10.160.120.155',
		},
		ts: 1675874731000,
	},
	cfg: {
		loct: 120,
		act: true,
		actwt: 120,
		mvres: 600,
		mvt: 7200,
		accath: 8.5,
		accith: 2.5,
		accito: 0.5,
		nod: [],
	},
}

Architecture decision records (ADRs)

See ./adr.