Closed anhorbc closed 1 year ago
Hey, I think the problem is in how you send the keepalive message. According the log you posted, the actual MQTT message value that the plugin is receiving is 0
:
May 25 14:55:11 2023-05-25T14:55:11.264Z signalk-mqtt-bridge Received message to topic R/signalk/265807290/keepalive: 0
Instead it should be something like:
May 25 14:55:11 2023-05-25T14:55:11.264Z signalk-mqtt-bridge Received message to topic R/signalk/265807290/keepalive: ["vessels/self/navigation/position"]
The plugin expects an array of strings, and it fails because it encounters a 0
.
I'd double check the mechanism / configuration of whatever you are using the send the keepalive message.
Hey, I think the problem is in how you send the keepalive message. According the log you posted, the actual MQTT message value that the plugin is receiving is
0
:May 25 14:55:11 2023-05-25T14:55:11.264Z signalk-mqtt-bridge Received message to topic R/signalk/265807290/keepalive: 0
Instead it should be something like:
May 25 14:55:11 2023-05-25T14:55:11.264Z signalk-mqtt-bridge Received message to topic R/signalk/265807290/keepalive: ["vessels/self/navigation/position"]
The plugin expects an array of strings, and it fails because it encounters a
0
.I'd double check the mechanism / configuration of whatever you are using the send the keepalive message.
I have tried with a few different MQTT clients, and also with a different MQTT broker. Still the same problem. Even when sending an empty message to the keepalive topic, I get the same response. Not sure how to troubleshoot from here.
/A
The oddest thing... I uninstalled the plugin and reinstalled it. After reboot there seemed to be some conflict with node red. I then disabled node red and rebooted. After that, the plugin started working again. I re-enabled node red, and rebooted one time more. Suddenly everything is working as expected!
Weird :thinking: Maybe something to do with the mqtt library...
In any case, the good old "have you tried turning it off and on again" trick worked yet once more :sweat_smile:
Hi! Great work on the bridge plugin! I do have a issue though. Previously I received data for subscribed topics. Not anymore. Not sure if it stopped working because of an update, or something else. I periodically send a request to topic R/signalk/265807290/keepalive, with the message ["vessels/self/navigation/position"] The log states this: May 25 14:55:11 2023-05-25T14:55:11.264Z signalk-mqtt-bridge Received message to topic R/signalk/265807290/keepalive: 0 May 25 14:55:11 TypeError: JSON.parse(...).forEach is not a function at handleKeepalive (/data/conf/signalk/node_modules/signalk-mqtt-bridge/index.js:167:27) at MqttClient.onMessage (/data/conf/signalk/node_modules/signalk-mqtt-bridge/index.js:144:11) at MqttClient.emit (events.js:400:28) at MqttClient._handlePublish (/data/conf/signalk/node_modules/mqtt/lib/client.js:1547:12) at MqttClient._handlePacket (/data/conf/signalk/node_modules/mqtt/lib/client.js:535:12) at work (/data/conf/signalk/node_modules/mqtt/lib/client.js:438:12) at Writable.writable._write (/data/conf/signalk/node_modules/mqtt/lib/client.js:452:5) at doWrite (/data/conf/signalk/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/data/conf/signalk/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/data/conf/signalk/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:302:11) at Socket.ondata (internal/streams/readable.js:726:22) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:290:12) at readableAddChunk (internal/streams/readable.js:265:9) at Socket.Readable.push (internal/streams/readable.js:204:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Any ideas?