# Function node sends multiple messages instead of one

**URL:** <https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843>\
**Category:** General\
**Tags:** function-node\
**Created:** [20 December 2023 00:24 UTC](https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843 "2023-12-20T00:24:19Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ChrisG](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@ChrisG](https://discourse.nodered.org/u/ChrisG)\
**Post date:** [20 December 2023 07:51 UTC](https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843/7 "2023-12-20T07:51:48Z")

</div>

Ah Steve,

Here is the flow with a 2nd speed node and ticks:-

```auto
[{"id":"4b211f23c08b43f4","type":"tab","label":"Flow 5","disabled":false,"info":"","env":[]},{"id":"af5483388c10dfb5","type":"function","z":"4b211f23c08b43f4","name":"Combine 6 global variables into one payload","func":"msg.payload = \n\n{\n\n \"solarPvId\" : flow.get(\"solarPvId\"),\n \"solarPvTimestamp\" : flow.get(\"solarPvTimestamp\"),\n \"currentGeneratingUnitsW\" : flow.get(\"currentGeneratingUnitsW\"),\n \"exportingUnintsW\" : flow.get(\"exportingUnintsW\"),\n \"currentDayGeneratedW\" : flow.get(\"currentDayGeneratedW\"),\n \"currentDayExportedW\" : flow.get(\"currentDayExportedW\")\n\n}\nnode.send(msg);\n\n//return msg;\n\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":140,"wires":[["cb470dd8032cfddf"]]},{"id":"8284852709ca22a8","type":"debug","z":"4b211f23c08b43f4","name":"dB payload","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1330,"y":140,"wires":[]},{"id":"638a99cd0d575a4e","type":"msg-speed","z":"4b211f23c08b43f4","name":"","frequency":"hour","interval":1,"estimation":false,"ignore":false,"pauseAtStartup":false,"topicDependent":false,"x":510,"y":140,"wires":[["af5483388c10dfb5"],[]]},{"id":"ea1bc11cc99b2091","type":"inject","z":"4b211f23c08b43f4","name":"Every 1m","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"10","topic":"","payload":"","payloadType":"date","x":250,"y":140,"wires":[["638a99cd0d575a4e"]]},{"id":"cb470dd8032cfddf","type":"msg-speed","z":"4b211f23c08b43f4","name":"","frequency":"hour","interval":1,"estimation":false,"ignore":false,"pauseAtStartup":false,"topicDependent":false,"x":1130,"y":140,"wires":[["8284852709ca22a8"],[]]}]

```

I've added a 2nd speed count which clearly shows messages out of the function isn't 1-2-1 with messages in.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/d/cdfa17af522a2d8c7b7cc4e2e871c782240a43df.png)

---

_[View the full topic](https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843)._
