signalk-czone 0.0.0-stage → 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 +25 -0
- package/LICENSE +21 -0
- package/README.md +424 -2
- package/icon.png +0 -0
- package/img/config.png +0 -0
- package/img/czone-circuits.png +0 -0
- package/img/diagnostics.png +0 -0
- package/img/grafana-example.png +0 -0
- package/index.js +1596 -0
- package/lib/circuit-state.js +52 -0
- package/lib/confirm-off.js +83 -0
- package/lib/czone.js +111 -0
- package/lib/monitoring.js +238 -0
- package/lib/nmea2000.js +215 -0
- package/lib/signalk.js +42 -0
- package/lib/trends/index.js +122 -0
- package/lib/trends/storage.js +431 -0
- package/lib/zcf-circuit-table.js +3 -0
- package/lib/zcf-status-table.js +3 -0
- package/lib/zcf.js +118 -0
- package/package.json +60 -4
- package/public/hero-bg.jpg +0 -0
- package/public/icon.png +0 -0
- package/public/index.html +1076 -0
- package/public/remoteEntry.js +376 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
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
|
+
|
|
8
|
+
## 0.3.0-beta.10
|
|
9
|
+
|
|
10
|
+
- Adds opt-in circuit current trends with preset and custom chart periods, CSV storage, summaries and retention settings.
|
|
11
|
+
- Restricts GX trend storage to mounted SD cards or USB sticks, including custom folders and card removal checks.
|
|
12
|
+
- Preserves live circuit amps through webapp refreshes, including when trend recording is disabled.
|
|
13
|
+
- Documents Cerbo GX SD card write permissions and persistent boot setup.
|
|
14
|
+
- Includes canonical test fixtures, repairs stale integration tests and tests simulated GX low-space operation.
|
|
15
|
+
|
|
16
|
+
## 0.3.0-beta.9
|
|
17
|
+
|
|
18
|
+
- Marks the App Store listing as CZone (BETA).
|
|
19
|
+
- Pins the shared ZCF parser to npm version 0.1.0-beta.1 instead of GitHub main.
|
|
20
|
+
- Lists the plugin in both digital switching and NMEA 2000 categories.
|
|
21
|
+
- Requires explicit enablement after initial configuration.
|
|
22
|
+
- Includes the App Store icon and changelog in the npm package.
|
|
23
|
+
- Updates beta installation instructions and repository/support metadata.
|
|
24
|
+
|
|
25
|
+
Earlier changes are documented in README.md.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,425 @@
|
|
|
1
|
-
#
|
|
1
|
+
# signalk-czone — BETA
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Beta software:** validate monitoring first, then test controls on a suitable noncritical circuit. Report issues at https://github.com/mattsmitchell/signalk-czone/issues.
|
|
4
|
+
|
|
5
|
+
`signalk-czone` makes CZone electrical current information available to Signal K.
|
|
6
|
+
|
|
7
|
+
It listens to NMEA 2000 traffic, identifies CZone current messages, reassembles their Fast Packets, decodes the AC and DC current measurements, and uses the vessel's CZone ZCF configuration to determine which circuit each measurement belongs to. The resulting currents are published to Signal K using stable circuit-name-based paths, with AC/DC classification metadata for downstream systems such as InfluxDB.
|
|
8
|
+
|
|
9
|
+
The plugin accepts both raw YDWG02-style NMEA 2000 frames and parsed JSON/object NMEA 2000 frames. It also provides a dedicated ZCF upload configuration panel and diagnostics/status reporting for monitoring the decoder.
|
|
10
|
+
|
|
11
|
+
In plain English: **it watches the NMEA 2000 network for CZone electrical data, turns the raw CZone measurements into amps, identifies the CZone circuit they belong to, and makes those currents available throughout Signal K.**
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
<img width="2826" height="1220" alt="Image" src="https://github.com/user-attachments/assets/2768aea9-cbcd-446b-8010-0ed0aabc1865" />
|
|
15
|
+
|
|
16
|
+
## What it does
|
|
17
|
+
|
|
18
|
+
The plugin:
|
|
19
|
+
|
|
20
|
+
- listens to NMEA 2000 traffic without modifying Signal K Server, canboatjs, n2k-signalk, or global PGN definitions;
|
|
21
|
+
- supports both raw YDWG02-style frames and parsed JSON/object NMEA 2000 frames;
|
|
22
|
+
- identifies CZone AC and DC current messages;
|
|
23
|
+
- reassembles CZone Fast Packets;
|
|
24
|
+
- validates the CZone `27 99` payload format;
|
|
25
|
+
- decodes PGN 130817 (AC/ACOI) and PGN 130822 (DC/COI);
|
|
26
|
+
- uses the configured ZCF to map measurements to named CZone circuits;
|
|
27
|
+
- publishes stable Signal K paths such as `electrical.czone.Water_Heater_Port.current`;
|
|
28
|
+
- carries AC/DC classification metadata as `CZone-AC` or `CZone-DC`;
|
|
29
|
+
- provides ZCF upload and configuration persistence; and
|
|
30
|
+
- provides diagnostics/status information for troubleshooting and field testing.
|
|
31
|
+
|
|
32
|
+
The plugin is therefore a **CZone electrical-current decoder and Signal K integration**, rather than a general-purpose NMEA 2000 decoder.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## ZCF tank definitions
|
|
37
|
+
|
|
38
|
+
The canonical `signalk-czone-zcf` parser also exposes tank-monitor definitions from the installed ZCF. These definitions include tank names, calibration points, capacity, alarm/switch thresholds, delays, enable bitmaps, and configured severity codes.
|
|
39
|
+
|
|
40
|
+
For validation and diagnostics, the plugin exposes:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
GET /plugins/signalk-czone/monitoring/tanks
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For example:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
curl -s http://127.0.0.1:3000/plugins/signalk-czone/monitoring/tanks | jq
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The response contains the active ZCF filename and a `tankMonitors` object with the parsed monitor definitions. This endpoint exposes **configuration only**; it does not yet represent live tank level or alarm state from NMEA 2000. Live CZone tank telemetry is a future task.
|
|
53
|
+
|
|
54
|
+
The existing electrical-monitoring definition endpoint remains:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
GET /plugins/signalk-czone/monitoring
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Design
|
|
61
|
+
|
|
62
|
+
The plugin does **not** modify Signal K Server, canboatjs, n2k-signalk, or any global PGN definitions.
|
|
63
|
+
|
|
64
|
+
At the input boundary it normalizes the NMEA 2000 frame representation, then extracts the CAN ID, reassembles Fast Packets, validates the CZone `27 99` payload, decodes PGNs 130822 (DC/COI) and 130817 (AC/ACOI), and applies the existing ZCF mapping.
|
|
65
|
+
|
|
66
|
+
The reusable `signalk-czone-zcf` library owns the ZCF parser and CZone configuration model. This plugin keeps only the runtime adapter needed to turn that model into Signal K paths and live NMEA 2000 telemetry mappings.
|
|
67
|
+
|
|
68
|
+
## ZCF upload
|
|
69
|
+
|
|
70
|
+
Version 0.2.2 replaces the unreliable generic RJSF `data-url` file field with a dedicated Signal K plugin configuration panel. The panel uses a real browser file input and uploads the selected `.zcf` file to the plugin's admin-only route:
|
|
71
|
+
|
|
72
|
+
`POST /plugins/signalk-czone/zcf/upload`
|
|
73
|
+
|
|
74
|
+
The plugin:
|
|
75
|
+
|
|
76
|
+
1. receives the multipart file directly;
|
|
77
|
+
2. requires a `.zcf` filename;
|
|
78
|
+
3. validates the temporary file using the existing `lib/zcf.js` parser;
|
|
79
|
+
4. atomically installs it in the plugin data directory;
|
|
80
|
+
5. updates the plugin configuration's `zcfPath` and restarts the plugin.
|
|
81
|
+
|
|
82
|
+
Only the installed path is stored in plugin configuration; the binary file is not placed in the JSON configuration.
|
|
83
|
+
|
|
84
|
+
Signal K plugin routes registered directly with `registerWithRouter()` are admin-only by default, which is appropriate for changing the vessel's CZone configuration.
|
|
85
|
+
|
|
86
|
+
## Confirm before turning on or off
|
|
87
|
+
|
|
88
|
+
Some circuits must not go off by a slip of a finger: a freezer, the instruments, or the circuit that powers the Signal K server, the network or the display in use. Other circuits may also need protection against an accidental ON. The ZCF does not say which circuits need either protection, so they are nominated independently in the plugin configuration panel under **Confirm before turning off** and **Confirm before turning on**.
|
|
89
|
+
|
|
90
|
+
A nominated circuit shows a padlock after its name in the webapp. Before the protected action, the webapp asks "Turn off …?" with **Keep on** / **Turn off**, or "Turn on …?" with **Keep off** / **Turn on**, before sending anything.
|
|
91
|
+
|
|
92
|
+
A Signal K PUT carries only the value and cannot say that the user was asked. By default, a protected ON or OFF PUT is answered with status 400 and nothing is sent to CZone. The independent **Let other apps turn these circuits on/off** settings can allow those PUTs where required.
|
|
93
|
+
|
|
94
|
+
CZone keypads and displays are not affected, and neither are modes: a mode switches what the CZone configuration says it switches.
|
|
95
|
+
|
|
96
|
+
After the user confirms, the webapp uses the plugin's own route:
|
|
97
|
+
|
|
98
|
+
`POST /plugins/signalk-czone/circuits/<slug>/on?confirm=1`
|
|
99
|
+
|
|
100
|
+
`POST /plugins/signalk-czone/circuits/<slug>/off?confirm=1`
|
|
101
|
+
|
|
102
|
+
Without `confirm=1` (or `{"confirm": true}` in the body) the protected route answers `409` with `{"needsConfirm": true}`. A dimmer level of 0 is treated as OFF; a positive dimmer level while the circuit is OFF (or its state has not yet been observed) is treated as ON.
|
|
103
|
+
|
|
104
|
+
Settings: `confirmOff` and `confirmOn` are lists of `{ "circuit": "<name>" }`, matched by circuit name or slug without regard to case. `confirmOffAllowElsewhere` and `confirmOnAllowElsewhere` are independent booleans, both defaulting to `false`.
|
|
105
|
+
|
|
106
|
+
### Configuration
|
|
107
|
+
|
|
108
|
+
Open **Server → Plugin Config → CZone**. The two nomination lists are independent:
|
|
109
|
+
|
|
110
|
+
- **Confirm before turning on** — add circuits where an accidental ON should require confirmation.
|
|
111
|
+
- **Confirm before turning off** — add circuits where an accidental OFF should require confirmation.
|
|
112
|
+
|
|
113
|
+
Choose a circuit from **Add a circuit** to nominate it; use **Remove** to remove a nomination. There is no separate Save button: each add/remove is persisted immediately.
|
|
114
|
+
|
|
115
|
+
Each list also has its own **Let other apps turn these circuits on/off** option. Leave it unticked to reject unconfirmed Signal K PUTs for that protected action; tick it when another Signal K app must be allowed to perform that action without presenting the CZone webapp confirmation.
|
|
116
|
+
|
|
117
|
+
Open CZone webapp pages update automatically when either nomination list changes. The plugin publishes a settings revision when the changed configuration is applied; connected pages receive it over their existing Signal K WebSocket connection and immediately re-read the circuit list. Padlocks and confirmation behaviour therefore update without reloading the page.
|
|
118
|
+
|
|
119
|
+
A circuit may be nominated in either list or in both.
|
|
120
|
+
|
|
121
|
+
## AC 130817
|
|
122
|
+
|
|
123
|
+
Observed CZone format:
|
|
124
|
+
|
|
125
|
+
- payload: 28 bytes
|
|
126
|
+
- bytes 0-1: `27 99`
|
|
127
|
+
- byte 2: page
|
|
128
|
+
- byte 3: CZone module
|
|
129
|
+
- bytes 4-27: 8 × 3-byte slots
|
|
130
|
+
- for the validated Water Heater Port mapping (`F8 / page 0 / slot 0`), the first byte of the slot is current in 0.2 A/count: `0x28` = 40 = 8.0 A
|
|
131
|
+
|
|
132
|
+
The other two bytes of each AC slot are deliberately left opaque until validated.
|
|
133
|
+
|
|
134
|
+
## DC 130822
|
|
135
|
+
|
|
136
|
+
The DC/COI slot format has been corrected from the earlier packed-value interpretation. Each 3-byte record is decoded independently:
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
byte 0 → current
|
|
140
|
+
byte 1 → low byte of secondary value
|
|
141
|
+
byte 2 → high byte of secondary value
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The current is:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
current_A = byte0 × 0.1
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The secondary value is a little-endian 16-bit value:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
value_raw = byte1 | (byte2 << 8)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The observed/validated CZone level encoding is:
|
|
157
|
+
|
|
158
|
+
| `value_raw` | Interpretation | Percentage |
|
|
159
|
+
| ---: | --- | ---: |
|
|
160
|
+
| `0x0400` / 1024 | OFF | 0% |
|
|
161
|
+
| `0x0401`–`0x07E7` | DIMMED | `(value_raw - 1024) / 10` |
|
|
162
|
+
| `0x07E8` / 2024 | ON / 100% | 100% |
|
|
163
|
+
| `0x07E9`–`0x0800` | ON | 100% |
|
|
164
|
+
| other values | UNKNOWN | — |
|
|
165
|
+
|
|
166
|
+
The dimmed encoding has been checked against controlled observations at 60%, 75%, 80%, 90%, and 100%. The parser now uses byte 0 exclusively for current, avoiding the previous interpretation that combined all three bytes into a packed current value and could produce implausibly high readings on dimmed circuits.
|
|
167
|
+
|
|
168
|
+
The decoded secondary state and percentage are retained in the plugin diagnostics for each tracked DC circuit. The public Signal K current path remains unchanged (`electrical.czone.<circuit>.current`).
|
|
169
|
+
|
|
170
|
+
## Trends
|
|
171
|
+
|
|
172
|
+
Off by default: tick **Record circuit current trends** in the configuration panel to turn it on. Boats that already send Signal K data to a database (for example InfluxDB with Grafana) can leave it off. When on, the plugin records each circuit's current and the webapp charts it: the arrow at the end of a circuit row opens that circuit's trend at the top of the page, for the last 1 h, 24 h, 7 d, 31 d, 90 d or 1 y, or for a period of up to 366 days chosen under **Custom**.
|
|
173
|
+
|
|
174
|
+
**What is stored.** The latest value of every `electrical.czone.<circuit>.current` path is sampled every 10 seconds, however often CZone repeats it, and written to plain CSV files in two tiers:
|
|
175
|
+
|
|
176
|
+
| Tier | File | Row | Used for |
|
|
177
|
+
| --- | --- | --- | --- |
|
|
178
|
+
| Full detail | `<series>/<YYYY-MM-DD>.csv` | `timestamp_ms,value` | charts up to 48 h |
|
|
179
|
+
| Ten-minute summary | `<series>/summary/<YYYY-MM>.csv` | `bucket_ms,min,avg,max` | longer charts: the line is the average, the band is min to max |
|
|
180
|
+
|
|
181
|
+
Full detail is written on change (plus the last unchanged sample before a change, and at least every 10 minutes), so a circuit that sits at 0 A adds a few kilobytes of data a day (one file per circuit per day, so on a FAT card at least one cluster each). A circuit that stops reporting for a minute is no longer recorded, so a module that drops off the bus shows as a gap, not a flat line. Samples are buffered and appended once a minute.
|
|
182
|
+
|
|
183
|
+
**Where it goes.**
|
|
184
|
+
|
|
185
|
+
- `trendDirectory`, if set (on a GX it must be on mounted removable storage).
|
|
186
|
+
- On a Victron GX: an SD card or USB stick only, in `signalk-czone/trends` on the card. The GX's internal flash is never written. Without a card, or with a card Signal K cannot write to, nothing is recorded and the configuration panel says why. See "Trends on an SD card or USB stick" in `README-VenusOS.md`.
|
|
187
|
+
- Anywhere else: `trends` in the plugin's data folder.
|
|
188
|
+
|
|
189
|
+
**How long it is kept.** Nothing is deleted by age unless `trendRetentionDays` is set (31, 90 or 365 days of full detail; summaries stay). When free space falls below a reserve (the larger of 5% and 200 MB on a card; the larger of 10% and 1 GB on a disk shared with the system) the oldest full-detail days are removed first and the oldest summary months only after that, so recording never stops.
|
|
190
|
+
|
|
191
|
+
**Settings** (in the configuration panel under **Trends**): `trendsEnabled` (default `false`: trends are off until this is ticked), `trendDirectory` (default blank = automatic), `trendRetentionDays` (default `0` = until storage runs low).
|
|
192
|
+
|
|
193
|
+
**Routes.**
|
|
194
|
+
|
|
195
|
+
- `GET /plugins/signalk-czone/trend?path=<Signal K path>&range=1h|24h|7d|31d|90d|1y`, or `&from=<ms>&to=<ms>` for a custom period. Answers `{ available, tier, start, end, gapMs, data, latest }`, where `data` rows are `[t, value]` (full detail) or `[t, avg, min, max]` (summaries, or full detail reduced to about 400 points), and `latest` is the live value while the circuit is reporting.
|
|
196
|
+
- `GET /plugins/signalk-czone/trend/status` answers where trends are going, free space, and how many circuits are being recorded, or the reason trends are off.
|
|
197
|
+
|
|
198
|
+
## Installation
|
|
199
|
+
|
|
200
|
+
The plugin installs the pinned `signalk-czone-zcf@0.1.0-beta.1` npm dependency automatically. No separate parser installation or Git checkout is required.
|
|
201
|
+
|
|
202
|
+
### Signal K App Store
|
|
203
|
+
|
|
204
|
+
Once this beta is published and available in your App Store:
|
|
205
|
+
|
|
206
|
+
1. Find **CZone (BETA)** in the App Store (digital switching or NMEA 2000 category) and install it.
|
|
207
|
+
2. Restart Signal K.
|
|
208
|
+
3. Open **Server → Plugin Config → CZone** and use **Upload and install ZCF** to upload your vessel's `.zcf` configuration.
|
|
209
|
+
4. Enable the plugin after configuration, then check the **Diagnostics** tab and published currents before testing controls.
|
|
210
|
+
|
|
211
|
+
The plugin is disabled by default until explicitly enabled. Availability of beta versions in the App Store depends on the server version and publication channel.
|
|
212
|
+
|
|
213
|
+
### Explicit npm beta installation
|
|
214
|
+
|
|
215
|
+
After npm publication, run this as the Signal K service user from the server's configuration directory (normally `~/.signalk`, or the directory configured by `SIGNALK_NODE_CONFIG_DIR`):
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
cd ~/.signalk
|
|
219
|
+
npm install signalk-czone@beta --omit=dev --ignore-scripts
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Restart Signal K and follow the configuration steps above. For Docker or appliance installations, use the corresponding container/configuration directory and restart method.
|
|
223
|
+
|
|
224
|
+
For installation from a maintainer-provided npm tarball, run `npm install /path/to/signalk-czone-0.3.0-beta.9.tgz --omit=dev --ignore-scripts` from the same configuration directory. Its pinned parser dependency must already be published to npm. Do not simply extract the plugin into `node_modules`: that does not install dependencies.
|
|
225
|
+
|
|
226
|
+
### Publishing (maintainers)
|
|
227
|
+
|
|
228
|
+
Publish `signalk-czone-zcf@0.1.0-beta.1` first. Then run `npm install`, `npm test`, and `npm pack --dry-run` in this repository, verify the runtime files and App Store assets, and run `npm publish --tag beta` after npm authentication.
|
|
229
|
+
|
|
230
|
+
The package defaults to the `beta` tag. Promoting a beta to `latest` for default installs is a separate release decision.
|
|
231
|
+
|
|
232
|
+
### Beta feedback
|
|
233
|
+
|
|
234
|
+
Include the plugin and parser versions, Signal K and Node.js versions, NMEA 2000 gateway type, CZone hardware, expected/actual behaviour, and relevant diagnostics when opening an issue. Review logs and configuration files for private vessel information before sharing them.
|
|
235
|
+
|
|
236
|
+
## 0.2.4 startup fix
|
|
237
|
+
|
|
238
|
+
0.2.4 restores the ZCF loading function used during plugin startup. The configured ZCF is loaded and validated before the plugin registers its raw NMEA2000 listener. A missing or invalid configured ZCF prevents startup with a clear error instead of a JavaScript `load is not defined` error.
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
## 0.2.5 configuration persistence fix
|
|
242
|
+
|
|
243
|
+
After a successful ZCF upload, 0.2.5 explicitly persists the new `zcfPath` before restarting the plugin. The configuration panel also updates its displayed installed path immediately and uses that path for subsequent configuration saves, so the UI and the plugin startup configuration stay aligned.
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 0.3.0-beta.7
|
|
247
|
+
|
|
248
|
+
This beta corrects the PGN 130822 DC/COI three-byte record decoder using the validated CZone wire format described above. DC current now comes from record byte 0 at 0.1 A/count, while bytes 1-2 are decoded as a little-endian secondary level value. Diagnostics now expose the decoded DC level state and percentage alongside the current value.
|
|
249
|
+
|
|
250
|
+
The public Signal K circuit-current paths are unchanged.
|
|
251
|
+
|
|
252
|
+
## 0.3.0-beta.5
|
|
253
|
+
|
|
254
|
+
This beta keeps the stable circuit-name Signal K paths and diagnostics/status reporting, and adds explicit AC/DC classification metadata for downstream consumers such as InfluxDB.
|
|
255
|
+
|
|
256
|
+
### Diagnostics and status
|
|
257
|
+
|
|
258
|
+
The plugin configuration panel includes a **Diagnostics** tab alongside **Configuration**. The diagnostics view polls the plugin status periodically and is intended to make field testing and troubleshooting possible without inspecting the source code.
|
|
259
|
+
|
|
260
|
+
The status reports:
|
|
261
|
+
|
|
262
|
+
- running state and uptime
|
|
263
|
+
- active ZCF filename, path, and size
|
|
264
|
+
- total circuits and current mappings
|
|
265
|
+
- current-mapping counts by PGN
|
|
266
|
+
- raw NMEA2000 frame count
|
|
267
|
+
- completed CZone Fast Packet count
|
|
268
|
+
- DC and AC packet counts
|
|
269
|
+
- published-value count
|
|
270
|
+
- raw-frame parse errors
|
|
271
|
+
- invalid CZone packet count
|
|
272
|
+
- startup/decode errors
|
|
273
|
+
- unmapped DC and AC circuit counts
|
|
274
|
+
- Fast Packets currently in progress
|
|
275
|
+
- last DC packet, last AC packet, and last published value
|
|
276
|
+
- ZCF parser warnings
|
|
277
|
+
- per-circuit last observed value and update time
|
|
278
|
+
- per-circuit diagnostic mapping information including module, page, slot, source address, and PGN
|
|
279
|
+
|
|
280
|
+
The plugin also exposes a diagnostics route at:
|
|
281
|
+
|
|
282
|
+
```text
|
|
283
|
+
/diagnostics
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Use the **Diagnostics** tab in the Signal K plugin configuration panel for normal access.
|
|
287
|
+
|
|
288
|
+
### Stable circuit naming
|
|
289
|
+
|
|
290
|
+
Published current paths use the ZCF circuit name rather than the CZone module/channel or page/slot:
|
|
291
|
+
|
|
292
|
+
```text
|
|
293
|
+
electrical.czone.<circuit>.current
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
For example:
|
|
297
|
+
|
|
298
|
+
```text
|
|
299
|
+
electrical.czone.100L_Fridge.current
|
|
300
|
+
electrical.czone.200L_Fridge.current
|
|
301
|
+
electrical.czone.AIS.current
|
|
302
|
+
electrical.czone.Water_Heater_Port.current
|
|
303
|
+
electrical.czone.Starlink.current
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The circuit name is the stable public Signal K identity. Module, channel, page, and slot are retained as diagnostic mapping information and must not be treated as the public circuit identity.
|
|
307
|
+
|
|
308
|
+
Circuit names are sanitized for Signal K paths by trimming whitespace and replacing runs of spaces/punctuation with `_`, with leading/trailing `_` removed.
|
|
309
|
+
|
|
310
|
+
### AC/DC classification
|
|
311
|
+
|
|
312
|
+
The public current paths remain stable and unchanged:
|
|
313
|
+
|
|
314
|
+
```text
|
|
315
|
+
electrical.czone.<circuit>.current
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Each published value is additionally classified as AC or DC through Signal K source/path metadata.
|
|
319
|
+
|
|
320
|
+
The source identity is:
|
|
321
|
+
|
|
322
|
+
```text
|
|
323
|
+
CZone-AC
|
|
324
|
+
CZone-DC
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
This allows `signalk-to-influxdb2` to expose the distinction through its InfluxDB `source` tag without adding `AC` or `DC` to the circuit path.
|
|
328
|
+
|
|
329
|
+
For the supplied ZCF:
|
|
330
|
+
|
|
331
|
+
- PGN `130822` is the DC/COI current decoder and uses 0.1 A/count.
|
|
332
|
+
- PGN `130817` is the AC/ACOI current decoder and uses 0.2 A/count for the validated AC current field.
|
|
333
|
+
- Module `0xF8` is classified as the validated AC mapping used by the supplied ZCF.
|
|
334
|
+
- Module `0x28` records are excluded from the CZone circuit-current mapping.
|
|
335
|
+
|
|
336
|
+
The AC slot's remaining two bytes are intentionally left opaque until additional fields are validated.
|
|
337
|
+
|
|
338
|
+
### Optional: InfluxDB verification
|
|
339
|
+
|
|
340
|
+
The InfluxDB examples in this section are optional and only apply if the Signal K server is also running and configured with the `signalk-to-influxdb2` plugin. `signalk-czone` does not connect to or write directly to InfluxDB; it publishes the Signal K values and AC/DC source metadata that `signalk-to-influxdb2` can store.
|
|
341
|
+
|
|
342
|
+
If `signalk-to-influxdb2` is not installed and configured, the commands below will not return CZone data.
|
|
343
|
+
|
|
344
|
+
A quick check of the classification metadata can be performed with:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
influx query '
|
|
348
|
+
from(bucket: "DataBucket")
|
|
349
|
+
|> range(start: -15m)
|
|
350
|
+
|> filter(fn: (r) => r._measurement == "electrical.czone.Water_Heater_Port.current")
|
|
351
|
+
|> limit(n: 10)
|
|
352
|
+
' --host http://127.0.0.1:8086 --org SugarShack --token "$INFLUX_TOKEN"
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
The Water Heater Port circuit should carry:
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
source = CZone-AC
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
A DC circuit such as Starlink should carry:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
source = CZone-DC
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
A combined check can group the CZone current series by classification:
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
influx query '
|
|
371
|
+
from(bucket: "DataBucket")
|
|
372
|
+
|> range(start: -15m)
|
|
373
|
+
|> filter(fn: (r) => r._measurement =~ /^electrical\.czone\./)
|
|
374
|
+
|> keep(columns: ["_measurement", "_time", "_value", "source"])
|
|
375
|
+
|> group(columns: ["source"])
|
|
376
|
+
' --host http://127.0.0.1:8086 --org SugarShack --token "$INFLUX_TOKEN"
|
|
377
|
+
```
|
|
378
|
+
Something like this can be created in grafana from the influxDB data
|
|
379
|
+
|
|
380
|
+
<img width="2900" height="1708" alt="Image" src="https://github.com/user-attachments/assets/92c458b3-6709-44be-ba49-d4029791c0d3" />
|
|
381
|
+
|
|
382
|
+
For the supplied ZCF, the current mappings are 83 DC mappings and 8 AC mappings. This count describes the supplied ZCF only; it is not a protocol requirement.
|
|
383
|
+
|
|
384
|
+
### Raw NMEA2000 transport
|
|
385
|
+
|
|
386
|
+
The decoder is intentionally transport-independent after the raw CAN frame is obtained.
|
|
387
|
+
|
|
388
|
+
The current Signal K integration listens to:
|
|
389
|
+
|
|
390
|
+
```text
|
|
391
|
+
canboatjs:rawoutput
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
It parses the raw YDWG02 line into timestamp, CAN ID, source address, PGN, and CAN data bytes.
|
|
395
|
+
|
|
396
|
+
CZone PGNs `130817` and `130822` are then reassembled as Fast Packets before CZone payload validation and ZCF lookup.
|
|
397
|
+
|
|
398
|
+
The decoder does not hard-code a CZone source address. The source address is part of the Fast Packet stream key because the same PGN can appear from different source addresses.
|
|
399
|
+
|
|
400
|
+
The plugin does not patch Signal K Server, canboatjs, n2k-signalk, or global PGN definitions.
|
|
401
|
+
|
|
402
|
+
### ZCF upload and persistence
|
|
403
|
+
|
|
404
|
+
The custom configuration panel uploads a `.zcf` file through:
|
|
405
|
+
|
|
406
|
+
```text
|
|
407
|
+
POST /plugins/signalk-czone/zcf/upload
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
After validation, the plugin installs the file in its plugin data directory, persists the active `zcfPath`, and restarts using the new configuration.
|
|
411
|
+
|
|
412
|
+
Only the installed path is stored in plugin configuration; the binary ZCF is not stored in JSON.
|
|
413
|
+
|
|
414
|
+
### Version history
|
|
415
|
+
|
|
416
|
+
- **0.2.2** — replaced the unreliable generic RJSF `data-url` upload with a dedicated configuration-panel uploader.
|
|
417
|
+
- **0.2.4** — restored the ZCF startup loading function and made invalid/missing ZCF configuration fail clearly.
|
|
418
|
+
- **0.2.5** — fixed ZCF path persistence and configuration-panel path handling.
|
|
419
|
+
- **0.3.0-beta.1** — first self-contained beta with the working ZCF parser, raw NMEA2000/CZone decoder, configuration panel, and validated ZCF upload/persistence.
|
|
420
|
+
- **0.3.0-beta.2** — changed public Signal K current paths to stable ZCF circuit names.
|
|
421
|
+
- **0.3.0-beta.3** — added backend diagnostics/status reporting.
|
|
422
|
+
- **0.3.0-beta.4** — added the Diagnostics tab/page to the configuration UI.
|
|
423
|
+
- **0.3.0-beta.5** — added explicit AC/DC source classification for downstream telemetry storage while retaining stable circuit-name paths and the diagnostics/status tooling.
|
|
424
|
+
|
|
425
|
+
The beta is intended for extended real-world testing before a stable `0.3.0` release.
|
package/icon.png
ADDED
|
Binary file
|
package/img/config.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|