[{"id":"e397736b.a96af","type":"inject","z":"4829bfa2.a23c5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["900ad01c.561f"]]},{"id":"1e2a78d6.33f617","type":"debug","z":"4829bfa2.a23c5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":120,"wires":[]},{"id":"83d3f2fd.593b4","type":"comment","z":"4829bfa2.a23c5","name":"setup and close","info":"The function node code provide setup and closecode. \nThe `Setup` tab contains code that will be run whenever the node is started. The `Close` tab contains code that will be run when the node is stopped.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":60,"wires":[]},{"id":"900ad01c.561f","type":"function","z":"4829bfa2.a23c5","name":"counter","func":"// get value of global counter\nvar count = global.get('count');\ncount += 1;\n// store the value back\nglobal.set('count',count);\n// make it part of the outgoing msg object\nmsg.payload = count;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"// initialize global counter\nglobal.set('count', 0);","finalize":"// report current counter to console\nvar count = global.get('count');\nconsole.log(\"count:\", count);","x":340,"y":120,"wires":[["1e2a78d6.33f617"]]}]