iuriaranda / signalk-mqtt-bridge

SignalK Node server plugin that acts as a bridge between SignalK data and MQTT
MIT License
5 stars 2 forks source link

Connected to mqtt but no deltas being sent #1

Closed dsc03GIT closed 1 year ago

dsc03GIT commented 1 year ago

I am trying to get signalk-mqtt-bridge working for a signalk - node-red connection.

In signalk it will send the initial keep alive message that I can then see in MQTT_Explorer. So I know that the plugin is configured and talking to the mqtt broker. In node-red Im sending an mqtt message with R/signalk/f005dc8c4fcd/keepalive as the topic and empty payload. This also shows in the MQTT_Explorer. But no deltas are getting published to mqtt broker. When I look at the signalk logs I’m getting the following error: Can you advise what I may be doing incorrectly? I’d really like to get this working, its exactly what I am looking for. It would allow me to get all my NMEA and Victron data in a consistant way into node_red for processing and feeding Home Assistant as my frontend. Im using on a live-aboard sailboat.

SignalK version 1.46.3 nodejs version 12.22.12 In signalk data browser all items have paths and look right to me.

I am curently using signalk to pull from Victron Cerbo and my NMEA via canbus on a pi. several options for getting the victron info. But I'm looking specifically for a way to get NMEA data to node-red

‘Jan 16 09:58:40 TypeError: path.replaceAll is not a function at signalkPathToMqttTopic (/home/pi/.signalk/node_modules/signalk-mqtt-bridge/index.js:323:17) at handleDelta (/home/pi/.signalk/node_modules/signalk-mqtt-bridge/index.js:177:36) at /usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1048:16 at /usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:463:23 at processAfters (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:359:11) at Object.inTransaction (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:439:9) at Dispatcher.push (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1214:24) at Dispatcher.handleEvent (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1267:17) at Bus.sink (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:242:17) at Bus.push (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:2371:21) at StreamBundle.push (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:68:19) at StreamBundle. (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:36:22) at Array.forEach () at processIems (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:35:19) at StreamBundle. (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:55:21) at Array.forEach ()’

iuriaranda commented 1 year ago

Interesting. Seems to be related to this: https://github.com/SignalK/signalk-server/issues/1473

So there seems to be possible to have deltas without a path. I'm going to add some logic to check for the correct formatting of a delta before processing it.

iuriaranda commented 1 year ago

I've pushed version 0.2.3 which should fix the plugin. This just makes the plugin to not crash when a delta is malformed, but it still seems that there's something generating malformed deltas in your system, so you might still have issues with other plugins or other parts of SignalK. The plugin should log any malformed delta, so hopefully it will help you debug that.