Folks, this is as convoluted as it gets.
NR 3.0.2
RasPi
Buster
pi@TelePi:~ $ node -v
v14.18.1
pi@TelePi:~ $
Yes, I am a bit of a subflow
adict. I also have a node resend last message
installed for the exact reason it says in it's documentation.
It is handy to debug
The story - as briefly as I can:
Something isn't working and I am trying to find out where it is failing.
I got this node (node-red-contrib-resend-last-msg
) to help me.
It was kind of working but also not.
I've been chasing my tail and I can not understand why what I am seeing is happening.
I send a message over MQTT
:
{"payload":{"payload":"TimePi temperature","device":"TimePi","what":"health","event":"TimePi TEST MESSAGE - over temperature.","colour":"red","state":"1","led":"rgb,7,10,10,0","priority":1},"topic":"EVENT/HEALTH/TimePi","_msgid":"27a9de74ce449fbd"}
So all the extra stuff is also received.
Good/Bad? Dunno, but it works - well, AFAIK, it does.
It is received at the remote end and stuck through a JSON
node.
This is what I receive and you can also see the problem happening here too, but weirdly further down this branch it is all ok.
I get this:
{"payload":"TimePi temperature","device":"TimePi","what":"health","event":"TimePi TEST MESSAGE - over temperature.","colour":"red","state":"1","led":"rgb,7,10,10,0","priority":1}
Great! All is good in the world.
It goes through other nodes and I get what I want for that branch of the flow.
I go back a bit and from the RAW message, I send it else where on the same machine and things go awry.
Sorry for the messy tab.
I was running in ever decreasing circles trying to find out what is/was going on.
(Screen shot)
See the incoming message.
ALL is good.
Ignore my subflow
as for a while I thought it was causing the problem.
Also ignore the resend last message
node. Same.
I put/send the message through a switch
node and it has reformatted the message.
See the red lines.
The msg.payload
has become msg.payload.payload{}
WHY? HOW?
If I put back my subflow
it happens after it rather than after the switch
node.
(See second screen shot)
If I open B
it is the same as A
message format.
But you can see in the GREEN debug
node, it is as I received it in the first screen shot.
I've been putting debug
nodes every where, can't see why it is happening.
Anyone?