Forward complete Message Object to MQTT

Hi,
i am playing with Node-Red on a raspberrymatic.
I receive messages from rpc-event (when windo opens or shutter closes or so). I connected this block to the MQTT sender. It all works and I can receive the values from Payload.
BUT I would like to receive the full message object, not only the payload with the 1 or 0 (open or closed).

Could tell me, how to put the full message object into the mqtt broker.

thanks

Welcome to the forum @habnefrage.

Put whatever you want into msg.payload. So, for example if you want msg.payload, msg.x, and msg.y then one way would be to feed it through a Change node configured to
Move msg.payload To msg.payload.payload
Move msg.x To msg.payload.x
Mover msg.y To msg.payload.y
and feed it to the MQTT node. Then if you are reading it in an MQTT In node configure it to Output a parsed JSON Object and then in you will get everything you need in the payload, and can reconstruct the original message if that is what you need.

You could also clone the msg and move it to payload using a function node, if you want everything.

let hold=RED.util.cloneMessage(msg);
msg.payload = hold
return msg;

Hammer!
Both approaches work. Thanks!