In this case i just want to make some simple counter but not using some node counter but only using function and this my flows
and this my json
[
{
"id": "dbacc92cfb48e54e",
"type": "function",
"z": "2c1af103.8bdcce",
"name": "function 7",
"func": "var value = 0;\n\nif (msg.payload===true){\n value = value + 1;\n}\n\nmsg.payload = {\n \"Count Value\" : value\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 1720,
"wires": [
[
"ca1525c14fcfd816"
]
]
},
{
"id": "ca1525c14fcfd816",
"type": "debug",
"z": "2c1af103.8bdcce",
"name": "debug 19",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 560,
"y": 1720,
"wires": []
},
{
"id": "ce533d4493b503c5",
"type": "inject",
"z": "2c1af103.8bdcce",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 250,
"y": 1720,
"wires": [
[
"dbacc92cfb48e54e"
]
]
}
]
in my debug when i press inject node it just count 1 and when i pressed again its count 1 again but not 2 can you help me please because i'm new in Node-RED