Hi. at this code in node red, function in example 1 is good result, but in example 2 with mqtt transfer, it is show undefined result.
please guide.
[{"id":"4d0131.4da19ed","type":"inject","z":"ee4e8046.bf62c","name":"health","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"body_temprature\":37.5,\"heartbeat\":82}","payloadType":"json","x":150,"y":360,"wires":[["9593b787.e61a28"]]},{"id":"af830ac4.6d6e38","type":"function","z":"ee4e8046.bf62c","name":"","func":"var newMsg = { payload: msg.payload.heartbeat };\n\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":440,"wires":[["32c18820.84d5b8"]]},{"id":"32c18820.84d5b8","type":"debug","z":"ee4e8046.bf62c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":440,"wires":[]},{"id":"9593b787.e61a28","type":"mqtt out","z":"ee4e8046.bf62c","name":"","topic":"123","qos":"","retain":"","broker":"407a01e4.6b637","x":350,"y":360,"wires":[]},{"id":"9a7866c5.440b98","type":"mqtt in","z":"ee4e8046.bf62c","name":"","topic":"123","qos":"2","datatype":"auto","broker":"407a01e4.6b637","x":130,"y":440,"wires":[["af830ac4.6d6e38"]]},{"id":"fccfd442.274658","type":"aedes broker","z":"ee4e8046.bf62c","name":"broker","mqtt_port":"1884","mqtt_ws_port":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":510,"y":360,"wires":[[]]},{"id":"ec916e73.1e98c","type":"inject","z":"ee4e8046.bf62c","name":"health","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"body_temprature\":37.5,\"heartbeat\":82}","payloadType":"json","x":150,"y":120,"wires":[["f3f4769e.4ca9b8"]]},{"id":"f3f4769e.4ca9b8","type":"function","z":"ee4e8046.bf62c","name":"","func":"var newMsg = { payload: msg.payload.heartbeat };\n\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":120,"wires":[["a0cddb7f.b0ca58"]]},{"id":"a0cddb7f.b0ca58","type":"debug","z":"ee4e8046.bf62c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":120,"wires":[]},{"id":"407a01e4.6b637","type":"mqtt-broker","name":"","broker":"localhost","port":"1884","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]