@hello.nrfcloud.com/proto-map 4.0.5 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/models/models.js +18 -18
  2. package/dist/senml/SenMLSchema.spec.js +1 -1
  3. package/dist/senml/lwm2mToSenML.js +1 -1
  4. package/dist/senml/lwm2mToSenML.spec.js +4 -4
  5. package/dist/senml/parseResourceId.js +3 -3
  6. package/dist/senml/parseResourceId.spec.js +1 -1
  7. package/dist/senml/senMLtoLwM2M.spec.js +9 -9
  8. package/dist/senml/validateSenML.spec.js +1 -1
  9. package/models/PCA20035+solar/transforms/airQuality.md +2 -2
  10. package/models/PCA20035+solar/transforms/battery.md +2 -2
  11. package/models/PCA20035+solar/transforms/button.md +2 -2
  12. package/models/PCA20035+solar/transforms/deviceInfo.md +2 -2
  13. package/models/PCA20035+solar/transforms/gain.md +2 -2
  14. package/models/PCA20035+solar/transforms/geolocationFromGroundfix.md +2 -2
  15. package/models/PCA20035+solar/transforms/geolocationFromMessage.md +2 -2
  16. package/models/PCA20035+solar/transforms/humidity.md +2 -2
  17. package/models/PCA20035+solar/transforms/networkInfo.md +2 -2
  18. package/models/PCA20035+solar/transforms/pressure.md +2 -2
  19. package/models/PCA20035+solar/transforms/temperature.md +2 -2
  20. package/models/asset_tracker_v2+AWS/transforms/GNSS.md +2 -2
  21. package/models/asset_tracker_v2+AWS/transforms/battery-voltage.md +2 -2
  22. package/models/asset_tracker_v2+AWS/transforms/device-info.md +2 -2
  23. package/models/asset_tracker_v2+AWS/transforms/env.md +2 -2
  24. package/models/asset_tracker_v2+AWS/transforms/fuel-gauge.md +2 -2
  25. package/models/asset_tracker_v2+AWS/transforms/roam.md +6 -6
  26. package/models/asset_tracker_v2+AWS/transforms/solar.md +2 -2
  27. package/models/models.ts +1 -1
  28. package/package.json +5 -4
  29. package/senml/SenMLSchema.spec.ts +1 -1
  30. package/senml/lwm2mToSenML.spec.ts +4 -4
  31. package/senml/lwm2mToSenML.ts +1 -1
  32. package/senml/parseResourceId.spec.ts +1 -1
  33. package/senml/parseResourceId.ts +7 -5
  34. package/senml/senMLtoLwM2M.spec.ts +9 -9
  35. package/senml/validateSenML.spec.ts +1 -1
@@ -27,57 +27,57 @@ var _obj;
27
27
  {
28
28
  "type": TransformType.Messages,
29
29
  "match": "appId = 'AIR_QUAL'",
30
- "transform": '[\n {"bn": "/14205/0/", "n": "10", "v": $number(data), "bt": ts }\n]'
30
+ "transform": '[\n {"bn": "14205/0/", "n": "10", "v": $number(data), "bt": ts }\n]'
31
31
  },
32
32
  {
33
33
  "type": TransformType.Messages,
34
34
  "match": "appId = 'BATTERY'",
35
- "transform": '[\n {"bn": "/14202/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
35
+ "transform": '[\n {"bn": "14202/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
36
36
  },
37
37
  {
38
38
  "type": TransformType.Messages,
39
39
  "match": "appId = 'BUTTON'",
40
- "transform": '[\n {"bn": "/14220/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
40
+ "transform": '[\n {"bn": "14220/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
41
41
  },
42
42
  {
43
43
  "type": TransformType.Messages,
44
44
  "match": "appId = 'DEVICE' and $exists(data.deviceInfo)",
45
- "transform": '[\n {"bn": "/14204/0/", "n": "0", "vs": data.deviceInfo.imei, "bt": ts },\n {"n": "1", "vs": data.deviceInfo.iccid },\n {"n": "2", "vs": data.deviceInfo.modemFirmware },\n {"n": "3", "vs": data.deviceInfo.appVersion },\n {"n": "4", "vs": data.deviceInfo.board },\n {"n": "5", "vs": data.deviceInfo.bat }\n]'
45
+ "transform": '[\n {"bn": "14204/0/", "n": "0", "vs": data.deviceInfo.imei, "bt": ts },\n {"n": "1", "vs": data.deviceInfo.iccid },\n {"n": "2", "vs": data.deviceInfo.modemFirmware },\n {"n": "3", "vs": data.deviceInfo.appVersion },\n {"n": "4", "vs": data.deviceInfo.board },\n {"n": "5", "vs": data.deviceInfo.bat }\n]'
46
46
  },
47
47
  {
48
48
  "type": TransformType.Messages,
49
49
  "match": "appId = 'SOLAR'",
50
- "transform": '[\n {"bn": "/14210/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
50
+ "transform": '[\n {"bn": "14210/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
51
51
  },
52
52
  {
53
53
  "type": TransformType.Messages,
54
54
  "match": "appId = 'GROUND_FIX' and $exists(data.lat) and $exists(data.lon) and $exists(data.uncertainty) and $exists(data.fulfilledWith)",
55
- "transform": '[\n {"bn": "/14201/1/", "n": "0", "v": data.lat, "bt": $millis() },\n {"n": "1", "v": data.lon },\n {"n": "3", "v": data.uncertainty },\n {"n": "6", "vs": data.fulfilledWith }\n]'
55
+ "transform": '[\n {"bn": "14201/1/", "n": "0", "v": data.lat, "bt": $millis() },\n {"n": "1", "v": data.lon },\n {"n": "3", "v": data.uncertainty },\n {"n": "6", "vs": data.fulfilledWith }\n]'
56
56
  },
57
57
  {
58
58
  "type": TransformType.Messages,
59
59
  "match": "appId = 'GNSS'",
60
- "transform": '[\n {"bn": "/14201/0/", "n": "0", "v": data.lat, "bt": ts },\n {"n": "1", "v": data.lng },\n {"n": "2", "v": data.alt },\n {"n": "3", "v": data.acc },\n {"n": "4", "v": data.spd },\n {"n": "5", "v": data.hdg },\n {"n": "6", "vs": "GNSS" }\n]'
60
+ "transform": '[\n {"bn": "14201/0/", "n": "0", "v": data.lat, "bt": ts },\n {"n": "1", "v": data.lng },\n {"n": "2", "v": data.alt },\n {"n": "3", "v": data.acc },\n {"n": "4", "v": data.spd },\n {"n": "5", "v": data.hdg },\n {"n": "6", "vs": "GNSS" }\n]'
61
61
  },
62
62
  {
63
63
  "type": TransformType.Messages,
64
64
  "match": "appId = 'HUMID'",
65
- "transform": '[\n {"bn": "/14205/0/", "n": "1", "v": $number(data), "bt": ts }\n]'
65
+ "transform": '[\n {"bn": "14205/0/", "n": "1", "v": $number(data), "bt": ts }\n]'
66
66
  },
67
67
  {
68
68
  "type": TransformType.Messages,
69
69
  "match": "appId = 'DEVICE' and $exists(data.networkInfo)",
70
- "transform": '[\n {"bn": "/14203/0/", "n": "0", "vs": data.networkInfo.networkMode, "bt": ts },\n {"n": "1", "v": data.networkInfo.currentBand },\n {"n": "2", "v": data.networkInfo.rsrp },\n {"n": "3", "v": data.networkInfo.areaCode },\n {"n": "4", "v": data.networkInfo.cellID },\n {"n": "5", "v": data.networkInfo.mccmnc },\n {"n": "6", "vs": data.networkInfo.ipAddress },\n {"n": "11", "v": data.networkInfo.eest }\n]'
70
+ "transform": '[\n {"bn": "14203/0/", "n": "0", "vs": data.networkInfo.networkMode, "bt": ts },\n {"n": "1", "v": data.networkInfo.currentBand },\n {"n": "2", "v": data.networkInfo.rsrp },\n {"n": "3", "v": data.networkInfo.areaCode },\n {"n": "4", "v": data.networkInfo.cellID },\n {"n": "5", "v": data.networkInfo.mccmnc },\n {"n": "6", "vs": data.networkInfo.ipAddress },\n {"n": "11", "v": data.networkInfo.eest }\n]'
71
71
  },
72
72
  {
73
73
  "type": TransformType.Messages,
74
74
  "match": "appId = 'AIR_PRESS'",
75
- "transform": '[\n {"bn": "/14205/0/", "n": "2", "v": $number(data)*10, "bt": ts }\n]'
75
+ "transform": '[\n {"bn": "14205/0/", "n": "2", "v": $number(data)*10, "bt": ts }\n]'
76
76
  },
77
77
  {
78
78
  "type": TransformType.Messages,
79
79
  "match": "appId = 'TEMP'",
80
- "transform": '[\n {"bn": "/14205/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
80
+ "transform": '[\n {"bn": "14205/0/", "n": "0", "v": $number(data), "bt": ts }\n]'
81
81
  }
82
82
  ],
83
83
  "about": {
@@ -90,37 +90,37 @@ var _obj;
90
90
  {
91
91
  "type": TransformType.Shadow,
92
92
  "match": "$exists(state.reported.gnss)",
93
- "transform": '[\n {"bn": "/14201/0/", "n": "0", "v": state.reported.gnss.v.lat, "bt": state.reported.gnss.ts },\n {"n": "1", "v": state.reported.gnss.v.lng },\n {"n": "2", "v": state.reported.gnss.v.alt },\n {"n": "3", "v": state.reported.gnss.v.acc },\n {"n": "4", "v": state.reported.gnss.v.spd },\n {"n": "5", "v": state.reported.gnss.v.hdg },\n {"n": "6", "vs": "GNSS" }\n]'
93
+ "transform": '[\n {"bn": "14201/0/", "n": "0", "v": state.reported.gnss.v.lat, "bt": state.reported.gnss.ts },\n {"n": "1", "v": state.reported.gnss.v.lng },\n {"n": "2", "v": state.reported.gnss.v.alt },\n {"n": "3", "v": state.reported.gnss.v.acc },\n {"n": "4", "v": state.reported.gnss.v.spd },\n {"n": "5", "v": state.reported.gnss.v.hdg },\n {"n": "6", "vs": "GNSS" }\n]'
94
94
  },
95
95
  {
96
96
  "type": TransformType.Shadow,
97
97
  "match": "$exists(state.reported.bat)",
98
- "transform": '[\n {"bn": "/14202/0/", "n": "1", "v": state.reported.bat.v/1000, "bt": state.reported.bat.ts }\n]'
98
+ "transform": '[\n {"bn": "14202/0/", "n": "1", "v": state.reported.bat.v/1000, "bt": state.reported.bat.ts }\n]'
99
99
  },
100
100
  {
101
101
  "type": TransformType.Shadow,
102
102
  "match": "$exists(state.reported.dev)",
103
- "transform": '[\n {"bn": "/14204/0/", "n": "0", "vs": state.reported.dev.v.imei, "bt": state.reported.dev.ts },\n {"n": "1", "vs": state.reported.dev.v.iccid },\n {"n": "2", "vs": state.reported.dev.v.modV },\n {"n": "3", "vs": state.reported.dev.v.appV },\n {"n": "4", "vs": state.reported.dev.v.brdV }\n]'
103
+ "transform": '[\n {"bn": "14204/0/", "n": "0", "vs": state.reported.dev.v.imei, "bt": state.reported.dev.ts },\n {"n": "1", "vs": state.reported.dev.v.iccid },\n {"n": "2", "vs": state.reported.dev.v.modV },\n {"n": "3", "vs": state.reported.dev.v.appV },\n {"n": "4", "vs": state.reported.dev.v.brdV }\n]'
104
104
  },
105
105
  {
106
106
  "type": TransformType.Shadow,
107
107
  "match": "$exists(state.reported.env)",
108
- "transform": '[\n {"bn": "/14205/0/", "n": "0", "v": state.reported.env.v.temp, "bt": state.reported.env.ts },\n {"n": "1", "v": state.reported.env.v.hum },\n {"n": "2", "v": state.reported.env.v.atmp },\n {"n": "10", "v": state.reported.env.v.bsec_iaq }\n]'
108
+ "transform": '[\n {"bn": "14205/0/", "n": "0", "v": state.reported.env.v.temp, "bt": state.reported.env.ts },\n {"n": "1", "v": state.reported.env.v.hum },\n {"n": "2", "v": state.reported.env.v.atmp },\n {"n": "10", "v": state.reported.env.v.bsec_iaq }\n]'
109
109
  },
110
110
  {
111
111
  "type": TransformType.Shadow,
112
112
  "match": "$exists(state.reported.fg)",
113
- "transform": '[\n {"bn": "/14202/0/", "n": "0", "v": state.reported.fg.v.SoC, "bt": state.reported.fg.ts },\n {"n": "1", "v": state.reported.fg.v.V/1000 },\n {"n": "2", "v": state.reported.fg.v.I },\n {"n": "3", "v": state.reported.fg.v.T = null ? null : state.reported.fg.v.T/10 },\n {"n": "4", "v": state.reported.fg.v.TTF },\n {"n": "5", "v": state.reported.fg.v.TTE }\n]'
113
+ "transform": '[\n {"bn": "14202/0/", "n": "0", "v": state.reported.fg.v.SoC, "bt": state.reported.fg.ts },\n {"n": "1", "v": state.reported.fg.v.V/1000 },\n {"n": "2", "v": state.reported.fg.v.I },\n {"n": "3", "v": state.reported.fg.v.T = null ? null : state.reported.fg.v.T/10 },\n {"n": "4", "v": state.reported.fg.v.TTF },\n {"n": "5", "v": state.reported.fg.v.TTE }\n]'
114
114
  },
115
115
  {
116
116
  "type": TransformType.Shadow,
117
117
  "match": "$exists(state.reported.roam)",
118
- "transform": '[\n {"bn": "/14203/0/", "n": "0", "vs": state.reported.roam.v.nw, "bt": state.reported.roam.ts },\n {"n": "1", "v": state.reported.roam.v.band },\n {"bn": "/14203/0/", "n": "2", "v": state.reported.roam.v.rsrp, "bt": state.reported.roam.ts },\n {"n": "3", "v": state.reported.roam.v.area },\n {"n": "4", "v": state.reported.roam.v.cell },\n {"n": "5", "v": state.reported.roam.v.mccmnc },\n {"n": "6", "vs": state.reported.roam.v.ip },\n {"bn": "/14203/0/", "n": "11", "v": state.reported.roam.v.eest, "bt": state.reported.roam.ts }\n]'
118
+ "transform": '[\n {"bn": "14203/0/", "n": "0", "vs": state.reported.roam.v.nw, "bt": state.reported.roam.ts },\n {"n": "1", "v": state.reported.roam.v.band },\n {"bn": "14203/0/", "n": "2", "v": state.reported.roam.v.rsrp, "bt": state.reported.roam.ts },\n {"n": "3", "v": state.reported.roam.v.area },\n {"n": "4", "v": state.reported.roam.v.cell },\n {"n": "5", "v": state.reported.roam.v.mccmnc },\n {"n": "6", "vs": state.reported.roam.v.ip },\n {"bn": "14203/0/", "n": "11", "v": state.reported.roam.v.eest, "bt": state.reported.roam.ts }\n]'
119
119
  },
120
120
  {
121
121
  "type": TransformType.Shadow,
122
122
  "match": "$exists(state.reported.sol)",
123
- "transform": '[\n {"bn": "/14210/0/", "n": "0", "v": state.reported.sol.v.gain, "bt": state.reported.sol.ts },\n {"n": "1", "v": state.reported.sol.v.bat }\n]'
123
+ "transform": '[\n {"bn": "14210/0/", "n": "0", "v": state.reported.sol.v.gain, "bt": state.reported.sol.ts },\n {"n": "1", "v": state.reported.sol.v.bat }\n]'
124
124
  }
125
125
  ],
126
126
  "about": {
@@ -6,7 +6,7 @@ void describe("SenMLType", function() {
6
6
  void it("it should validate a SenML payload", function() {
7
7
  var example = [
8
8
  {
9
- bn: "/14201/0/",
9
+ bn: "14201/0/",
10
10
  n: "0",
11
11
  v: 33.98755678796222,
12
12
  bt: 1698155694999
@@ -109,7 +109,7 @@ var asSenML = function(lwm2m) {
109
109
  var _obj;
110
110
  return [
111
111
  (_obj = {
112
- bn: "/".concat(lwm2m.ObjectID, "/").concat((_lwm2m_ObjectInstanceID = lwm2m.ObjectInstanceID) !== null && _lwm2m_ObjectInstanceID !== void 0 ? _lwm2m_ObjectInstanceID : 0, "/"),
112
+ bn: "".concat(lwm2m.ObjectID, "/").concat((_lwm2m_ObjectInstanceID = lwm2m.ObjectInstanceID) !== null && _lwm2m_ObjectInstanceID !== void 0 ? _lwm2m_ObjectInstanceID : 0, "/"),
113
113
  n: first[0]
114
114
  }, _define_property(_obj, toKey(def, parseInt(first[0], 10)), first[1]), _define_property(_obj, "bt", i.getTime()), _obj)
115
115
  ].concat(_to_consumable_array(rest.map(function(r) {
@@ -51,7 +51,7 @@ void describe("lwm2mToSenML()", function() {
51
51
  ];
52
52
  var expected = [
53
53
  {
54
- bn: "/14201/0/",
54
+ bn: "14201/0/",
55
55
  n: "0",
56
56
  v: 62.469414,
57
57
  bt: 1710147413003
@@ -69,7 +69,7 @@ void describe("lwm2mToSenML()", function() {
69
69
  vs: "Fixed"
70
70
  },
71
71
  {
72
- bn: "/14230/0/",
72
+ bn: "14230/0/",
73
73
  n: "0",
74
74
  v: 84.3,
75
75
  bt: 1710140400000
@@ -79,7 +79,7 @@ void describe("lwm2mToSenML()", function() {
79
79
  vs: "AES"
80
80
  },
81
81
  {
82
- bn: "/14230/0/",
82
+ bn: "14230/0/",
83
83
  n: "0",
84
84
  v: 140.4,
85
85
  bt: 1710144000000
@@ -89,7 +89,7 @@ void describe("lwm2mToSenML()", function() {
89
89
  vs: "AES"
90
90
  },
91
91
  {
92
- bn: "/14230/1/",
92
+ bn: "14230/1/",
93
93
  n: "0",
94
94
  v: 140.7,
95
95
  bt: 1710144001000
@@ -45,10 +45,10 @@ function _unsupported_iterable_to_array(o, minLen) {
45
45
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
46
  }
47
47
  export var parseResourceId = function(resourceId) {
48
- if (!/^\/\d+\/\d+\/\d+\/\d+$/.test(resourceId)) return null;
49
- var _resourceId_slice_split_map = _sliced_to_array(resourceId.slice(1).split("/").map(function(s) {
48
+ if (!/^\d+\/\d+\/\d+\/\d+$/.test(resourceId)) return null;
49
+ var _resourceId_split_map = _sliced_to_array(resourceId.split("/").map(function(s) {
50
50
  return parseInt(s, 10);
51
- }), 4), ObjectID = _resourceId_slice_split_map[0], ObjectInstanceID = _resourceId_slice_split_map[1], ResourceID = _resourceId_slice_split_map[2], ResourceInstanceId = _resourceId_slice_split_map[3];
51
+ }), 4), ObjectID = _resourceId_split_map[0], ObjectInstanceID = _resourceId_split_map[1], ResourceID = _resourceId_split_map[2], ResourceInstanceId = _resourceId_split_map[3];
52
52
  return {
53
53
  ObjectID: ObjectID,
54
54
  ObjectInstanceID: ObjectInstanceID,
@@ -3,7 +3,7 @@ import { describe, it } from "node:test";
3
3
  import { parseResourceId } from "./parseResourceId.js";
4
4
  void describe("parseResourceId()", function() {
5
5
  void it("should parse an LwM2M resource ID", function() {
6
- return assert.deepEqual(parseResourceId("/14201/1/2/0"), {
6
+ return assert.deepEqual(parseResourceId("14201/1/2/0"), {
7
7
  ObjectID: 14201,
8
8
  ObjectInstanceID: 1,
9
9
  ResourceID: 2,
@@ -5,7 +5,7 @@ void describe("senMLtoLwM2M()", function() {
5
5
  void it("should resolve a senML message into objects", function() {
6
6
  var input = [
7
7
  {
8
- bn: "/14201/1/",
8
+ bn: "14201/1/",
9
9
  blv: "1.1",
10
10
  bt: 1698155694999,
11
11
  n: "0",
@@ -53,7 +53,7 @@ void describe("senMLtoLwM2M()", function() {
53
53
  void it("should drop empty resources", function() {
54
54
  var input = [
55
55
  {
56
- bn: "/14203/0/",
56
+ bn: "14203/0/",
57
57
  n: "0",
58
58
  vs: "LTE-M",
59
59
  bt: 1676369307222
@@ -106,7 +106,7 @@ void describe("senMLtoLwM2M()", function() {
106
106
  void it("should ignore repeated base properties", function() {
107
107
  var input = [
108
108
  {
109
- bn: "/14203/0/",
109
+ bn: "14203/0/",
110
110
  n: "0",
111
111
  vs: "LTE-M",
112
112
  bt: 1699049665511
@@ -116,7 +116,7 @@ void describe("senMLtoLwM2M()", function() {
116
116
  v: 20
117
117
  },
118
118
  {
119
- bn: "/14203/0/",
119
+ bn: "14203/0/",
120
120
  n: "2",
121
121
  v: -89,
122
122
  bt: 1699049665511
@@ -138,7 +138,7 @@ void describe("senMLtoLwM2M()", function() {
138
138
  vs: "100.81.95.75"
139
139
  },
140
140
  {
141
- bn: "/14203/0/",
141
+ bn: "14203/0/",
142
142
  n: "11",
143
143
  v: 7,
144
144
  bt: 1699049665511
@@ -165,25 +165,25 @@ void describe("senMLtoLwM2M()", function() {
165
165
  void it("should handle multiple measurements for the same resource", function() {
166
166
  var input = [
167
167
  {
168
- bn: "/14205/0/",
168
+ bn: "14205/0/",
169
169
  n: "0",
170
170
  v: 21,
171
171
  bt: 1699049600000
172
172
  },
173
173
  {
174
- bn: "/14205/1/",
174
+ bn: "14205/1/",
175
175
  n: "0",
176
176
  v: 31,
177
177
  bt: 1699049600000
178
178
  },
179
179
  {
180
- bn: "/14205/0/",
180
+ bn: "14205/0/",
181
181
  n: "0",
182
182
  v: 22,
183
183
  bt: 1699049700000
184
184
  },
185
185
  {
186
- bn: "/14205/1/",
186
+ bn: "14205/1/",
187
187
  n: "0",
188
188
  v: 32,
189
189
  bt: 1699049700000
@@ -5,7 +5,7 @@ void describe("validateSenML()", function() {
5
5
  void it("should validate", function() {
6
6
  var senMl = [
7
7
  {
8
- bn: "/14202/1/",
8
+ bn: "14202/1/",
9
9
  blv: "1.1",
10
10
  n: "0",
11
11
  v: 99,
@@ -19,7 +19,7 @@ appId = 'AIR_QUAL'
19
19
 
20
20
  ```jsonata
21
21
  [
22
- {"bn": "/14205/0/", "n": "10", "v": $number(data), "bt": ts }
22
+ {"bn": "14205/0/", "n": "10", "v": $number(data), "bt": ts }
23
23
  ]
24
24
  ```
25
25
 
@@ -39,7 +39,7 @@ appId = 'AIR_QUAL'
39
39
  ```json
40
40
  [
41
41
  {
42
- "bn": "/14205/0/",
42
+ "bn": "14205/0/",
43
43
  "n": "10",
44
44
  "v": 177,
45
45
  "bt": 1681985384511
@@ -17,7 +17,7 @@ appId = 'BATTERY'
17
17
 
18
18
  ```jsonata
19
19
  [
20
- {"bn": "/14202/0/", "n": "0", "v": $number(data), "bt": ts }
20
+ {"bn": "14202/0/", "n": "0", "v": $number(data), "bt": ts }
21
21
  ]
22
22
  ```
23
23
 
@@ -37,7 +37,7 @@ appId = 'BATTERY'
37
37
  ```json
38
38
  [
39
39
  {
40
- "bn": "/14202/0/",
40
+ "bn": "14202/0/",
41
41
  "n": "0",
42
42
  "v": 94,
43
43
  "bt": 1687448260542
@@ -16,7 +16,7 @@ appId = 'BUTTON'
16
16
 
17
17
  ```jsonata
18
18
  [
19
- {"bn": "/14220/0/", "n": "0", "v": $number(data), "bt": ts }
19
+ {"bn": "14220/0/", "n": "0", "v": $number(data), "bt": ts }
20
20
  ]
21
21
  ```
22
22
 
@@ -36,7 +36,7 @@ appId = 'BUTTON'
36
36
  ```json
37
37
  [
38
38
  {
39
- "bn": "/14220/0/",
39
+ "bn": "14220/0/",
40
40
  "n": "0",
41
41
  "v": 1,
42
42
  "bt": 1676366857236
@@ -14,7 +14,7 @@ appId = 'DEVICE' and $exists(data.deviceInfo)
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14204/0/", "n": "0", "vs": data.deviceInfo.imei, "bt": ts },
17
+ {"bn": "14204/0/", "n": "0", "vs": data.deviceInfo.imei, "bt": ts },
18
18
  {"n": "1", "vs": data.deviceInfo.iccid },
19
19
  {"n": "2", "vs": data.deviceInfo.modemFirmware },
20
20
  {"n": "3", "vs": data.deviceInfo.appVersion },
@@ -47,7 +47,7 @@ appId = 'DEVICE' and $exists(data.deviceInfo)
47
47
  ```json
48
48
  [
49
49
  {
50
- "bn": "/14204/0/",
50
+ "bn": "14204/0/",
51
51
  "n": "0",
52
52
  "vs": "350457794611739",
53
53
  "bt": 1676369307189
@@ -16,7 +16,7 @@ appId = 'SOLAR'
16
16
 
17
17
  ```jsonata
18
18
  [
19
- {"bn": "/14210/0/", "n": "0", "v": $number(data), "bt": ts }
19
+ {"bn": "14210/0/", "n": "0", "v": $number(data), "bt": ts }
20
20
  ]
21
21
  ```
22
22
 
@@ -36,7 +36,7 @@ appId = 'SOLAR'
36
36
  ```json
37
37
  [
38
38
  {
39
- "bn": "/14210/0/",
39
+ "bn": "14210/0/",
40
40
  "n": "0",
41
41
  "v": 3.123456,
42
42
  "bt": 1681985624779
@@ -19,7 +19,7 @@ appId = 'GROUND_FIX' and $exists(data.lat) and $exists(data.lon) and $exists(dat
19
19
 
20
20
  ```jsonata
21
21
  [
22
- {"bn": "/14201/1/", "n": "0", "v": data.lat, "bt": $millis() },
22
+ {"bn": "14201/1/", "n": "0", "v": data.lat, "bt": $millis() },
23
23
  {"n": "1", "v": data.lon },
24
24
  {"n": "3", "v": data.uncertainty },
25
25
  {"n": "6", "vs": data.fulfilledWith }
@@ -46,7 +46,7 @@ appId = 'GROUND_FIX' and $exists(data.lat) and $exists(data.lon) and $exists(dat
46
46
  ```json
47
47
  [
48
48
  {
49
- "bn": "/14201/1/",
49
+ "bn": "14201/1/",
50
50
  "n": "0",
51
51
  "v": 59.3381238,
52
52
  "bt": 1699999999999
@@ -14,7 +14,7 @@ appId = 'GNSS'
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14201/0/", "n": "0", "v": data.lat, "bt": ts },
17
+ {"bn": "14201/0/", "n": "0", "v": data.lat, "bt": ts },
18
18
  {"n": "1", "v": data.lng },
19
19
  {"n": "2", "v": data.alt },
20
20
  {"n": "3", "v": data.acc },
@@ -47,7 +47,7 @@ appId = 'GNSS'
47
47
  ```json
48
48
  [
49
49
  {
50
- "bn": "/14201/0/",
50
+ "bn": "14201/0/",
51
51
  "n": "0",
52
52
  "v": 63.43308707524497,
53
53
  "bt": 1690820492999
@@ -14,7 +14,7 @@ appId = 'HUMID'
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14205/0/", "n": "1", "v": $number(data), "bt": ts }
17
+ {"bn": "14205/0/", "n": "1", "v": $number(data), "bt": ts }
18
18
  ]
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ appId = 'HUMID'
34
34
  ```json
35
35
  [
36
36
  {
37
- "bn": "/14205/0/",
37
+ "bn": "14205/0/",
38
38
  "n": "1",
39
39
  "v": 23.16,
40
40
  "bt": 1681985384511
@@ -14,7 +14,7 @@ appId = 'DEVICE' and $exists(data.networkInfo)
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14203/0/", "n": "0", "vs": data.networkInfo.networkMode, "bt": ts },
17
+ {"bn": "14203/0/", "n": "0", "vs": data.networkInfo.networkMode, "bt": ts },
18
18
  {"n": "1", "v": data.networkInfo.currentBand },
19
19
  {"n": "2", "v": data.networkInfo.rsrp },
20
20
  {"n": "3", "v": data.networkInfo.areaCode },
@@ -51,7 +51,7 @@ appId = 'DEVICE' and $exists(data.networkInfo)
51
51
  ```json
52
52
  [
53
53
  {
54
- "bn": "/14203/0/",
54
+ "bn": "14203/0/",
55
55
  "n": "0",
56
56
  "vs": "LTE-M",
57
57
  "bt": 1676369307222
@@ -14,7 +14,7 @@ appId = 'AIR_PRESS'
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14205/0/", "n": "2", "v": $number(data)*10, "bt": ts }
17
+ {"bn": "14205/0/", "n": "2", "v": $number(data)*10, "bt": ts }
18
18
  ]
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ appId = 'AIR_PRESS'
34
34
  ```json
35
35
  [
36
36
  {
37
- "bn": "/14205/0/",
37
+ "bn": "14205/0/",
38
38
  "n": "2",
39
39
  "v": 1023.1,
40
40
  "bt": 1681985384511
@@ -14,7 +14,7 @@ appId = 'TEMP'
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14205/0/", "n": "0", "v": $number(data), "bt": ts }
17
+ {"bn": "14205/0/", "n": "0", "v": $number(data), "bt": ts }
18
18
  ]
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ appId = 'TEMP'
34
34
  ```json
35
35
  [
36
36
  {
37
- "bn": "/14205/0/",
37
+ "bn": "14205/0/",
38
38
  "n": "0",
39
39
  "v": 25.73,
40
40
  "bt": 1676366336476
@@ -14,7 +14,7 @@ $exists(state.reported.gnss)
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14201/0/", "n": "0", "v": state.reported.gnss.v.lat, "bt": state.reported.gnss.ts },
17
+ {"bn": "14201/0/", "n": "0", "v": state.reported.gnss.v.lat, "bt": state.reported.gnss.ts },
18
18
  {"n": "1", "v": state.reported.gnss.v.lng },
19
19
  {"n": "2", "v": state.reported.gnss.v.alt },
20
20
  {"n": "3", "v": state.reported.gnss.v.acc },
@@ -51,7 +51,7 @@ $exists(state.reported.gnss)
51
51
  ```json
52
52
  [
53
53
  {
54
- "bn": "/14201/0/",
54
+ "bn": "14201/0/",
55
55
  "n": "0",
56
56
  "v": 33.98771459323253,
57
57
  "bt": 1699049744000
@@ -17,7 +17,7 @@ $exists(state.reported.bat)
17
17
 
18
18
  ```jsonata
19
19
  [
20
- {"bn": "/14202/0/", "n": "1", "v": state.reported.bat.v/1000, "bt": state.reported.bat.ts }
20
+ {"bn": "14202/0/", "n": "1", "v": state.reported.bat.v/1000, "bt": state.reported.bat.ts }
21
21
  ]
22
22
  ```
23
23
 
@@ -41,7 +41,7 @@ $exists(state.reported.bat)
41
41
  ```json
42
42
  [
43
43
  {
44
- "bn": "/14202/0/",
44
+ "bn": "14202/0/",
45
45
  "n": "1",
46
46
  "v": 4.398,
47
47
  "bt": 1699050063028
@@ -14,7 +14,7 @@ $exists(state.reported.dev)
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14204/0/", "n": "0", "vs": state.reported.dev.v.imei, "bt": state.reported.dev.ts },
17
+ {"bn": "14204/0/", "n": "0", "vs": state.reported.dev.v.imei, "bt": state.reported.dev.ts },
18
18
  {"n": "1", "vs": state.reported.dev.v.iccid },
19
19
  {"n": "2", "vs": state.reported.dev.v.modV },
20
20
  {"n": "3", "vs": state.reported.dev.v.appV },
@@ -48,7 +48,7 @@ $exists(state.reported.dev)
48
48
  ```json
49
49
  [
50
50
  {
51
- "bn": "/14204/0/",
51
+ "bn": "14204/0/",
52
52
  "n": "0",
53
53
  "vs": "358299840016535",
54
54
  "bt": 1699284007851
@@ -16,7 +16,7 @@ $exists(state.reported.env)
16
16
 
17
17
  ```jsonata
18
18
  [
19
- {"bn": "/14205/0/", "n": "0", "v": state.reported.env.v.temp, "bt": state.reported.env.ts },
19
+ {"bn": "14205/0/", "n": "0", "v": state.reported.env.v.temp, "bt": state.reported.env.ts },
20
20
  {"n": "1", "v": state.reported.env.v.hum },
21
21
  {"n": "2", "v": state.reported.env.v.atmp },
22
22
  {"n": "10", "v": state.reported.env.v.bsec_iaq }
@@ -48,7 +48,7 @@ $exists(state.reported.env)
48
48
  ```json
49
49
  [
50
50
  {
51
- "bn": "/14205/0/",
51
+ "bn": "14205/0/",
52
52
  "n": "0",
53
53
  "v": 27.06,
54
54
  "bt": 1699050061608
@@ -14,7 +14,7 @@ $exists(state.reported.fg)
14
14
 
15
15
  ```jsonata
16
16
  [
17
- {"bn": "/14202/0/", "n": "0", "v": state.reported.fg.v.SoC, "bt": state.reported.fg.ts },
17
+ {"bn": "14202/0/", "n": "0", "v": state.reported.fg.v.SoC, "bt": state.reported.fg.ts },
18
18
  {"n": "1", "v": state.reported.fg.v.V/1000 },
19
19
  {"n": "2", "v": state.reported.fg.v.I },
20
20
  {"n": "3", "v": state.reported.fg.v.T = null ? null : state.reported.fg.v.T/10 },
@@ -50,7 +50,7 @@ $exists(state.reported.fg)
50
50
  ```json
51
51
  [
52
52
  {
53
- "bn": "/14202/0/",
53
+ "bn": "14202/0/",
54
54
  "n": "0",
55
55
  "v": 99,
56
56
  "bt": 1699049685992
@@ -16,14 +16,14 @@ $exists(state.reported.roam)
16
16
 
17
17
  ```jsonata
18
18
  [
19
- {"bn": "/14203/0/", "n": "0", "vs": state.reported.roam.v.nw, "bt": state.reported.roam.ts },
19
+ {"bn": "14203/0/", "n": "0", "vs": state.reported.roam.v.nw, "bt": state.reported.roam.ts },
20
20
  {"n": "1", "v": state.reported.roam.v.band },
21
- {"bn": "/14203/0/", "n": "2", "v": state.reported.roam.v.rsrp, "bt": state.reported.roam.ts },
21
+ {"bn": "14203/0/", "n": "2", "v": state.reported.roam.v.rsrp, "bt": state.reported.roam.ts },
22
22
  {"n": "3", "v": state.reported.roam.v.area },
23
23
  {"n": "4", "v": state.reported.roam.v.cell },
24
24
  {"n": "5", "v": state.reported.roam.v.mccmnc },
25
25
  {"n": "6", "vs": state.reported.roam.v.ip },
26
- {"bn": "/14203/0/", "n": "11", "v": state.reported.roam.v.eest, "bt": state.reported.roam.ts }
26
+ {"bn": "14203/0/", "n": "11", "v": state.reported.roam.v.eest, "bt": state.reported.roam.ts }
27
27
  ]
28
28
  ```
29
29
 
@@ -59,7 +59,7 @@ properties, so the `bn` and `bt` properties are repeated.
59
59
  ```json
60
60
  [
61
61
  {
62
- "bn": "/14203/0/",
62
+ "bn": "14203/0/",
63
63
  "n": "0",
64
64
  "vs": "LTE-M",
65
65
  "bt": 1699049665511
@@ -69,7 +69,7 @@ properties, so the `bn` and `bt` properties are repeated.
69
69
  "v": 20
70
70
  },
71
71
  {
72
- "bn": "/14203/0/",
72
+ "bn": "14203/0/",
73
73
  "n": "2",
74
74
  "v": -89,
75
75
  "bt": 1699049665511
@@ -91,7 +91,7 @@ properties, so the `bn` and `bt` properties are repeated.
91
91
  "vs": "100.81.95.75"
92
92
  },
93
93
  {
94
- "bn": "/14203/0/",
94
+ "bn": "14203/0/",
95
95
  "n": "11",
96
96
  "v": 7,
97
97
  "bt": 1699049665511
@@ -17,7 +17,7 @@ $exists(state.reported.sol)
17
17
 
18
18
  ```jsonata
19
19
  [
20
- {"bn": "/14210/0/", "n": "0", "v": state.reported.sol.v.gain, "bt": state.reported.sol.ts },
20
+ {"bn": "14210/0/", "n": "0", "v": state.reported.sol.v.gain, "bt": state.reported.sol.ts },
21
21
  {"n": "1", "v": state.reported.sol.v.bat }
22
22
  ]
23
23
  ```
@@ -45,7 +45,7 @@ $exists(state.reported.sol)
45
45
  ```json
46
46
  [
47
47
  {
48
- "bn": "/14210/0/",
48
+ "bn": "14210/0/",
49
49
  "n": "0",
50
50
  "v": 4.391489028930664,
51
51
  "bt": 1699050063028
package/models/models.ts CHANGED
@@ -33,4 +33,4 @@ export type Model = {
33
33
  /**
34
34
  * The models defined for hello.nrfcloud.com
35
35
  */
36
- export const models: Readonly<Record<ModelID, Model>> = { [ModelID.PCA20035_solar]: { "id": ModelID.PCA20035_solar, "transforms": [{ "type": TransformType.Messages, "match": "appId = 'AIR_QUAL'", "transform": "[\n {\"bn\": \"/14205/0/\", \"n\": \"10\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'BATTERY'", "transform": "[\n {\"bn\": \"/14202/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'BUTTON'", "transform": "[\n {\"bn\": \"/14220/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'DEVICE' and $exists(data.deviceInfo)", "transform": "[\n {\"bn\": \"/14204/0/\", \"n\": \"0\", \"vs\": data.deviceInfo.imei, \"bt\": ts },\n {\"n\": \"1\", \"vs\": data.deviceInfo.iccid },\n {\"n\": \"2\", \"vs\": data.deviceInfo.modemFirmware },\n {\"n\": \"3\", \"vs\": data.deviceInfo.appVersion },\n {\"n\": \"4\", \"vs\": data.deviceInfo.board },\n {\"n\": \"5\", \"vs\": data.deviceInfo.bat }\n]" }, { "type": TransformType.Messages, "match": "appId = 'SOLAR'", "transform": "[\n {\"bn\": \"/14210/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'GROUND_FIX' and $exists(data.lat) and $exists(data.lon) and $exists(data.uncertainty) and $exists(data.fulfilledWith)", "transform": "[\n {\"bn\": \"/14201/1/\", \"n\": \"0\", \"v\": data.lat, \"bt\": $millis() },\n {\"n\": \"1\", \"v\": data.lon },\n {\"n\": \"3\", \"v\": data.uncertainty },\n {\"n\": \"6\", \"vs\": data.fulfilledWith }\n]" }, { "type": TransformType.Messages, "match": "appId = 'GNSS'", "transform": "[\n {\"bn\": \"/14201/0/\", \"n\": \"0\", \"v\": data.lat, \"bt\": ts },\n {\"n\": \"1\", \"v\": data.lng },\n {\"n\": \"2\", \"v\": data.alt },\n {\"n\": \"3\", \"v\": data.acc },\n {\"n\": \"4\", \"v\": data.spd },\n {\"n\": \"5\", \"v\": data.hdg },\n {\"n\": \"6\", \"vs\": \"GNSS\" }\n]" }, { "type": TransformType.Messages, "match": "appId = 'HUMID'", "transform": "[\n {\"bn\": \"/14205/0/\", \"n\": \"1\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'DEVICE' and $exists(data.networkInfo)", "transform": "[\n {\"bn\": \"/14203/0/\", \"n\": \"0\", \"vs\": data.networkInfo.networkMode, \"bt\": ts },\n {\"n\": \"1\", \"v\": data.networkInfo.currentBand },\n {\"n\": \"2\", \"v\": data.networkInfo.rsrp },\n {\"n\": \"3\", \"v\": data.networkInfo.areaCode },\n {\"n\": \"4\", \"v\": data.networkInfo.cellID },\n {\"n\": \"5\", \"v\": data.networkInfo.mccmnc },\n {\"n\": \"6\", \"vs\": data.networkInfo.ipAddress },\n {\"n\": \"11\", \"v\": data.networkInfo.eest }\n]" }, { "type": TransformType.Messages, "match": "appId = 'AIR_PRESS'", "transform": "[\n {\"bn\": \"/14205/0/\", \"n\": \"2\", \"v\": $number(data)*10, \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'TEMP'", "transform": "[\n {\"bn\": \"/14205/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }], "about": { "title": "Thingy:91 with Solar Shield", "description": "The Nordic Thingy:91 Solar Shield is a plug-and-play prototyping platform. Powerfoyle solar cell is mounted onto the Thingy to quickly get started exploring the endless possibilities with solar powered IoT applications and to develop products with eternal life or even battery-free products.\u200B\nThe Thingy:91 runs the asset_tracker_v2 application and sends messages to nRF Cloud using MQTT." } }, [ModelID.Asset_tracker_v2_AWS]: { "id": ModelID.Asset_tracker_v2_AWS, "transforms": [{ "type": TransformType.Shadow, "match": "$exists(state.reported.gnss)", "transform": "[\n {\"bn\": \"/14201/0/\", \"n\": \"0\", \"v\": state.reported.gnss.v.lat, \"bt\": state.reported.gnss.ts },\n {\"n\": \"1\", \"v\": state.reported.gnss.v.lng },\n {\"n\": \"2\", \"v\": state.reported.gnss.v.alt },\n {\"n\": \"3\", \"v\": state.reported.gnss.v.acc },\n {\"n\": \"4\", \"v\": state.reported.gnss.v.spd },\n {\"n\": \"5\", \"v\": state.reported.gnss.v.hdg },\n {\"n\": \"6\", \"vs\": \"GNSS\" }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.bat)", "transform": "[\n {\"bn\": \"/14202/0/\", \"n\": \"1\", \"v\": state.reported.bat.v/1000, \"bt\": state.reported.bat.ts }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.dev)", "transform": "[\n {\"bn\": \"/14204/0/\", \"n\": \"0\", \"vs\": state.reported.dev.v.imei, \"bt\": state.reported.dev.ts },\n {\"n\": \"1\", \"vs\": state.reported.dev.v.iccid },\n {\"n\": \"2\", \"vs\": state.reported.dev.v.modV },\n {\"n\": \"3\", \"vs\": state.reported.dev.v.appV },\n {\"n\": \"4\", \"vs\": state.reported.dev.v.brdV }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.env)", "transform": "[\n {\"bn\": \"/14205/0/\", \"n\": \"0\", \"v\": state.reported.env.v.temp, \"bt\": state.reported.env.ts },\n {\"n\": \"1\", \"v\": state.reported.env.v.hum },\n {\"n\": \"2\", \"v\": state.reported.env.v.atmp },\n {\"n\": \"10\", \"v\": state.reported.env.v.bsec_iaq }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.fg)", "transform": "[\n {\"bn\": \"/14202/0/\", \"n\": \"0\", \"v\": state.reported.fg.v.SoC, \"bt\": state.reported.fg.ts },\n {\"n\": \"1\", \"v\": state.reported.fg.v.V/1000 },\n {\"n\": \"2\", \"v\": state.reported.fg.v.I },\n {\"n\": \"3\", \"v\": state.reported.fg.v.T = null ? null : state.reported.fg.v.T/10 },\n {\"n\": \"4\", \"v\": state.reported.fg.v.TTF },\n {\"n\": \"5\", \"v\": state.reported.fg.v.TTE }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.roam)", "transform": "[\n {\"bn\": \"/14203/0/\", \"n\": \"0\", \"vs\": state.reported.roam.v.nw, \"bt\": state.reported.roam.ts },\n {\"n\": \"1\", \"v\": state.reported.roam.v.band },\n {\"bn\": \"/14203/0/\", \"n\": \"2\", \"v\": state.reported.roam.v.rsrp, \"bt\": state.reported.roam.ts },\n {\"n\": \"3\", \"v\": state.reported.roam.v.area },\n {\"n\": \"4\", \"v\": state.reported.roam.v.cell },\n {\"n\": \"5\", \"v\": state.reported.roam.v.mccmnc },\n {\"n\": \"6\", \"vs\": state.reported.roam.v.ip },\n {\"bn\": \"/14203/0/\", \"n\": \"11\", \"v\": state.reported.roam.v.eest, \"bt\": state.reported.roam.ts }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.sol)", "transform": "[\n {\"bn\": \"/14210/0/\", \"n\": \"0\", \"v\": state.reported.sol.v.gain, \"bt\": state.reported.sol.ts },\n {\"n\": \"1\", \"v\": state.reported.sol.v.bat }\n]" }], "about": { "title": "asset_tracker_v2 on AWS", "description": "This implements the conversion for the asset_tracker_v2 message protocol when connected to AWS IoT." } }, [ModelID.Kartverket_vasstandsdata]: { "id": ModelID.Kartverket_vasstandsdata, "transforms": [], "about": { "title": "Kartverket Vasstandsdata", "description": "A simulated device reporting the current sea level as provided by the Kartverket's (Norwegian Mapping Authority) API for vasstandsdata (API for water level data).\nReports sea water level using the Object 14230.\nThe data is licensed by the Norwegian Mapping Authority\u2019s under the Creative Commons Attribution 4.0 International (CC BY 4.0) license." } } } as const;
36
+ export const models: Readonly<Record<ModelID, Model>> = { [ModelID.PCA20035_solar]: { "id": ModelID.PCA20035_solar, "transforms": [{ "type": TransformType.Messages, "match": "appId = 'AIR_QUAL'", "transform": "[\n {\"bn\": \"14205/0/\", \"n\": \"10\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'BATTERY'", "transform": "[\n {\"bn\": \"14202/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'BUTTON'", "transform": "[\n {\"bn\": \"14220/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'DEVICE' and $exists(data.deviceInfo)", "transform": "[\n {\"bn\": \"14204/0/\", \"n\": \"0\", \"vs\": data.deviceInfo.imei, \"bt\": ts },\n {\"n\": \"1\", \"vs\": data.deviceInfo.iccid },\n {\"n\": \"2\", \"vs\": data.deviceInfo.modemFirmware },\n {\"n\": \"3\", \"vs\": data.deviceInfo.appVersion },\n {\"n\": \"4\", \"vs\": data.deviceInfo.board },\n {\"n\": \"5\", \"vs\": data.deviceInfo.bat }\n]" }, { "type": TransformType.Messages, "match": "appId = 'SOLAR'", "transform": "[\n {\"bn\": \"14210/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'GROUND_FIX' and $exists(data.lat) and $exists(data.lon) and $exists(data.uncertainty) and $exists(data.fulfilledWith)", "transform": "[\n {\"bn\": \"14201/1/\", \"n\": \"0\", \"v\": data.lat, \"bt\": $millis() },\n {\"n\": \"1\", \"v\": data.lon },\n {\"n\": \"3\", \"v\": data.uncertainty },\n {\"n\": \"6\", \"vs\": data.fulfilledWith }\n]" }, { "type": TransformType.Messages, "match": "appId = 'GNSS'", "transform": "[\n {\"bn\": \"14201/0/\", \"n\": \"0\", \"v\": data.lat, \"bt\": ts },\n {\"n\": \"1\", \"v\": data.lng },\n {\"n\": \"2\", \"v\": data.alt },\n {\"n\": \"3\", \"v\": data.acc },\n {\"n\": \"4\", \"v\": data.spd },\n {\"n\": \"5\", \"v\": data.hdg },\n {\"n\": \"6\", \"vs\": \"GNSS\" }\n]" }, { "type": TransformType.Messages, "match": "appId = 'HUMID'", "transform": "[\n {\"bn\": \"14205/0/\", \"n\": \"1\", \"v\": $number(data), \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'DEVICE' and $exists(data.networkInfo)", "transform": "[\n {\"bn\": \"14203/0/\", \"n\": \"0\", \"vs\": data.networkInfo.networkMode, \"bt\": ts },\n {\"n\": \"1\", \"v\": data.networkInfo.currentBand },\n {\"n\": \"2\", \"v\": data.networkInfo.rsrp },\n {\"n\": \"3\", \"v\": data.networkInfo.areaCode },\n {\"n\": \"4\", \"v\": data.networkInfo.cellID },\n {\"n\": \"5\", \"v\": data.networkInfo.mccmnc },\n {\"n\": \"6\", \"vs\": data.networkInfo.ipAddress },\n {\"n\": \"11\", \"v\": data.networkInfo.eest }\n]" }, { "type": TransformType.Messages, "match": "appId = 'AIR_PRESS'", "transform": "[\n {\"bn\": \"14205/0/\", \"n\": \"2\", \"v\": $number(data)*10, \"bt\": ts }\n]" }, { "type": TransformType.Messages, "match": "appId = 'TEMP'", "transform": "[\n {\"bn\": \"14205/0/\", \"n\": \"0\", \"v\": $number(data), \"bt\": ts }\n]" }], "about": { "title": "Thingy:91 with Solar Shield", "description": "The Nordic Thingy:91 Solar Shield is a plug-and-play prototyping platform. Powerfoyle solar cell is mounted onto the Thingy to quickly get started exploring the endless possibilities with solar powered IoT applications and to develop products with eternal life or even battery-free products.\u200B\nThe Thingy:91 runs the asset_tracker_v2 application and sends messages to nRF Cloud using MQTT." } }, [ModelID.Asset_tracker_v2_AWS]: { "id": ModelID.Asset_tracker_v2_AWS, "transforms": [{ "type": TransformType.Shadow, "match": "$exists(state.reported.gnss)", "transform": "[\n {\"bn\": \"14201/0/\", \"n\": \"0\", \"v\": state.reported.gnss.v.lat, \"bt\": state.reported.gnss.ts },\n {\"n\": \"1\", \"v\": state.reported.gnss.v.lng },\n {\"n\": \"2\", \"v\": state.reported.gnss.v.alt },\n {\"n\": \"3\", \"v\": state.reported.gnss.v.acc },\n {\"n\": \"4\", \"v\": state.reported.gnss.v.spd },\n {\"n\": \"5\", \"v\": state.reported.gnss.v.hdg },\n {\"n\": \"6\", \"vs\": \"GNSS\" }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.bat)", "transform": "[\n {\"bn\": \"14202/0/\", \"n\": \"1\", \"v\": state.reported.bat.v/1000, \"bt\": state.reported.bat.ts }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.dev)", "transform": "[\n {\"bn\": \"14204/0/\", \"n\": \"0\", \"vs\": state.reported.dev.v.imei, \"bt\": state.reported.dev.ts },\n {\"n\": \"1\", \"vs\": state.reported.dev.v.iccid },\n {\"n\": \"2\", \"vs\": state.reported.dev.v.modV },\n {\"n\": \"3\", \"vs\": state.reported.dev.v.appV },\n {\"n\": \"4\", \"vs\": state.reported.dev.v.brdV }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.env)", "transform": "[\n {\"bn\": \"14205/0/\", \"n\": \"0\", \"v\": state.reported.env.v.temp, \"bt\": state.reported.env.ts },\n {\"n\": \"1\", \"v\": state.reported.env.v.hum },\n {\"n\": \"2\", \"v\": state.reported.env.v.atmp },\n {\"n\": \"10\", \"v\": state.reported.env.v.bsec_iaq }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.fg)", "transform": "[\n {\"bn\": \"14202/0/\", \"n\": \"0\", \"v\": state.reported.fg.v.SoC, \"bt\": state.reported.fg.ts },\n {\"n\": \"1\", \"v\": state.reported.fg.v.V/1000 },\n {\"n\": \"2\", \"v\": state.reported.fg.v.I },\n {\"n\": \"3\", \"v\": state.reported.fg.v.T = null ? null : state.reported.fg.v.T/10 },\n {\"n\": \"4\", \"v\": state.reported.fg.v.TTF },\n {\"n\": \"5\", \"v\": state.reported.fg.v.TTE }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.roam)", "transform": "[\n {\"bn\": \"14203/0/\", \"n\": \"0\", \"vs\": state.reported.roam.v.nw, \"bt\": state.reported.roam.ts },\n {\"n\": \"1\", \"v\": state.reported.roam.v.band },\n {\"bn\": \"14203/0/\", \"n\": \"2\", \"v\": state.reported.roam.v.rsrp, \"bt\": state.reported.roam.ts },\n {\"n\": \"3\", \"v\": state.reported.roam.v.area },\n {\"n\": \"4\", \"v\": state.reported.roam.v.cell },\n {\"n\": \"5\", \"v\": state.reported.roam.v.mccmnc },\n {\"n\": \"6\", \"vs\": state.reported.roam.v.ip },\n {\"bn\": \"14203/0/\", \"n\": \"11\", \"v\": state.reported.roam.v.eest, \"bt\": state.reported.roam.ts }\n]" }, { "type": TransformType.Shadow, "match": "$exists(state.reported.sol)", "transform": "[\n {\"bn\": \"14210/0/\", \"n\": \"0\", \"v\": state.reported.sol.v.gain, \"bt\": state.reported.sol.ts },\n {\"n\": \"1\", \"v\": state.reported.sol.v.bat }\n]" }], "about": { "title": "asset_tracker_v2 on AWS", "description": "This implements the conversion for the asset_tracker_v2 message protocol when connected to AWS IoT." } }, [ModelID.Kartverket_vasstandsdata]: { "id": ModelID.Kartverket_vasstandsdata, "transforms": [], "about": { "title": "Kartverket Vasstandsdata", "description": "A simulated device reporting the current sea level as provided by the Kartverket's (Norwegian Mapping Authority) API for vasstandsdata (API for water level data).\nReports sea water level using the Object 14230.\nThe data is licensed by the Norwegian Mapping Authority\u2019s under the Creative Commons Attribution 4.0 International (CC BY 4.0) license." } } } as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hello.nrfcloud.com/proto-map",
3
- "version": "4.0.5",
3
+ "version": "5.0.1",
4
4
  "description": "Documents the communication protocol between devices, the hello.nrfcloud.com/map backend and web application",
5
5
  "type": "module",
6
6
  "exports": {
@@ -32,11 +32,11 @@
32
32
  },
33
33
  "scripts": {
34
34
  "prepare": "husky",
35
- "test": "find ./ -type f -name \\*.spec.ts -not -path './node_modules/*' | xargs npx tsx --test --test-reporter spec",
35
+ "test": "npx globstar -- npx tsx --test --test-reporter spec \"!(node_modules)/**/*.spec.ts\"",
36
36
  "prepublishOnly": "./compile.sh"
37
37
  },
38
38
  "devDependencies": {
39
- "@bifravst/eslint-config-typescript": "6.0.14",
39
+ "@bifravst/eslint-config-typescript": "6.0.15",
40
40
  "@bifravst/prettier-config": "1.0.0",
41
41
  "@commitlint/config-conventional": "19.1.0",
42
42
  "@swc/cli": "0.3.10",
@@ -44,6 +44,7 @@
44
44
  "@types/node": "20.11.30",
45
45
  "@types/xml2js": "0.4.14",
46
46
  "chalk": "5.3.0",
47
+ "globstar": "1.0.0",
47
48
  "husky": "9.0.11",
48
49
  "lint-staged": "15.2.2",
49
50
  "prettier-plugin-organize-imports": "3.2.4",
@@ -104,7 +105,7 @@
104
105
  "lwm2m"
105
106
  ],
106
107
  "dependencies": {
107
- "@sinclair/typebox": "0.32.17",
108
+ "@sinclair/typebox": "0.32.18",
108
109
  "ajv": "8.12.0",
109
110
  "jsonata": "2.0.4"
110
111
  }
@@ -7,7 +7,7 @@ void describe('SenMLType', () => {
7
7
  void it('it should validate a SenML payload', () => {
8
8
  const example: SenMLType = [
9
9
  {
10
- bn: '/14201/0/',
10
+ bn: '14201/0/',
11
11
  n: '0',
12
12
  v: 33.98755678796222,
13
13
  bt: 1698155694999,
@@ -57,15 +57,15 @@ void describe('lwm2mToSenML()', () => {
57
57
  level3,
58
58
  ]
59
59
  const expected: SenMLType = [
60
- { bn: '/14201/0/', n: '0', v: 62.469414, bt: 1710147413003 },
60
+ { bn: '14201/0/', n: '0', v: 62.469414, bt: 1710147413003 },
61
61
  { n: '1', v: 6.151946 },
62
62
  { n: '3', v: 1 },
63
63
  { n: '6', vs: 'Fixed' },
64
- { bn: '/14230/0/', n: '0', v: 84.3, bt: 1710140400000 },
64
+ { bn: '14230/0/', n: '0', v: 84.3, bt: 1710140400000 },
65
65
  { n: '1', vs: 'AES' },
66
- { bn: '/14230/0/', n: '0', v: 140.4, bt: 1710144000000 },
66
+ { bn: '14230/0/', n: '0', v: 140.4, bt: 1710144000000 },
67
67
  { n: '1', vs: 'AES' },
68
- { bn: '/14230/1/', n: '0', v: 140.7, bt: 1710144001000 },
68
+ { bn: '14230/1/', n: '0', v: 140.7, bt: 1710144001000 },
69
69
  { n: '1', vs: 'AES' },
70
70
  ]
71
71
 
@@ -30,7 +30,7 @@ const asSenML = (lwm2m: LwM2MObjectInstance<any>): SenMLType | null => {
30
30
  if (first === undefined) return null
31
31
  return [
32
32
  {
33
- bn: `/${lwm2m.ObjectID}/${lwm2m.ObjectInstanceID ?? 0}/`,
33
+ bn: `${lwm2m.ObjectID}/${lwm2m.ObjectInstanceID ?? 0}/`,
34
34
  n: first[0],
35
35
  [toKey(def, parseInt(first[0], 10))]: first[1],
36
36
  bt: i.getTime(),
@@ -4,7 +4,7 @@ import { parseResourceId } from './parseResourceId.js'
4
4
 
5
5
  void describe('parseResourceId()', () => {
6
6
  void it('should parse an LwM2M resource ID', () =>
7
- assert.deepEqual(parseResourceId('/14201/1/2/0'), {
7
+ assert.deepEqual(parseResourceId('14201/1/2/0'), {
8
8
  ObjectID: 14201,
9
9
  ObjectInstanceID: 1,
10
10
  ResourceID: 2,
@@ -6,13 +6,15 @@ export type ResourceID = {
6
6
  }
7
7
 
8
8
  export const parseResourceId = (resourceId: string): ResourceID | null => {
9
- if (!/^\/\d+\/\d+\/\d+\/\d+$/.test(resourceId)) return null
9
+ if (!/^\d+\/\d+\/\d+\/\d+$/.test(resourceId)) return null
10
10
 
11
11
  const [ObjectID, ObjectInstanceID, ResourceID, ResourceInstanceId] =
12
- resourceId
13
- .slice(1)
14
- .split('/')
15
- .map((s) => parseInt(s, 10)) as [number, number, number, number]
12
+ resourceId.split('/').map((s) => parseInt(s, 10)) as [
13
+ number,
14
+ number,
15
+ number,
16
+ number,
17
+ ]
16
18
 
17
19
  return {
18
20
  ObjectID,
@@ -7,7 +7,7 @@ void describe('senMLtoLwM2M()', () => {
7
7
  void it('should resolve a senML message into objects', () => {
8
8
  const input: SenMLType = [
9
9
  {
10
- bn: '/14201/1/',
10
+ bn: '14201/1/',
11
11
  blv: '1.1',
12
12
  bt: 1698155694999,
13
13
  n: '0',
@@ -56,7 +56,7 @@ void describe('senMLtoLwM2M()', () => {
56
56
  void it('should drop empty resources', () => {
57
57
  const input: SenMLType = [
58
58
  {
59
- bn: '/14203/0/',
59
+ bn: '14203/0/',
60
60
  n: '0',
61
61
  vs: 'LTE-M',
62
62
  bt: 1676369307222,
@@ -109,14 +109,14 @@ void describe('senMLtoLwM2M()', () => {
109
109
 
110
110
  void it('should ignore repeated base properties', () => {
111
111
  const input: SenMLType = [
112
- { bn: '/14203/0/', n: '0', vs: 'LTE-M', bt: 1699049665511 },
112
+ { bn: '14203/0/', n: '0', vs: 'LTE-M', bt: 1699049665511 },
113
113
  { n: '1', v: 20 },
114
- { bn: '/14203/0/', n: '2', v: -89, bt: 1699049665511 },
114
+ { bn: '14203/0/', n: '2', v: -89, bt: 1699049665511 },
115
115
  { n: '3', v: 2305 },
116
116
  { n: '4', v: 34784790 },
117
117
  { n: '5', v: 24202 },
118
118
  { n: '6', vs: '100.81.95.75' },
119
- { bn: '/14203/0/', n: '11', v: 7, bt: 1699049665511 },
119
+ { bn: '14203/0/', n: '11', v: 7, bt: 1699049665511 },
120
120
  ]
121
121
  const expected: LwM2MObjectInstance[] = [
122
122
  {
@@ -139,10 +139,10 @@ void describe('senMLtoLwM2M()', () => {
139
139
 
140
140
  void it('should handle multiple measurements for the same resource', () => {
141
141
  const input: SenMLType = [
142
- { bn: '/14205/0/', n: '0', v: 21, bt: 1699049600000 },
143
- { bn: '/14205/1/', n: '0', v: 31, bt: 1699049600000 },
144
- { bn: '/14205/0/', n: '0', v: 22, bt: 1699049700000 },
145
- { bn: '/14205/1/', n: '0', v: 32, bt: 1699049700000 },
142
+ { bn: '14205/0/', n: '0', v: 21, bt: 1699049600000 },
143
+ { bn: '14205/1/', n: '0', v: 31, bt: 1699049600000 },
144
+ { bn: '14205/0/', n: '0', v: 22, bt: 1699049700000 },
145
+ { bn: '14205/1/', n: '0', v: 32, bt: 1699049700000 },
146
146
  ]
147
147
  const expected: LwM2MObjectInstance[] = [
148
148
  {
@@ -6,7 +6,7 @@ import type { SenMLType } from './SenMLSchema.js'
6
6
  void describe('validateSenML()', () => {
7
7
  void it('should validate', () => {
8
8
  const senMl: SenMLType = [
9
- { bn: '/14202/1/', blv: '1.1', n: '0', v: 99, bt: 1699049685992 },
9
+ { bn: '14202/1/', blv: '1.1', n: '0', v: 99, bt: 1699049685992 },
10
10
  { n: '1', v: 4.179 },
11
11
  { n: '2', v: 0 },
12
12
  { n: '3', v: 25.7 },