OpenMarine
Newbie alert: Getting errors both in Webapp and Node-RED - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: Node Red (https://forum.openmarine.net/forumdisplay.php?fid=15)
+--- Thread: Newbie alert: Getting errors both in Webapp and Node-RED (/showthread.php?tid=4066)



Newbie alert: Getting errors both in Webapp and Node-RED - Mastiff - 2022-05-25

To clarify, I'm a newbie with the Node-RED plugin for SignalK, I'm not a newbie with SignalK (been using that for a couple of years) or Node-RED (been using that for close to ten years for my smarthome and smartcabin). So I installed the plugin to my Pi, which runs SignalK, Node-RED, Home Assistant, a wifi router and a bunch of other stuff. I do a bit of Python, LUA and a tiny bit of YAML and JSON programming for the systems. I am also running a bunch of ESP-32, I think I have 8 in my 24' open pilothouse aluminium boat, which I use for fishing with shellfish pots and some rod and reel fishing. I wanted to have the possibility to log a few things from the plotter in Home Assistant, so I installed the Node-RED plug-in to send it from there to Hass with MQTT messages. But I get no joy, I'm sure it's an idiot mistake. I had a problem finding good info for the plug-in.

First of all I want to use the Node-RED instance I'm already running. Any 2 version won't work on my system, because I am running a few older things for my regular Node-RED, so I don't have the libraries that version 2 demands. So here is what I did: I installed the plug-in and tried to set it up, screenshot:

   

I don't get where that "unexpected token u" comes from, but I have a sneaking suspicion that it has something to do with my original Node-RED installation.

As for the Node-RED flow it's very simple:

Code:
[{"id":"cbbdb1aa.0c773","type":"signalk-notification","z":"85e2b9a.f39d948","name":"Dybde","notification":"environment.depth.belowTransducer","state":"any","x":115.66667175292969,"y":318.66668701171875,"wires":[["690f702.8d1ea9"]]},{"id":"690f702.8d1ea9","type":"debug","z":"85e2b9a.f39d948","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":320.66668701171875,"y":319.6666667461395,"wires":[]}]

In the Webapp I get: Cannot GET /undefined
And in Node-RED I get:

TypeError: Cannot read property 'subscribe' of undefined"

Can somebody please put me out of my misery here? Blush


RE: Newbie alert: Getting errors both in Webapp and Node-RED - Mastiff - 2022-05-31

Never mind, I found that using the MQTT bridge worked with a bit of tinkering, and a function node to convert to a type of message that I can use in Home Assistant.


RE: Newbie alert: Getting errors both in Webapp and Node-RED - Caribsailor - 2023-02-08

Glad you found your solution.

How you found your solution,  I'm sure might help the 775 views from your first post.

It would take me down a different rabbit hole.

Cheers


RE: Newbie alert: Getting errors both in Webapp and Node-RED - Mastiff - 2023-02-09

I removed the Node-RED plug-in for SignalK, that was incompatible with the stand-alone Node-RED that I have on the Pi. Then I used the Signal K - MQTT Gateway, ran a local MQTT server/broker in that plug-in on the port 1884 and sendt info from Node-RED to SignalK to that server/broker. The most fiddly thing turned out to be that I had to set a fixed client ID in Node-RED, or SignalK would open a new path each time I restarted Node-RED.


RE: Newbie alert: Getting errors both in Webapp and Node-RED - Caribsailor - 2023-02-11

(2023-02-09, 12:47 PM)Mastiff Wrote: I removed the Node-RED plug-in for SignalK, that was incompatible with the stand-alone Node-RED that I have on the Pi. Then I used the Signal K - MQTT Gateway, ran a local MQTT server/broker in that plug-in on the port 1884 and sendt info from Node-RED to SignalK to that server/broker. The most fiddly thing turned out to be that I had to set a fixed client ID in Node-RED, or SignalK would open a new path each time I restarted Node-RED.

Gracias!  That will help. I did go down that road also but not far enough. 

Its discouraging to me that so much work has to be done on the backend to get things to work. I 

I understand it is an open source project. But frustrating for a newby with out your back ground.

Thank you again... I'll keep learning


RE: Newbie alert: Getting errors both in Webapp and Node-RED - tkurki - 2023-02-12

The root cause for extra complexity in this case is using a standalone Node-RED.

If you install Node-RED from the Signal K App store SK integration works without any extra steps or need for MQTT server.

Longer explanation: there are two things at play here:

SK Node-RED plugin that runs nr embedded in SK server.

Node-RED library that contains nodes that integrate with SK data. This works ONLY when used with the embedded Node-RED.

Things get needlessly complex if you do not set things up the way they are supposed to fit together.


RE: Newbie alert: Getting errors both in Webapp and Node-RED - Caribsailor - 2023-02-12

(2023-02-12, 07:51 AM)tkurki Wrote: The root cause for extra complexity in this case is using a standalone Node-RED.

If you install Node-RED from the Signal K App store SK integration works without any extra steps or need for MQTT server.

Longer explanation: there are two things at play here:

SK Node-RED plugin that runs nr embedded in SK server.

Node-RED library that contains nodes that integrate with SK data. This works ONLY when used with the embedded Node-RED.

Things get needlessly complex if you do not set things up the way they are supposed to fit together.

AHHHH! I believe you solved my issue. 

I was unaware that Mqtt was integral with SignalK and installed Mqtt on my Pi

I will do a fresh install.

Thank you


RE: Newbie alert: Getting errors both in Webapp and Node-RED - tkurki - 2023-02-12

No, mqtt is not needed for using Node-RED with Signal K / using the Signal K flows in Node-RED.

Maybe you should describe what you are trying to achieve? Latching on to somebody else’s particular solution may or may not be fruitful.


RE: Newbie alert: Getting errors both in Webapp and Node-RED - Caribsailor - 2023-02-12

(2023-02-12, 04:33 PM)tkurki Wrote: No, mqtt is not needed for using Node-RED with Signal K / using the Signal K flows in Node-RED.

Maybe you should describe what you are trying to achieve? Latching on to somebody else’s particular solution may or may not be fruitful.
Agree. I am lerning that Smile

I have a esp32 with a hall effect sensor to measure water consumption with a virtual button to reset after taking on or making water.

the code for the esp32 is setup to send to mqtt. I had setup mqtt on my Pi4, so that may have caused a conflict with SK as the SK bridge to mqtt keep shutting down.


RE: Newbie alert: Getting errors both in Webapp and Node-RED - tkurki - 2023-02-13

Use a separate mqtt server and a node-RED flow in the embedded version to convert from what you get from sensor to SK.

Or convert esp to SensESP.