SignalK / node-red-embedded

Node red nodes for use with the signalk-node-red plugin
Apache License 2.0
12 stars 2 forks source link

Signalk-send-pathvalue #21

Closed Darkleg closed 3 years ago

Darkleg commented 3 years ago

Hi I think I've populated the node correctly (topic,path) but only get: "TypeError: Cannot read property 'handleMessage; of defined"

Would really appreciate some guidance. Have attached a simplified flow, near to what I'm trying achieve.

Failed flows.docx

sbender9 commented 3 years ago

It looks like your using the Signal K pallet in a standalone node red install. You have to use the signalk-node-red plugin on your server and use the node red instance that is running in the SK server.

Darkleg commented 3 years ago

I really appreciate the rapid and informative knowledgeable response..saving a lot of frustration.....That has diffidently correct ...(sorted), genius!

tkurki commented 3 years ago

Can we detect that we are in standalone and show something informative?

Darkleg commented 3 years ago

Making a bit of progress with my understanding of the signalk workings until.........The notification example works fine (data stream plaka.log) have attempted to replicate with a fuel level indicator...via the WS gauge also works fine. But can't get subscribe node to send...have attached a few screens which I hope clarify my predicament?

Would appreciate some guidance. Thank you.

SignalK Server Notification_Alarm

sbender9 commented 3 years ago

Can click on one of the subscribe node and screenshot so I can see how it's setup?

Darkleg commented 3 years ago

Hi Opened subscribe

sbender9 commented 3 years ago

Looks ok. Can you export and share the nodes involved here?

Darkleg commented 3 years ago

Hoping this is the request:

[{"id":"c78652b5.a73b7","type":"signalk-subscribe","z":"38336563.2cc8e2","name":"tanks.fuel.level.currentLevel","mode":"sendAll","flatten":true,"context":"vessels.self","path":"tanks.fuel.level.currentLevel","source":"","period":1000,"x":180,"y":260,"wires":[["db2bf9c9.50a308"]]},{"id":"db2bf9c9.50a308","type":"switch","z":"38336563.2cc8e2","name":"Level","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"10","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":260,"wires":[["b85f3ec4.70399"]]},{"id":"b85f3ec4.70399","type":"signalk-send-notification","z":"38336563.2cc8e2","name":"send alarm","path":"highFuelLevel","state":"normal","message":"The tank is above 50%","visual":true,"sound":true,"source":"","x":630,"y":260,"wires":[]}]

sbender9 commented 3 years ago

Can you get me the nodes that send the value also?

Darkleg commented 3 years ago

Flow below. From ADS1115 0x48_2

Sender SS [{"id":"2e4fe0e1.8e0cc","type":"ads1x15-raspi","z":"356a2cdb.a50e04","property":"payload","name":"0x48_2","chip":"IC_ADS1115","i2c_address":"ADDRESS_0x48","channel":"CHANNEL_2","samplesPerSecond0":"SPS_920","samplesPerSecond1":"SPS_128","progGainAmp":"PGA_4_096V","x":225,"y":325,"wires":[["2d131494.34fd7c","84643c6b.56256"]]},{"id":"2d131494.34fd7c","type":"change","z":"356a2cdb.a50e04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.voltage","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":325,"wires":[["dff9f17b.6c323"]]},{"id":"dff9f17b.6c323","type":"function","z":"356a2cdb.a50e04","name":"convert","func":"var numInput = Number(msg.payload)4.84848484;\n//convert to round number\nmsg.payload = Math.round(numInput1000)/1000\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610,"y":325,"wires":[["c9e25aff.215608"]]},{"id":"c9e25aff.215608","type":"function","z":"356a2cdb.a50e04","name":"tanks.fuel.level.currentLevel","func":"msg.topic = \"tanks.fuel.level.currentLevel\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":820,"y":325,"wires":[["7a9ccdf2.f5f4e4"]]},{"id":"7a9ccdf2.f5f4e4","type":"signalk-send-pathvalue","z":"356a2cdb.a50e04","name":"","source":"","x":1195,"y":325,"wires":[]}]

sbender9 commented 3 years ago

OK, I need to go back and figure out why I did this, but by default data from node-red is ignored...

Change the $Source in your subscribe node to signalk-node-red and it should work.

Darkleg commented 3 years ago

Works brilliantly...many thanks for your help and patience...really appreciate it.

joeltaylorPAVS commented 3 years ago

Hi @sbender9

I appear to be having the same issue as above and have tried the signalk-node-red trick with no luck. could be a user error but i cannot get an output from the subscribe node. please see attached screen grabs of node and the server data source. the node red instance is hosted on the signalk server as a plugin.

image image