SignalK / signalk-server

An implementation of a Signal K central server for boats.
http://signalk.org
Apache License 2.0
318 stars 155 forks source link

USB Data Source shows as "Connected" in Dashboard, then Disappears #1090

Closed singlerider closed 9 months ago

singlerider commented 4 years ago

Using a Yacht Devices YDNU-02 NMEA 2000 USB Gateway, I am unable to successfully retrieve any data from the Signal K Node Server.

Configuration in "Connections" tab: image

Note: I had to manually npm install serialport in order to avoid an error:

Error: Cannot find module 'serialport'
Require stack:
- /home/shane/git/signalk-server-node/node_modules/@signalk/streams/serialport.js
- /home/shane/git/signalk-server-node/node_modules/@signalk/streams/simple.js
- /home/shane/git/signalk-server-node/lib/pipedproviders.js
- /home/shane/git/signalk-server-node/lib/index.js
- /home/shane/git/signalk-server-node/bin/signalk-server
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
    at Function.Module._load (internal/modules/cjs/loader.js:899:27)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/home/shane/git/signalk-server-node/node_modules/@signalk/streams/serialport.js:63:20)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.nmea2000input [as NMEA2000] (/home/shane/git/signalk-server-node/node_modules/@signalk/streams/simple.js:233:24)
    at new Simple (/home/shane/git/signalk-server-node/node_modules/@signalk/streams/simple.js:67:34)
    at createPipeElement (/home/shane/git/signalk-server-node/lib/pipedproviders.js:56:20)
    at /home/shane/git/signalk-server-node/lib/pipedproviders.js:26:30
    at Array.reduce (<anonymous>) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/shane/git/signalk-server-node/node_modules/@signalk/streams/serialport.js',
    '/home/shane/git/signalk-server-node/node_modules/@signalk/streams/simple.js',
    '/home/shane/git/signalk-server-node/lib/pipedproviders.js',
    '/home/shane/git/signalk-server-node/lib/index.js',
    '/home/shane/git/signalk-server-node/bin/signalk-server'
  ]
}
Error: Cannot find module '/home/shane/git/signalk-server-node/lib/../providers/simple'
Require stack:
- /home/shane/git/signalk-server-node/lib/pipedproviders.js
- /home/shane/git/signalk-server-node/lib/index.js
- /home/shane/git/signalk-server-node/bin/signalk-server
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
    at Function.Module._load (internal/modules/cjs/loader.js:899:27)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at createPipeElement (/home/shane/git/signalk-server-node/lib/pipedproviders.js:61:29)
    at /home/shane/git/signalk-server-node/lib/pipedproviders.js:26:30
    at Array.reduce (<anonymous>)
    at createPipedProvider (/home/shane/git/signalk-server-node/lib/pipedproviders.js:24:55)
    at /home/shane/git/signalk-server-node/lib/pipedproviders.js:73:37
    at Array.reduce (<anonymous>)
    at Object.startProviders [as start] (/home/shane/git/signalk-server-node/lib/pipedproviders.js:70:62)
    at /home/shane/git/signalk-server-node/lib/index.js:250:62
    at createServer (/home/shane/git/signalk-server-node/lib/index.js:292:5)
    at /home/shane/git/signalk-server-node/lib/index.js:238:9
    at new Promise (<anonymous>)
    at Server.start (/home/shane/git/signalk-server-node/lib/index.js:237:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/shane/git/signalk-server-node/lib/pipedproviders.js',
    '/home/shane/git/signalk-server-node/lib/index.js',
    '/home/shane/git/signalk-server-node/bin/signalk-server'
  ]
}
Cannot read property 'pipe' of undefined

Even after installing serialport, I get the issue I mentioned at the beginning.

sbender9 commented 4 years ago

Any errors is the log?

sbender9 commented 4 years ago

Oh, it looks like you're running from a git clone? Is there a reason you're doing that?

sbender9 commented 4 years ago

You should not have to manually install serialport, so it's hard to say what else is wrong here. Can you please try running from an npm global install as instructed in the README?

singlerider commented 4 years ago

I confirm the issue persists with a global install:

$ npm install -g signalk-server
➜ which signalk-server
/home/shane/.nvm/versions/node/v14.5.0/bin/signalk-server

(The issue being that the "Connected" status is fleeting).

singlerider commented 4 years ago

The reason why I ran from a clone is because the global install and Docker methods all failed to perform the duty of connecting to this USB device.

tkurki commented 4 years ago

Your git clone was not in a functioning shape, per the error message saying that simple module vould not be found.

If the problem persists there should be some other error messages, the information you provided is no longer valid.

singlerider commented 4 years ago

@tkurki , I explain in my original message that the error message provided is resolved by manually installing serialport. I agree that there should be more error messages. However, there are none. The information I provided is still valid as the behavior is the same. There are no relevant error messages from the global installation.

tkurki commented 4 years ago

Sorry, I don’t understand: title says one thing about connection in dashboard, but messages talk about manual install of serialport.

What exactly is the ’behavior’ that you refer to?

singlerider commented 4 years ago

Installing serialport is tangential. It's not the issue described. There is no known cause of the issue described.

sbender9 commented 4 years ago

On the Server Logs page, enter "signalk:streams:serialport,canboatjs:ydgw02", and turn on "Remember Debug", then restart, this should give us some more info in the logs.

singlerider commented 4 years ago

Interesting!

Thanks for the tip, @sbender9.

Here are some logs:

Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,158.9,R,4.6,M,A*24 +1ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.4,0.0,E,,*06 +1ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,158.9,R,4.6,M,A*24 +2ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDVWR,158.9,R,9.0,N,4.6,M,16.6,K*6B +2ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.5,0.0,E,,*07 +491ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDM,58.5,M*07 +1ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,162.4,R,4.4,M,A*22 +1ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.5,0.0,E,,*07 +0ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,162.4,R,4.4,M,A*22 +1ms
Aug 01 15:42:40 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDVWR,162.4,R,8.7,N,4.5,M,16.2,K*6E +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.6,0.0,E,,*04 +495ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDM,58.6,M*04 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,161.0,R,4.5,M,A*24 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.6,0.0,E,,*04 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,161.0,R,4.5,M,A*24 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDVWR,161.0,R,8.9,N,4.6,M,16.5,K*63 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.6,0.0,E,,*04 +493ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDM,58.6,M*04 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,159.6,R,4.6,M,A*2A +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.6,0.0,E,,*04 +1ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,159.6,R,4.6,M,A*2A +0ms
Aug 01 15:42:41 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDVWR,159.6,R,9.1,N,4.7,M,16.8,K*6B +2ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.7,0.0,E,,*05 +493ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDM,58.7,M*05 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,164.2,R,4.6,M,A*20 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.7,0.0,E,,*05 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,164.2,R,4.6,M,A*20 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDVWR,164.2,R,9.1,N,4.7,M,16.9,K*60 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.7,0.0,E,,*05 +493ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDM,58.7,M*05 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,168.6,R,4.6,M,A*28 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.7,0.0,E,,*05 +0ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDMWV,168.6,R,4.6,M,A*28 +1ms
Aug 01 15:42:42 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDVWR,168.6,R,9.0,N,4.6,M,16.7,K*66 +0ms
Aug 01 15:42:43 canboatjs:ydgw02 [error] undefined Error: Invalid parts. - $YDHDG,58.7,0.0,E,,*05 +496ms

It looks like data is attempting to be read, after all. Does this suggest a configuration problem on my end? If so, any tips?

singlerider commented 4 years ago

Here's what I was seeing regarding the connection status disappearing, @tjkurki and @sbender9:

signalk-connection-status-issue

sbender9 commented 4 years ago

Oh! I guess you have to put it in RAW mode. I should do this automatically, but I don't have a device to test with.

Connect to the device and enter MODE RAW

image
singlerider commented 4 years ago

@sbender9, you seem to have nailed it.

The text you screenshot was located in the Yacht Devices YDNU02 User Manual:

https://www.yachtd.com/downloads/ydnu02.pdf

I set the mode to RAW, then unplugged and plugged it back in, then:

image

There are still some suspicious logs I see in the Node server:

  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:21:17.530"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:21:18.991"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:21:27.730"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:21:29.083"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:21:37.730"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:21:39.009"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:21:47.731"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:21:49.040"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:21:57.914"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:21:59.054"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:22:07.916"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:22:09.085"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:22:18.013"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:22:18.919"} +1s
  canboatjs:ydgw02 [warning] 65311 no conversion found for pgn {"canId":486481667,"prio":7,"src":3,"dst":255,"pgn":65311,"time":"00:22:28.118"} +9s
  canboatjs:ydgw02 [warning] 65535 no conversion found for pgn {"canId":486539011,"prio":7,"src":3,"dst":255,"pgn":65535,"time":"00:22:29.040"} +930ms

Should I worry about those or should I expect smooth sailing? :boat:

Also, I'll volunteer to test whatever you'd need regarding this setup. I didn't make the connection that RAW mode was necessary even after I RTFM'd.

sbender9 commented 4 years ago

Those warnings are ok. It's just pgn's that canboatjs does not understand. You can turn that debugging off and they will go away.

Yeah, I'd like to add the code to automatically put it in RAW mode. Would be a big help if you could test it. I'll reach out when that is ready. Are you on the Signal K Slack?

singlerider commented 4 years ago

@sbender9 , I'm not in the Slack, but I am in the sparsely-populated and not-oft-used Freenode IRC channel. 'Joining now. Thanks! I'm comfortable that this issue is resolved and I'm glad SEO can make it searchable for anyone else with this issue. 'See you in Slack!

tkurki commented 4 years ago

Close this as it seems resolved, open another for proper initialisation of YD usb device?

singlerider commented 4 years ago

Regarding #1093 , an attempted fix to resolve this issue:

I always run this project from source. I attempted to run two different versions of the project.

The first version I tried (as a control) is at cba18e2d8fe38600877e5c699341e1c26eaeef5e and the symptoms described in this issue still persist.

The next version I tried (the presumed fix) is at f02bbb5807e0d238b202445f1cd25ab09d4682cd and it definitely switches the MODE of the YDNU02 from Auto to RAW. However, I still had to npm install serialport to get it to work.

@sbender9 , thank you for coming through.

tkurki commented 4 years ago

What node version are you using?

If you npm list what versions of serialport are installed and where in the deps tree? Maybe share the whole output as a gist.

singlerider commented 4 years ago

Node version: v14.5.0

Dependency Tree: https://gist.github.com/singlerider/5ac8c231b8cd1b644b8f05bf37ec48a1

tkurki commented 4 years ago

I think your need to manually install serialport stems from "too new" Node version: we are still officially at Node 10, and it looks like the serialport dependency is slightly messed up

Serialport docs say that SerialPort officially supports all Active, Maintenance and Current LTS releases of Node.js, that is ambiguous, as older versions' documentations still state that. I think for Node v14 you need serialport@9.

Time to update to serialport@9 throughout, I think @sbender9 .

tkurki commented 9 months ago

Closing as stale.