How to use Send NMEA2000 to output PGN 127505 (Fluid Level)

I am new to Signal-K and Node-Red, so please excuse me if this is obvious to more experienced users. I have a Victron Cerbo running Signal-K and Node-Red. I have ultrasonic fluid transducers that provide highly varying level readings. I want to smooth the data and send out a level of the data over the past 30 seconds using a different instance. So here's what I've done:

Subscribe to tanks.freshWater.1.currentLevel (which outputs every 2.5 seconds)
Feed that into a smooth function which outputs every 12 results (every 30 seconds)
Feed the output of the smooth into a function that contains:

const pgn = {
  "pgn": 127505,
  "Instance": 102,
  "Type": "Fresh Water",
  "Level": Number(level),
  "Capacity": 0.1
}
msg.payload = pgn;
return msg;

This msg.payload is the input for signalk-send-nmea2000. However, I don't see a tanks.freshWater.102 appear.

What am I doing wrong? I'm guessing that I have the wrong Type, but can't find where TANK_TYPE is defined.

Here's the definition of PGN 127505:

     127505,
     PACKET_COMPLETE,
     PACKET_SINGLE,
     {SIMPLE_FIELD(PK("Instance"), 4),
      LOOKUP_FIELD("Type", 4, TANK_TYPE),
      PERCENTAGE_I16_FIELD("Level"),
      VOLUME_UFIX32_DL_FIELD("Capacity"),
      RESERVED_FIELD(BYTES(1)),
      END_OF_FIELDS},
     .priority = 6,
     .url      = "https://web.archive.org/web/20060511065306/http://www.maretron.com/support/manuals/TLA100UM_1.2.pdf",
     .interval = 2500}```

I am not entirely sure what you are asking about.

If you feed the output of your function into a debug node do you see what you expect?

Is that the complete function you have posted? If so then level is undefined and that should show with a red line under it to tell you there is a problem
image

Sorry, I thought that I had copied the entire function code. Here's the missing line at the top:

var level = msg.payload;

I do feed it into a debug node, and the output of the debug node is precisely as expected.

Once again, I suspect that my TANK_TYPE is in error, but that may be completely wrong. How do I find out what valid TANK_TYPE values are? Alternately, does signalk-send-nmea2000 return an error that I can view?

OK, in which case there wasn't any need to post the function, you could just have shown us what comes out of it.

I think you will need someone who knows about signalK and the particular node you are using.

To answer my own questions, here are the issues that I was dealing with. I ended up resolving this by reading the PGN 127505 SignalK code.

  1. I thought that the Instance field was 8 bits. It's not. It's 4 bits, so the instance has to be between 0 & 15. I was using 102 and it was returning 0.
  2. The Type field is an enumerated field, and the list of valid entries in the SignalK specification doesn't match what the code uses. The actual values are "Fuel", 'Water", "Gray water", "Live well", "Oil", and "Black water". If what you supply doesn't match, it returns 0, which is "Water".

So all along it was outputting values for Water with an instance of 0, which matched what the actual sensor was sending.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.