This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie alert: Getting errors both in Webapp and Node-RED
#1
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
Reply
#2
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.
Reply
#3
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
Cheers

Caribsailor  Cool

Beneteuau First 38 "Decadence I"
Pi4B, 64bit 8GB, 32G-SD, OP 3.0, OC  FP
Reply
#4
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.
Reply
#5
(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
Cheers

Caribsailor  Cool

Beneteuau First 38 "Decadence I"
Pi4B, 64bit 8GB, 32G-SD, OP 3.0, OC  FP
Reply
#6
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.
Reply
#7
(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
Cheers

Caribsailor  Cool

Beneteuau First 38 "Decadence I"
Pi4B, 64bit 8GB, 32G-SD, OP 3.0, OC  FP
Reply
#8
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.
Reply
#9
(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.
Cheers

Caribsailor  Cool

Beneteuau First 38 "Decadence I"
Pi4B, 64bit 8GB, 32G-SD, OP 3.0, OC  FP
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)