signalk-czone 0.3.0-beta.10 → 0.3.0-beta.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0-beta.11
4
+
5
+ - Routes circuit current to known physical output owners instead of groups referencing those outputs, restoring Starlink current and correcting Port Fresh Water Pump and Meitaki Nav. AIS attribution.
6
+ - Preserves existing current mappings when output ownership is ambiguous and adds regression coverage across all six ZCF fixtures.
7
+
3
8
  ## 0.3.0-beta.10
4
9
 
5
10
  - Adds opt-in circuit current trends with preset and custom chart periods, CSV storage, summaries and retention settings.
package/index.js CHANGED
@@ -559,11 +559,8 @@ module.exports = function (app) {
559
559
  if (!mapping || !Array.isArray(mapping.circuits)) return null
560
560
  if (pgn === CURRENT_PGN_AC && Number(module) !== 0xF8) return null
561
561
  if (pgn === CURRENT_PGN_DC && Number(module) === 0x28) return null
562
- return mapping.circuits.find(c =>
563
- Number(c.module) === Number(module) &&
564
- Number(c.page) === Number(page) &&
565
- Number(c.slot) === Number(slot)
566
- ) || null
562
+ return zcf.lookup(mapping, module, page, slot,
563
+ pgn === CURRENT_PGN_CONTROL_X_PLUS ? CURRENT_PGN_DC : pgn)
567
564
  }
568
565
 
569
566
  function publishSettingsRevision () {
package/lib/zcf.js CHANGED
@@ -64,6 +64,14 @@ function enrichRuntimeModel (mapping) {
64
64
  mapping.currentMappings = mapping.circuits
65
65
  .map(circuit => {
66
66
  if (Number(circuit.module) === 0x28) return null
67
+ // Group/virtual circuits can reference another circuit's primary load.
68
+ // Prefer a known owner, preserving existing resolution where ownership
69
+ // is ambiguous (for example multiple controls for the same load).
70
+ if (Array.isArray(circuit.ownOutputs) && !circuit.ownOutputs.length &&
71
+ mapping.circuits.some(owner => Array.isArray(owner.ownOutputs) &&
72
+ owner.ownOutputs.some(output =>
73
+ output.module === circuit.module && output.channel === circuit.channel
74
+ ))) return null
67
75
  return {
68
76
  ...circuit,
69
77
  pgn: Number(circuit.module) === 0xF8 ? CURRENT_PGN_AC : CURRENT_PGN_DC,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-czone",
3
- "version": "0.3.0-beta.10",
3
+ "version": "0.3.0-beta.11",
4
4
  "description": "BETA: Signal K CZone monitoring and control using dynamically parsed ZCF configuration and NMEA 2000",
5
5
  "main": "index.js",
6
6
  "keywords": [