nausto-signalk 0.3.0 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +9 -3
  2. package/package.json +1 -1
  3. package/plugin.cjs +63 -5
package/README.md CHANGED
@@ -13,7 +13,7 @@ active crew members can read the selected values and history.
13
13
  ## Connect
14
14
 
15
15
  1. Install `nausto-signalk` through Signal K's AppStore, or install the supplied
16
- `.tgz` with `npm install /path/to/nausto-signalk-0.3.0.tgz` from your Signal K configuration directory.
16
+ `.tgz` with `npm install /path/to/nausto-signalk-0.4.0.tgz` from your Signal K configuration directory.
17
17
  2. Enable **Nausto** in Plugin Config. Open **Nausto** under Webapps and sign in to Signal K as an administrator.
18
18
  3. In Nausto, open Boat → Sensors, create a connection and copy its pairing code, or save its QR image.
19
19
  4. Enter the eight-character code, paste a copied code or import the QR image in the plugin. Older
@@ -35,8 +35,14 @@ trying again. An identical retry after a lost response does not spend another at
35
35
 
36
36
  Only `vessels.self` is read. Battery voltage, current, power, consumed charge, state of charge,
37
37
  time remaining, temperature and water
38
- notifications are discovered from standard Signal K paths. Additional own-vessel paths can be mapped
39
- in the advanced plugin settings. Unsupported units or source identities are reported in plugin status.
38
+ notifications are discovered from standard Signal K paths. So are each engine's total running
39
+ hours, engine speed and coolant temperature (`propulsion.<engine>.runTime`, `.revolutions` and
40
+ `.temperature`), from an engine gateway or an engine monitoring unit on NMEA 2000. The engine's
41
+ label in Signal K names the sensors; give the engine the same name in Nausto, and Nausto suggests
42
+ it under Part of. Fuel used (`propulsion.<engine>.fuel.used`) is not offered automatically, because
43
+ Signal K does not say whether it is measured; map it explicitly as measured volume when it comes
44
+ from a fuel flow meter. Additional own-vessel paths can be mapped in the advanced plugin settings.
45
+ Unsupported units or source identities are reported in plugin status.
40
46
  Explicit advanced mappings also support cumulative energy (J), pressure (Pa), volume (m³),
41
47
  volume flow (m³/s), acceleration (m/s²) and nonnegative integer counts. Known units such as
42
48
  Wh/kWh, hPa/bar and litres are converted to SI. A percentage is never guessed to be a volume,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nausto-signalk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Connect selected Signal K boat sensors to Nausto with pairing and durable delivery",
5
5
  "main": "index.cjs",
6
6
  "files": [
package/plugin.cjs CHANGED
@@ -189,6 +189,11 @@ var SENSOR_PLACE_NAMES = [
189
189
  "outside",
190
190
  "custom"
191
191
  ];
192
+ var SENSOR_MODEL_POINT = {
193
+ keyPattern: "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
194
+ keyLength: 64,
195
+ meters: 100
196
+ };
192
197
  var text$1 = (maxLength) => ({
193
198
  type: "string",
194
199
  minLength: 1,
@@ -351,6 +356,11 @@ var coordinate = nullable({
351
356
  minimum: 0,
352
357
  maximum: 1
353
358
  });
359
+ var meters = nullable({
360
+ type: "number",
361
+ minimum: -SENSOR_MODEL_POINT.meters,
362
+ maximum: SENSOR_MODEL_POINT.meters
363
+ });
354
364
  var channelIds = (maxItems) => ({
355
365
  type: "array",
356
366
  minItems: 0,
@@ -377,8 +387,24 @@ object$1({
377
387
  place: nullable({ enum: SENSOR_PLACE_NAMES }),
378
388
  custom_place: nullable(text$1(80)),
379
389
  layout_x: coordinate,
380
- layout_y: coordinate
381
- }, ["layout_x", "layout_y"]), object$1({
390
+ layout_y: coordinate,
391
+ model_key: nullable({
392
+ type: "string",
393
+ minLength: 1,
394
+ maxLength: SENSOR_MODEL_POINT.keyLength,
395
+ pattern: SENSOR_MODEL_POINT.keyPattern
396
+ }),
397
+ model_x: meters,
398
+ model_y: meters,
399
+ model_z: meters
400
+ }, [
401
+ "layout_x",
402
+ "layout_y",
403
+ "model_key",
404
+ "model_x",
405
+ "model_y",
406
+ "model_z"
407
+ ]), object$1({
382
408
  action: { const: "capacity" },
383
409
  component_id: uuid$1,
384
410
  expected_version: nullable(version),
@@ -444,7 +470,11 @@ var words = {
444
470
  outside: "Uteluft",
445
471
  water: "Sjøvann",
446
472
  inside: "Om bord",
447
- bilge: "Vannalarm fra Signal K"
473
+ bilge: "Vannalarm fra Signal K",
474
+ engine: "Motor",
475
+ runTime: "Samlet driftstid",
476
+ revolutions: "Turtall",
477
+ coolant: "Kjølevann"
448
478
  },
449
479
  en: {
450
480
  battery: "Battery",
@@ -458,7 +488,11 @@ var words = {
458
488
  outside: "Outside air",
459
489
  water: "Sea water",
460
490
  inside: "On board",
461
- bilge: "Water alarm from Signal K"
491
+ bilge: "Water alarm from Signal K",
492
+ engine: "Engine",
493
+ runTime: "Running hours",
494
+ revolutions: "Engine speed",
495
+ coolant: "Coolant temperature"
462
496
  }
463
497
  };
464
498
  function ownPath(path) {
@@ -524,6 +558,29 @@ function mappingFor(path, locale, label, custom = []) {
524
558
  provenance: kind.provenance
525
559
  };
526
560
  }
561
+ const engine = /^propulsion\.([^.]+)\.(runTime|revolutions|temperature)$/.exec(path);
562
+ if (engine) {
563
+ const kind = {
564
+ runTime: {
565
+ quantity: "duration",
566
+ label: "runTime"
567
+ },
568
+ revolutions: {
569
+ quantity: "rotation",
570
+ label: "revolutions"
571
+ },
572
+ temperature: {
573
+ quantity: "temperature",
574
+ label: "coolant"
575
+ }
576
+ }[engine[2]];
577
+ return {
578
+ name: `${label ?? `${text.engine} ${engine[1]}`} · ${text[kind.label]}`,
579
+ quantity: kind.quantity,
580
+ unit: SENSOR_QUANTITIES[kind.quantity].unit,
581
+ provenance: "measured"
582
+ };
583
+ }
527
584
  const inside = /^environment\.inside\.([^.]+)\.temperature$/.exec(path);
528
585
  if (inside || ["environment.outside.temperature", "environment.water.temperature"].includes(path)) return {
529
586
  name: `${label ?? (inside ? inside[1] : path.includes(".outside.") ? text.outside : text.water)} · ${text.temperature}`,
@@ -676,7 +733,8 @@ var roots = [
676
733
  "environment.inside",
677
734
  "environment.outside",
678
735
  "environment.water",
679
- "notifications"
736
+ "notifications",
737
+ "propulsion"
680
738
  ];
681
739
  var blocked = new Set([
682
740
  "__proto__",