Tony - Is there a way to capture PGNs and debug...

Is there a way to capture PGNs and debug additional fields? I am connected to a Mercury CAN gateway for an outboard. I am getting some of the parsed values from PGN 127489 (Dynamic Engine Parameters) but not everything is being converted. I would like to be able to see each update and if parsing fails or is skipped. There is a rapid update on that PGN, but only a handful of conversions happening. I expect voltage, coolant temperature, oil pressure, oil temperature, etc. but only getting fuel rate, fuel pressure, and alarm states. I am pretty sure this is an issue with canboat library but I have no idea how to confirm this. What is the best solution for developers?
7 Replies
Scott Bender
Scott Bender4w ago
First step is to turn on data logging Then you get the raw n2k data You can use canboatjs to decode individual items I can take a look in detail if you need it
Tony
TonyOP4w ago
Turn on data logging for what? A Signalk event? I see several for canboatjs, like signalk-server:events:connection:N2K:canboatjs:unparsed:data
Scott Bender
Scott Bender4w ago
Data logging is in the Data Connection settings Then you will get log files in ~/.signalk
Tony
TonyOP4w ago
Ah makes sense. Thanks I'll try this Failing to parse the log entires. I tried using the doc example code but it's failing
const FromPgn = require("@canboat/canboatjs").FromPgn;
const fs = require('fs');
const path = require('path');

const parser = new FromPgn();

const fileLines = fs.readFileSync('./skserver-raw_2025-01-28T14.log');
const lines = fileLines.toString().split('\n');

lines.forEach((line) => {
const pgn = line.split(';')[2]
try {
if(pgn.split(',')[2] === '127489'){
const json = parser.parseString(pgn)
if(json){
console.log(JSON.stringify(json))
}
}

} catch(e){
//do nothing
}

});
const FromPgn = require("@canboat/canboatjs").FromPgn;
const fs = require('fs');
const path = require('path');

const parser = new FromPgn();

const fileLines = fs.readFileSync('./skserver-raw_2025-01-28T14.log');
const lines = fileLines.toString().split('\n');

lines.forEach((line) => {
const pgn = line.split(';')[2]
try {
if(pgn.split(',')[2] === '127489'){
const json = parser.parseString(pgn)
if(json){
console.log(JSON.stringify(json))
}
}

} catch(e){
//do nothing
}

});
Tony
TonyOP4w ago
Using this code example https://github.com/canboat/canboatjs?tab=readme-ov-file#parse-input-from-the-actisense-ngt-1-or-ikonvert-string-formats Ah shoot premature issue. I just had to upgrade the package version to latest
Scott Bender
Scott Bender4w ago
just use the comman line tools instructions in the git README use analyzerjs

Did you find this page helpful?