@meri-imperiumi/signalk-meshtastic 1.1.2 → 1.2.0

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.
package/README.md CHANGED
@@ -91,6 +91,10 @@ Metrics used:
91
91
 
92
92
  ## Changes
93
93
 
94
+ * 1.2.0 (2025-09-28)
95
+ - Safety for nodes in DB that don't have a "last seen" timestamp
96
+ - Made connection status notifications clearer
97
+ - Attempt at support for Node.js older than 22.x
94
98
  * 1.1.2 (2025-09-25)
95
99
  - Added support for the new roles from Meshtastic 2.7 (`ROUTER_LATE` and `CLIENT_BASE`)
96
100
  - Fixed issue with sending a bell with alerts that have sound enabled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meri-imperiumi/signalk-meshtastic",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Signal K plugin for interfacing with the Meshtastic LoRa mesh network",
5
5
  "scripts": {
6
6
  "test": "eslint ."
package/plugin/index.js CHANGED
@@ -5,6 +5,13 @@ const Telemetry = require('./telemetry');
5
5
  const commands = require('./commands/index');
6
6
  const { vesselIcon } = require('./waypoint');
7
7
 
8
+ if (!global.crypto) {
9
+ // Older Node.js versions (like the one bundled in Venus OS
10
+ // don't have crypto module available
11
+ // eslint-disable-next-line global-require
12
+ global.crypto = require('node:crypto');
13
+ }
14
+
8
15
  // The ES modules we'll need to import
9
16
  let MeshDevice;
10
17
  let TransportHTTP;
@@ -312,6 +319,10 @@ module.exports = (app) => {
312
319
  // Ignore own node
313
320
  return false;
314
321
  }
322
+ if (!nodes[nodeId].seen) {
323
+ // Somehow never seen
324
+ return false;
325
+ }
315
326
  // Online treshold, should be same as NUM_ONLINE_SECS in Meshtastic fw
316
327
  const onlineSecs = 60 * 60 * 2;
317
328
  if (nodes[nodeId].seen.getTime() > now.getTime() - (onlineSecs * 1000)) {
@@ -463,13 +474,13 @@ module.exports = (app) => {
463
474
  state: 'warn',
464
475
  lower: 0,
465
476
  upper: 5,
466
- message: 'Not connected to device',
477
+ message: 'Not connected to Meshtastic device',
467
478
  },
468
479
  {
469
480
  state: 'nominal',
470
481
  lower: 7,
471
482
  upper: 8,
472
- message: 'Connected and configured',
483
+ message: 'Meshtastic connected and configured',
473
484
  },
474
485
  ],
475
486
  },
@@ -496,7 +507,9 @@ module.exports = (app) => {
496
507
  Object.keys(nodeDbData)
497
508
  .forEach((nodeNum) => {
498
509
  nodes[nodeNum] = nodeDbData[nodeNum];
499
- nodes[nodeNum].seen = new Date(nodeDbData[nodeNum].seen);
510
+ if (nodeDbData[nodeNum].seen) {
511
+ nodes[nodeNum].seen = new Date(nodeDbData[nodeNum].seen);
512
+ }
500
513
  });
501
514
  app.setPluginStatus(`Connecting to Meshtastic node ${settings.device.address}`);
502
515
  sendMeta();