Example wanted for node-red-contrib-protobuf

#1

Hello,

I am trying to decode protobuf data on incoming MQTT messages.
For this I am trying to use the node-red-contrib-protobuf node, but sofar its driving me crazy...
Although it produces error messages, further documentation is missing, so I do not know what to correct.
An example flow with an inject node that simulates data and an matching .proto file would be very helpfull.

My setup/data:
Inject node, simulating: (input to protobuf node)
msg : Object
object
_msgid: "bf2cd2cc.4e863"
topic: ""
payload: buffer[5]raw
0: 0xd
1: 0x0
2: 0x0
3: 0x40
4: 0x40

Output of protobuf node:
msg : string[79]
"Message is not valid under selected message type. fLoadVoltage: number expected"

Protofile
syntax = "proto2";

message SolarMeasurement {
required float fLoadVoltage = 1;
}

Looking at the error message the node able to read and decode the file but some raises an error.
So I tried to decode the data on an online decoder (https://protogen.marcgravell.com/decode):
0D00004040

Online Protobuf Decoder.

0D = field 1 , type Fixed32
00-00-40-40 = 1077936128 (integer) or 3 (floating point)

According to the online form the data is OK, as it contains a float number 3.0.

So any help or tips are greatly appreciated.

Thanks in advance,

Robin

0 Likes

#2

I think I may experienced similar issue.

Try this out if it will help: https://github.com/defonzie/node-red-contrib-protobuf/commit/d3c30194da77b1358b23142443189a1b59ebd7a8

0 Likes