I have node-red v0.19.3 running on armbian on an orangepi zero.
I have a snap of mosquitto running on the orangepi zero, so it is running default settings with no fiddling by me.
I have a WEMOS D1 R2 MINI as client.
I sent a payload of 123456 as either string or number (I have tried byte buffer as well to no avail).
Even if I hand unpack the payload byte by byte at WEMOS end, I get chars 2,3,8,3,,r instead of 1,2,3,4,5,6 or bytes [49,50,51,52,53,54] so it looks like I am receiving [50,51,56,51,0,114] instead.
Payload is sent using out of the box inject node loaded with string 123456 as payload and sent by out of the box mqtt output node.
Unpacking at WEMOS end is otherwise the standard:
String resultString = "";
for (unsigned int i=0; i<length; i++) {
resultString += (char)payload[i];
}
I am otherwise not having problems with the topics since, obviously, I need to catch a topic to see the problem with the payload.
Topic length is a mere 28 characters of the format:
/xxxxxxxxxxxxxx/yyyyyyy/z/f
xxxxxxxxxxxxxx is the app I am building and is there to set it apart from other app I am running through the MQTT server.
yyyyyyy will be the chipID of the WEMOS I am talking to
z is a relay index on the WEMOS
f is 0 for off or 1 for on
The errant payload is a time it milliseconds for the relay to turn on.
I have only one topic using the payload.
I am otherwise stuck at the moment as it is quite a straight forward payload unpacking problem, using code other people have used. The length being returned with the payload always appears to be the length of the string I have sent.
Any ideas please?
Cheers,
Ray