Skip to content

When subscribing to a Signalk path, if the signalk message is modified in node red it pushes (back?) to signalk. #52

Description

@bradharley

While making an email alert upon anchor drag in node-red, I inadvertently malformed js in one of my nodes and discovered that it pushed the message back to signalk without an update or put. It's 100% reproducible in my setup. Running latest signalk and node-red embedded. Here is my flow....

[{"id":"17fe088629366747","type":"signalk-subscribe","z":"a5a6fb9b9260c721","name":"Anchor Alarm","mode":"sendAll","flatten":true,"context":"vessels.self","path":"notifications.navigation.anchor","source":"","period":1000,"x":75,"y":72.66667366027832,"wires":[["b0c3e90f1a830281"]]},{"id":"3a5823dde992bfd7","type":"function","z":"a5a6fb9b9260c721","name":"function 5","func":"//var state = msg.payload.state;\n//be very careful to use == or it assigns\nif (msg.payload.state = "bugged")\n return msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":412.3333396911621,"y":77.0000057220459,"wires":[["6ada76a8271a5126","5cb4e6d9c5133f71"]]},{"id":"b0c3e90f1a830281","type":"delay","z":"a5a6fb9b9260c721","name":"","pauseType":"delay","timeout":"0","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":241.33333587646484,"y":92.33334827423096,"wires":[["3a5823dde992bfd7"]]},{"id":"d310e29ecd399890","type":"comment","z":"a5a6fb9b9260c721","name":"1s avoids overwrite to signalk","info":"If delay is < 1s, following assignments \nactually modify signalk rather than nodered\ndata. Odd.\n>","x":153.33334350585938,"y":115.66667556762695,"wires":[]}]

And here are screenshots demonstrating the activity. I changed the "emergency" status to "bugged" to illustrate the problem.

Image

Image

Steps to reproduce:

  1. Drop and set anchor.
  2. Load flow and deploy (or recreate)
  3. reduce/move radius to create alarm.

I believe you can do any anchor operation as step 3, but didn't try all permutations.

I don't believe it's expected behavior that modifying the message in node-red will actually impact the source signalk path without a put or update etc.

Also, if you put a delay in the flow 1s or greater, it doesn't impact the source signalk path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions