OpenMarine
SignalK not receiving wind data - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: SignalK not receiving wind data (/showthread.php?tid=3839)



SignalK not receiving wind data - ash_perry - 2022-01-04

I'm able to see WIMWV sentences in the SK server log but the data isn't available to any dashboards etc. Here's a copy of the log:

Code:
Jan 04 13:58:08 2022-01-04T02:58:08.141Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.242Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.342Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.443Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.543Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.644Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.744Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.845Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:08 2022-01-04T02:58:08.945Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:09 2022-01-04T02:58:09.045Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:09 2022-01-04T02:58:09.146Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:09 2022-01-04T02:58:09.247Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:09 2022-01-04T02:58:09.347Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:09 2022-01-04T02:58:09.447Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]
Jan 04 13:58:09 2022-01-04T02:58:09.548Z signalk-server:events:nmea0183 [ '\u0000$WIMWV,345,R,0,N,A*21' ]

I've attached the data connection settings also.


RE: SignalK not receiving wind data - PaddyB - 2022-01-04

The "\u0000" at the start of the nmea 0183 sentence looks odd, where is the wind data coming from?
You could try turning off validate checksum in the connection, with the random text at the start the checksum will likely be wrong.
And full marks for posting some info instead of just "why not work" Smile


RE: SignalK not receiving wind data - tkurki - 2022-01-04

You might want to try googling for \u0000, see some hits about a mysterious entity called null and decide to try the option Remove NULL characters....

\u0000 is JavaScript string encoding for null character, that would be otherwise invisible in a debug log.


RE: SignalK not receiving wind data - ash_perry - 2022-01-04

Thanks guys. I tried turning off validate checksum and turning on remove null characters which suprisingly didn't change the log output.

The wind data is coming from a NASA Marine wind transducer connected to the RPi running openCPN via a serial to USB adapter. I read on another forum that the standard NMEA0183 sentence has floating point numbers with 1 deceimal place for wind angle and speed. The NASA transducer is outputting integers for those values in the NMEA sentence. For example:

NASA sentence: $WIMWV,345,R,2.3,N,A*21
Normal sentence: $WIMWV,345.0,R,2.3,N,A*21

I'm new to node-red but I think I could use it to clean the leading NULL chars and then convert ints to floats. Unsure whether it's better to then convert this back to an NMEA0183 sentence and then into signalK or send those values directly to a signalK path. Also not sure what's going on with the 'u\0000' in the first place either.


RE: SignalK not receiving wind data - tkurki - 2022-01-05

Did you restart after config changes?


RE: SignalK not receiving wind data - PaddyB - 2022-01-05

(2022-01-04, 11:32 PM)ash_perry Wrote: Thanks guys. I tried turning off validate checksum and turning on remove null characters which suprisingly didn't change the log output.

The wind data is coming from a NASA Marine wind transducer connected to the RPi running openCPN via a serial to USB adapter. I read on another forum that the standard NMEA0183 sentence has floating point numbers with 1 deceimal place for wind angle and speed. The NASA transducer is outputting integers for those values in the NMEA sentence. For example:

NASA sentence: $WIMWV,345,R,2.3,N,A*21
Normal sentence: $WIMWV,345.0,R,2.3,N,A*21

I'm new to node-red but I think I could use it to clean the leading NULL chars and then convert ints to floats. Unsure whether it's better to then convert this back to an NMEA0183 sentence and then into signalK or send those values directly to a signalK path. Also not sure what's going on with the 'u\0000' in the first place either.

Just had a play on node red sending various nmea sentences to the server>>
With connections validate checksum off and remove null on ->
[Image: lwG4pQP.png]

This works and shows up as signalk data - $WIMWV,345,R,0,N,A*

But this one doesn't, though does show in the nmeaout event  log - \u0000$WIMWV,345,R,0,N,A*

In the log it looks like there's been an extra backslash added as well, might be relevent..
Jan 05 00:23:25 2022-01-05T00:23:25.031Z signalk-server:events:test [ '\\u0000$WIMWV,345,R,0,N,A*' ]

Looks like those leading chars could be the issue? 

I have some node red stashed on evernote to calc an nmea checksum, I'll have a play tomorrow & see how easy it is to filter out that message and replace with a more standard one.

Node red is such a great resource to have in signalk, this would likely be a show stopper for probably every other system  Cool

didn't take long, evernote is great for stashing stuff and actually finding it again..

in node red insert this,  ctrl + i then paste. Might be a cleaner way to do it, but this seems to work..

Code:
[
   {
       "id": "4bbdebc8.526844",
       "type": "debug",
       "z": "d6c01db7.8f1c",
       "name": "",
       "active": false,
       "tosidebar": true,
       "console": false,
       "tostatus": false,
       "complete": "true",
       "targetType": "full",
       "statusVal": "",
       "statusType": "auto",
       "x": 910,
       "y": 1640,
       "wires": []
   },
   {
       "id": "be4e41e4.4d46c",
       "type": "tcp in",
       "z": "d6c01db7.8f1c",
       "name": "",
       "server": "client",
       "host": "localhost",
       "port": "10110",
       "datamode": "stream",
       "datatype": "utf8",
       "newline": "",
       "topic": "",
       "base64": false,
       "x": 210,
       "y": 1660,
       "wires": [
           [
               "b3bf00bf.cd595"
           ]
       ]
   },
   {
       "id": "b3bf00bf.cd595",
       "type": "switch",
       "z": "d6c01db7.8f1c",
       "name": "",
       "property": "payload",
       "propertyType": "msg",
       "rules": [
           {
               "t": "cont",
               "v": "\\u0000",
               "vt": "str"
           }
       ],
       "checkall": "true",
       "repair": false,
       "outputs": 1,
       "x": 390,
       "y": 1660,
       "wires": [
           [
               "b8c06b8f.14c038"
           ]
       ]
   },
   {
       "id": "b8c06b8f.14c038",
       "type": "function",
       "z": "d6c01db7.8f1c",
       "name": "remove bad stuff",
       "func": "var nmeaFull=msg.payload;\n\nvar nmeaStripped=nmeaFull.substring(nmeaFull.indexOf(\"$\")+1, nmeaFull.indexOf(\"*\"));     //cut of the leading \"$\" and the bad checksum\nmsg.payload = nmeaStripped;\nreturn msg;\n",
       "outputs": 1,
       "noerr": 0,
       "initialize": "",
       "finalize": "",
       "libs": [],
       "x": 550,
       "y": 1660,
       "wires": [
           [
               "75daf0a0.f1d1b",
               "4bbdebc8.526844"
           ]
       ]
   },
   {
       "id": "75daf0a0.f1d1b",
       "type": "function",
       "z": "d6c01db7.8f1c",
       "name": "add checksum",
       "func": "var nmea = msg.payload;\nvar checksum = 0; \n\nfor(var i = 0; i < nmea.length; i++) { \n  checksum = checksum ^ nmea.charCodeAt(i); \n}\nchecksum = checksum.toString(16);    //convert to hex\nnmea = '$' + nmea + '*' + checksum;  //make the full nmea sentence again\n\nmsg.payload = nmea + '\\r\\n';\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "initialize": "",
       "finalize": "",
       "libs": [],
       "x": 760,
       "y": 1680,
       "wires": [
           [
               "4bbdebc8.526844",
               "3b97d61d.55ff1a"
           ]
       ]
   },
   {
       "id": "3b97d61d.55ff1a",
       "type": "udp out",
       "z": "d6c01db7.8f1c",
       "name": "",
       "addr": "127.0.0.1",
       "iface": "",
       "port": "10111",
       "ipv": "udp4",
       "outport": "",
       "base64": false,
       "multicast": "false",
       "x": 1000,
       "y": 1680,
       "wires": []
   }
]



RE: SignalK not receiving wind data - tkurki - 2022-01-05

(2022-01-05, 01:31 AM)PaddyB Wrote: This works and shows up as signalk data - $WIMWV,345,R,0,N,A*

But this one doesn't, though does show in the nmeaout event  log - \u0000$WIMWV,345,R,0,N,A*

In the log it looks like there's been an extra backslash added as well, might be relevent..
Jan 05 00:23:25 2022-01-05T00:23:25.031Z signalk-server:events:test [ '\\u0000$WIMWV,345,R,0,N,A*' ]

Looks like those leading chars could be the issue? 

This is not correct advice. Your node-red code is off and it is generating data that has backslash as the first character, null as the second one and then the real data. The conversion to SK does not handle this because of the extra backslash.

I just tested and activating the null character removal makes this message pass. Likewise it should fix the original poster's issue.


RE: SignalK not receiving wind data - PaddyB - 2022-01-05

(2022-01-05, 07:29 PM)tkurki Wrote: This is not correct advice. Your node-red code is off and it is generating data that has backslash as the first character, null as the second one and then the real data. The conversion to SK does not handle this because of the extra backslash.

I just tested and activating the null character removal makes this message pass. Likewise it should fix the original poster's issue




OK, learning lots today, ta. 

And of course you are correct, sending >>
msg.payload = new Buffer([0x00,0x24,0x57,0x49,0x4D,0x57,0x56,0x2C,0x33,0x34,0x35,0x2C,0x52,0x2C,0x30,0x2C,0x4E,0x2C,0x41,0x2A,0x32,0x31]);

with null at the start shows as \u0000$WIMWV,345,R,0,N,A*21, activate null char removal and it's $WIMWV,345,R,0,N,A*21

Every day a school day, for me anyway  Big Grin


RE: SignalK not receiving wind data - ash_perry - 2022-01-06

Thanks for the help guys! I hadn't restarted the signal K server after applying changes to remove null characters. Once restarted this worked although it was quite fun to play around with node-red. With help from PaddyB and google, I was able to create a flow which also solved the issue, although I think the 'remove null character' checkbox is going to be a little more stable.


RE: SignalK not receiving wind data - PaddyB - 2022-01-06

(2022-01-06, 08:57 AM)ash_perry Wrote: Thanks for the help guys! I hadn't restarted the signal K server after applying changes to remove null characters. Once restarted this worked although it was quite fun to play around with node-red. With help from PaddyB and google, I was able to create a flow which also solved the issue, although I think the 'remove null character' checkbox is going to be a little more stable.

cool, well done! Remove null way to go, though any time spent learning more node red is only a good thing, it's so powerful!  Cool