nausto-signalk 0.1.0 → 0.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 +24 -3
- package/package.json +1 -1
- package/plugin.cjs +70 -15
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.
|
|
16
|
+
`.tgz` with `npm install /path/to/nausto-signalk-0.2.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. Paste the code or import the QR image in the plugin. Return to Nausto, choose the discovered sensors,
|
|
@@ -26,13 +26,34 @@ Revoke a connection in Nausto to stop its access. Plugin configuration never con
|
|
|
26
26
|
|
|
27
27
|
## Data and limits
|
|
28
28
|
|
|
29
|
-
Only `vessels.self` is read. Battery voltage, current,
|
|
29
|
+
Only `vessels.self` is read. Battery voltage, current, power, consumed charge, state of charge,
|
|
30
|
+
time remaining, temperature and water
|
|
30
31
|
notifications are discovered from standard Signal K paths. Additional own-vessel paths can be mapped
|
|
31
32
|
in the advanced plugin settings. Unsupported units or source identities are reported in plugin status.
|
|
32
33
|
NMEA 2000 source addresses are not device identity: CAN NAME is required. Plugin sources are treated
|
|
33
|
-
as virtual sources scoped to this installation
|
|
34
|
+
as virtual sources scoped to this installation, including Bluetooth sources with a source address.
|
|
35
|
+
Fixed identities for other non-NMEA providers can be
|
|
34
36
|
configured explicitly; a source name or IP alone is never treated as a physical device identifier.
|
|
35
37
|
|
|
38
|
+
## Victron battery monitors
|
|
39
|
+
|
|
40
|
+
Use existing standard Signal K battery data first. BMV-712 Smart data can come from an existing
|
|
41
|
+
VE.Direct collector, or from a compatible Bluetooth Instant Readout collector such as
|
|
42
|
+
[signalk-victron-ble](https://github.com/stefanor/signalk-victron-ble).
|
|
43
|
+
That collector is separate from Nausto; follow its supported hardware and Python/Bluetooth requirements.
|
|
44
|
+
Keep the Victron encryption key only in that collector's local configuration. Nausto never needs it.
|
|
45
|
+
|
|
46
|
+
Select the actual battery bank in the collector and confirm the same component in Nausto.
|
|
47
|
+
Positive battery current means charging and negative current means discharging; it is net current,
|
|
48
|
+
not the charger's output current. SOC and time remaining are estimates, power is calculated,
|
|
49
|
+
and consumed charge is stored in coulombs and displayed in Ah. Optional temperature and secondary
|
|
50
|
+
battery voltage appear only when the collector is configured for them and actually publishes them.
|
|
51
|
+
Bluetooth availability alone does not prove Instant Readout support. No GX, VRM or new gateway is required.
|
|
52
|
+
|
|
53
|
+
When another integration supplies the same bank, choose its existing component and explicitly set
|
|
54
|
+
one primary source per quantity in Nausto. A newer secondary reading does not take over automatically.
|
|
55
|
+
Upgrading this package preserves the existing pairing, selections and channel identities.
|
|
56
|
+
|
|
36
57
|
Numeric values are sampled at most once per minute per channel. State/alarm changes are preserved.
|
|
37
58
|
Original source time, null values and units are retained. A heartbeat never makes an old reading new.
|
|
38
59
|
An undated cached value is not sent as a fresh measurement after a restart. A batch window starts
|
package/package.json
CHANGED
package/plugin.cjs
CHANGED
|
@@ -61,6 +61,14 @@ var SENSOR_QUANTITIES = {
|
|
|
61
61
|
unit: "A",
|
|
62
62
|
kind: "number"
|
|
63
63
|
},
|
|
64
|
+
power: {
|
|
65
|
+
unit: "W",
|
|
66
|
+
kind: "number"
|
|
67
|
+
},
|
|
68
|
+
charge: {
|
|
69
|
+
unit: "C",
|
|
70
|
+
kind: "number"
|
|
71
|
+
},
|
|
64
72
|
temperature: {
|
|
65
73
|
unit: "K",
|
|
66
74
|
kind: "number"
|
|
@@ -265,6 +273,9 @@ var words = {
|
|
|
265
273
|
battery: "Batteri",
|
|
266
274
|
voltage: "Spenning",
|
|
267
275
|
current: "Strøm",
|
|
276
|
+
power: "Effekt",
|
|
277
|
+
consumed: "Forbrukt ladning",
|
|
278
|
+
remaining: "Tid igjen",
|
|
268
279
|
temperature: "Temperatur",
|
|
269
280
|
charge: "Ladetilstand",
|
|
270
281
|
outside: "Uteluft",
|
|
@@ -276,6 +287,9 @@ var words = {
|
|
|
276
287
|
battery: "Battery",
|
|
277
288
|
voltage: "Voltage",
|
|
278
289
|
current: "Current",
|
|
290
|
+
power: "Power",
|
|
291
|
+
consumed: "Consumed charge",
|
|
292
|
+
remaining: "Time remaining",
|
|
279
293
|
temperature: "Temperature",
|
|
280
294
|
charge: "State of charge",
|
|
281
295
|
outside: "Outside air",
|
|
@@ -301,16 +315,50 @@ function mappingFor(path, locale, label, custom = []) {
|
|
|
301
315
|
notification: path.startsWith("notifications.") && configured.quantity === "alarm"
|
|
302
316
|
};
|
|
303
317
|
const text = words[locale];
|
|
304
|
-
const battery = /^electrical\.batteries\.([^.]+)\.(voltage|current|temperature|capacity\.stateOfCharge)$/.exec(path);
|
|
318
|
+
const battery = /^electrical\.batteries\.([^.]+)\.(voltage|current|power|temperature|capacity\.(?:stateOfCharge|dischargeSinceFull|timeRemaining))$/.exec(path);
|
|
305
319
|
if (battery) {
|
|
306
|
-
const kind =
|
|
307
|
-
|
|
308
|
-
|
|
320
|
+
const kind = {
|
|
321
|
+
voltage: {
|
|
322
|
+
quantity: "voltage",
|
|
323
|
+
label: "voltage",
|
|
324
|
+
provenance: "measured"
|
|
325
|
+
},
|
|
326
|
+
current: {
|
|
327
|
+
quantity: "current",
|
|
328
|
+
label: "current",
|
|
329
|
+
provenance: "measured"
|
|
330
|
+
},
|
|
331
|
+
power: {
|
|
332
|
+
quantity: "power",
|
|
333
|
+
label: "power",
|
|
334
|
+
provenance: "calculated"
|
|
335
|
+
},
|
|
336
|
+
temperature: {
|
|
337
|
+
quantity: "temperature",
|
|
338
|
+
label: "temperature",
|
|
339
|
+
provenance: "measured"
|
|
340
|
+
},
|
|
341
|
+
"capacity.stateOfCharge": {
|
|
342
|
+
quantity: "ratio",
|
|
343
|
+
label: "charge",
|
|
344
|
+
provenance: "estimated"
|
|
345
|
+
},
|
|
346
|
+
"capacity.dischargeSinceFull": {
|
|
347
|
+
quantity: "charge",
|
|
348
|
+
label: "consumed",
|
|
349
|
+
provenance: "estimated"
|
|
350
|
+
},
|
|
351
|
+
"capacity.timeRemaining": {
|
|
352
|
+
quantity: "duration",
|
|
353
|
+
label: "remaining",
|
|
354
|
+
provenance: "estimated"
|
|
355
|
+
}
|
|
356
|
+
}[battery[2]];
|
|
309
357
|
return {
|
|
310
|
-
name: `${
|
|
311
|
-
quantity,
|
|
312
|
-
unit: SENSOR_QUANTITIES[quantity].unit,
|
|
313
|
-
provenance:
|
|
358
|
+
name: `${label ?? `${text.battery} ${battery[1]}`} · ${text[kind.label]}`,
|
|
359
|
+
quantity: kind.quantity,
|
|
360
|
+
unit: SENSOR_QUANTITIES[kind.quantity].unit,
|
|
361
|
+
provenance: kind.provenance
|
|
314
362
|
};
|
|
315
363
|
}
|
|
316
364
|
const inside = /^environment\.inside\.([^.]+)\.temperature$/.exec(path);
|
|
@@ -368,6 +416,10 @@ function canonicalNumber(quantity, unit, value) {
|
|
|
368
416
|
else if (quantity === "angle" && ["deg", "°"].includes(unit)) result = value * Math.PI / 180;
|
|
369
417
|
else if (quantity === "rotation" && ["rpm", "RPM"].includes(unit)) result = value / 60;
|
|
370
418
|
else if (quantity === "duration" && unit === "h") result = value * 3600;
|
|
419
|
+
else if (quantity === "duration" && unit === "min") result = value * 60;
|
|
420
|
+
else if (quantity === "power" && unit === "kW") result = value * 1e3;
|
|
421
|
+
else if (quantity === "charge" && unit === "Ah") result = value * 3600;
|
|
422
|
+
else if (quantity === "charge" && unit === "mAh") result = value * 3.6;
|
|
371
423
|
else return null;
|
|
372
424
|
return Number.isFinite(result) && Math.abs(result) <= 0xe8d4a51000 ? result : null;
|
|
373
425
|
}
|
|
@@ -391,11 +443,13 @@ function sourceIdentity(app, reference, incoming, bindings) {
|
|
|
391
443
|
const label = Object.keys(registry).slice(0, 512).sort((a, b) => b.length - a.length).find((key) => ref === key || ref?.startsWith(`${key}.`));
|
|
392
444
|
const group = label ? record(registry[label]) : null;
|
|
393
445
|
const suffix = label && ref?.startsWith(`${label}.`) ? ref.slice(label.length + 1) : null;
|
|
446
|
+
const n2k = group && suffix ? Object.entries(group).slice(0, 256).map(([key, value]) => {
|
|
447
|
+
const descriptor = record(record(value)?.n2k);
|
|
448
|
+
return descriptor && (key === suffix || String(descriptor.src) === suffix || canName(descriptor.canName) === suffix) ? descriptor : null;
|
|
449
|
+
}).find((entry) => entry !== null) : null;
|
|
394
450
|
const descriptor = {
|
|
395
|
-
...
|
|
396
|
-
|
|
397
|
-
return descriptor && (key === suffix || String(descriptor.src) === suffix || canName(descriptor.canName) === suffix) ? descriptor : null;
|
|
398
|
-
}).find((entry) => entry !== null) : null) ?? group,
|
|
451
|
+
...group,
|
|
452
|
+
...n2k,
|
|
399
453
|
...raw
|
|
400
454
|
};
|
|
401
455
|
const permanent = canName(descriptor?.canName);
|
|
@@ -406,7 +460,8 @@ function sourceIdentity(app, reference, incoming, bindings) {
|
|
|
406
460
|
vendor: shortText(descriptor?.manufacturer) ?? "NMEA 2000",
|
|
407
461
|
virtual: false
|
|
408
462
|
};
|
|
409
|
-
|
|
463
|
+
const virtualKind = descriptor.type === "plugin" ? "plugin" : descriptor.type === "Bluetooth" ? "bluetooth" : null;
|
|
464
|
+
if (descriptor?.type === "NMEA2000" || descriptor?.src !== void 0 && !virtualKind || group?.type === "NMEA2000") return null;
|
|
410
465
|
if (!ref) return null;
|
|
411
466
|
const binding = bindings.find((entry) => entry.reference === ref);
|
|
412
467
|
if (binding) return {
|
|
@@ -416,8 +471,8 @@ function sourceIdentity(app, reference, incoming, bindings) {
|
|
|
416
471
|
vendor: "Signal K",
|
|
417
472
|
virtual: true
|
|
418
473
|
};
|
|
419
|
-
if (
|
|
420
|
-
key:
|
|
474
|
+
if (virtualKind) return {
|
|
475
|
+
key: `${virtualKind}:${ref}`,
|
|
421
476
|
reference: ref,
|
|
422
477
|
name: shortText(descriptor.label) ?? ref,
|
|
423
478
|
vendor: "Signal K",
|