Add an var with memory var

Hello People of node red believers.
I am a problem with adding ( sum ) of an memory variable with a fresh variable like following.

TotalToday = SaveOpname + TotalToday

But is not working ( still get the same sum of the value's )
Meaning of this flow ( function ) is that the value is keep adding on the value before.

example of my function

let TussenVar = {};
let TotalToday = {};
let SaveOpname = {};
let Opname = {};
TotalToday = parseInt(flow.get("TotalToday"));
SaveOpname = parseInt(flow.get("Opname"));
TotalToday = SaveOpname + TotalToday;
msg.payload = TotalToday;
return msg;

I think this is an easy one , but stills failures on this easy flow.

Is there a tric to do what i want ?

this is the flow:

[{"id":"fec2a12e.68c73","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"e2678a2d.d07a68","type":"function","z":"fec2a12e.68c73","name":"","func":"let TussenVar = {};\nlet TotalToday = {};\nlet SaveOpname = {};\nlet Opname = {};\nTotalToday = parseInt(flow.get(\"TotalToday\"));\nSaveOpname = parseInt(flow.get(\"Opname\"));\nTotalToday = SaveOpname + TotalToday;\nmsg.payload = TotalToday; \nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n//var nothing = 0;\n//let TotalToday = 0;\n//let SaveOpname = 0;\n//let Opname = 0;\n//let TussenVar = 0;\n","finalize":"","libs":[],"x":460,"y":340,"wires":[["76996b81.60d704"]]},{"id":"3909ba4c.203486","type":"sma-webconnect","z":"fec2a12e.68c73","ip_address":"192.168.0.134","right":"usr","use_tls":true,"device_selection":"sb_tripower","x":640,"y":260,"wires":[["e2678a2d.d07a68","5c795b47.9375e4"]],"info":"{\r\n    \"sma_config\": {\r\n        \"id\": \"1\",\r\n        \"values\": {\r\n            \"6100_0046E500\": {\r\n                \"name\": \"phase1_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E600\": {\r\n                \"name\": \"phase2_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E700\": {\r\n                \"name\": \"phase3_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_40463600\": {\r\n                \"name\": \"grid_feedin\",\r\n                \"divider\": 1\r\n            },\r\n            \"6400_00262200\": {\r\n                \"name\": \"daily\",\r\n                \"divider\": 1\r\n            },\r\n            \"6100_40263F00\": {\r\n                \"name\": \"power\",\r\n                \"divider\": 1\r\n            }\r\n        }\r\n    }\r\n}"},{"id":"8ffb32a9.9ae3b","type":"inject","z":"fec2a12e.68c73","name":"Solar opname per sec","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":260,"wires":[["3909ba4c.203486"]],"info":"{\n    \"sma_config\": {\n        \"id\": \"1\",\n        \"values\": {\n            \"v6100_402613F00\": {\n                \"name\": \"power\",\n                \"divider\": 1\n            }\n        }\n    }\n}"},{"id":"76996b81.60d704","type":"debug","z":"fec2a12e.68c73","name":"opname","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":360,"wires":[]},{"id":"8da23ee9.f2949","type":"inject","z":"fec2a12e.68c73","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":350,"y":440,"wires":[["217ff9b5.6822c6","de712ae5.7b0688"]]},{"id":"217ff9b5.6822c6","type":"change","z":"fec2a12e.68c73","name":"","rules":[{"t":"set","p":"SaveOpname","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":440,"wires":[[]]},{"id":"de712ae5.7b0688","type":"change","z":"fec2a12e.68c73","name":"","rules":[{"t":"set","p":"TussenVar","pt":"flow","to":"1000","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":480,"wires":[[]]},{"id":"5c795b47.9375e4","type":"change","z":"fec2a12e.68c73","name":"","rules":[{"t":"set","p":"Opname","pt":"flow","to":"payload.power","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":200,"wires":[[]]}]

So where do you save TotalToday back to the flow variable?

something like this ?

let TussenVar = {};
let TotalToday = {};
let SaveOpname = {};
let Opname = {};
TotalToday = parseInt(flow.get("TotalToday"));
SaveOpname = parseInt(flow.get("Opname"));
TotalToday = SaveOpname + TotalToday;
TotalToday = (flow.set("TotalToday"));
msg.payload = TotalToday;
return msg;

ps: for me is this more than try and error :wink:

[{"id":"d6edefe9.dc1ba","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"79bcf5e9.0abcfc","type":"sma-webconnect","z":"d6edefe9.dc1ba","ip_address":"192.168.0.134","right":"usr","use_tls":true,"device_selection":"sb_tripower","x":520,"y":240,"wires":[["99965b2e.440d98","12c292d1.f41d9d"]],"info":"{\r\n    \"sma_config\": {\r\n        \"id\": \"1\",\r\n        \"values\": {\r\n            \"6100_0046E500\": {\r\n                \"name\": \"phase1_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E600\": {\r\n                \"name\": \"phase2_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E700\": {\r\n                \"name\": \"phase3_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_40463600\": {\r\n                \"name\": \"grid_feedin\",\r\n                \"divider\": 1\r\n            },\r\n            \"6400_00262200\": {\r\n                \"name\": \"daily\",\r\n                \"divider\": 1\r\n            },\r\n            \"6100_40263F00\": {\r\n                \"name\": \"power\",\r\n                \"divider\": 1\r\n            }\r\n        }\r\n    }\r\n}"},{"id":"6eace899.257068","type":"inject","z":"d6edefe9.dc1ba","name":"Solar opname per sec","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":240,"wires":[["79bcf5e9.0abcfc"]],"info":"{\n    \"sma_config\": {\n        \"id\": \"1\",\n        \"values\": {\n            \"v6100_402613F00\": {\n                \"name\": \"power\",\n                \"divider\": 1\n            }\n        }\n    }\n}"},{"id":"95247094.bdc96","type":"inject","z":"d6edefe9.dc1ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":280,"wires":[["816aa34c.5d174","e1a6af68.75aff","4175cee9.28776"]]},{"id":"816aa34c.5d174","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"SaveOpname","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":280,"wires":[[]]},{"id":"e1a6af68.75aff","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"TussenVar","pt":"flow","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":320,"wires":[[]]},{"id":"4175cee9.28776","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"TotalToday","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":360,"wires":[[]]},{"id":"12c292d1.f41d9d","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"Opname","pt":"flow","to":"payload.power","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":240,"wires":[[]]},{"id":"99965b2e.440d98","type":"function","z":"d6edefe9.dc1ba","name":"","func":"let TussenVar  = {};\nlet TotalToday = {};\nlet SaveOpname = {};\nlet Opname     = {};\nTotalToday  = parseInt(flow.get(\"TotalToday\"));\nSaveOpname  = parseInt(flow.get(\"Opname\"));\nTotalToday  = SaveOpname + TotalToday ;\nmsg.payload = TotalToday;\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n//var nothing = 0;\n//let TotalToday = 0;\n//let SaveOpname = 0;\n//let Opname = 0;\n//let TussenVar = 0;\n","finalize":"","libs":[],"x":740,"y":200,"wires":[["ecd37acf.2319f8"]]},{"id":"ecd37acf.2319f8","type":"debug","z":"d6edefe9.dc1ba","name":"opname","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":200,"wires":[]}]

NaN is now the output , but after give a new timestamp on initialise than it give me a output without the sum.

Also not working with this try

let TussenVar = {};
let TotalToday = context.get('TotalToday') || 0;
let SaveOpname = {};
let Opname = {};
TotalToday = parseInt(flow.get("TotalToday"));
SaveOpname = parseInt(flow.get("Opname"));
TotalToday += SaveOpname;
context.set('TotalToday', TotalToday);
msg.payload = TotalToday;
return msg;

You are mixing context and flow context storage, also you can not store the opname and retrieve it before it is stored.

let SaveOpname = 0;
let TotalToday  = parseInt(flow.get("TotalToday") || 0);
SaveOpname  = parseInt(msg.payload.power);
msg.payload  = SaveOpname + TotalToday ;
flow.set("TotalToday", msg.payload);
return msg;

Yes , I got it in the same time of you E1cid :slight_smile:
Indeed the context and get, set thing always I mixed that :frowning:

[{"id":"d6edefe9.dc1ba","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"407d95de.f12a6c","type":"function","z":"d6edefe9.dc1ba","name":"","func":"let TussenVar  = {};\nlet TotalToday = {};\nlet SaveOpname = {};\nlet Opname     = {};\nTotalToday  = parseInt(flow.get(\"TotalToday\"));\nSaveOpname  = parseInt(flow.get(\"Opname\"));\nTotalToday  += SaveOpname;\nflow.set(\"TotalToday\",TotalToday);\nmsg.payload = TotalToday;\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n//var nothing = 0;\n//let TotalToday = 0;\n//let SaveOpname = 0;\n//let Opname = 0;\n//let TussenVar = 0;\n","finalize":"","libs":[],"x":700,"y":300,"wires":[["b2f63b67.d2ffb8","b83f5bb2.17c0f8"]]},{"id":"b2f63b67.d2ffb8","type":"debug","z":"d6edefe9.dc1ba","name":"opname","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":920,"y":300,"wires":[]},{"id":"cf2bca7b.710f88","type":"sma-webconnect","z":"d6edefe9.dc1ba","ip_address":"192.168.0.134","right":"usr","use_tls":true,"device_selection":"sb_tripower","x":520,"y":260,"wires":[["407d95de.f12a6c","c01c8cac.d8c68"]],"info":"{\r\n    \"sma_config\": {\r\n        \"id\": \"1\",\r\n        \"values\": {\r\n            \"6100_0046E500\": {\r\n                \"name\": \"phase1_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E600\": {\r\n                \"name\": \"phase2_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E700\": {\r\n                \"name\": \"phase3_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_40463600\": {\r\n                \"name\": \"grid_feedin\",\r\n                \"divider\": 1\r\n            },\r\n            \"6400_00262200\": {\r\n                \"name\": \"daily\",\r\n                \"divider\": 1\r\n            },\r\n            \"6100_40263F00\": {\r\n                \"name\": \"power\",\r\n                \"divider\": 1\r\n            }\r\n        }\r\n    }\r\n}"},{"id":"affca1a4.92e02","type":"inject","z":"d6edefe9.dc1ba","name":"Solar opname per sec","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":260,"wires":[["cf2bca7b.710f88"]],"info":"{\n    \"sma_config\": {\n        \"id\": \"1\",\n        \"values\": {\n            \"v6100_402613F00\": {\n                \"name\": \"power\",\n                \"divider\": 1\n            }\n        }\n    }\n}"},{"id":"b83f5bb2.17c0f8","type":"ui_chart","z":"d6edefe9.dc1ba","name":"","group":"c6589eb6.bab1e","order":0,"width":0,"height":0,"label":"chart","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":910,"y":260,"wires":[[]]},{"id":"28c5c27e.e3a17e","type":"inject","z":"d6edefe9.dc1ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":340,"wires":[["be95745d.20b648","d49da354.542c","eb7c2800.0e88b8"]]},{"id":"be95745d.20b648","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"SaveOpname","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":340,"wires":[[]]},{"id":"c01c8cac.d8c68","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"Opname","pt":"flow","to":"payload.power","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":260,"wires":[[]]},{"id":"d49da354.542c","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"TussenVar","pt":"flow","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":380,"wires":[[]]},{"id":"eb7c2800.0e88b8","type":"change","z":"d6edefe9.dc1ba","name":"","rules":[{"t":"set","p":"TotalToday","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":420,"wires":[[]]},{"id":"c6589eb6.bab1e","type":"ui_group","name":"test optellen dagwaarden","tab":"d7901f40.2659d","order":4,"disp":true,"width":"6","collapse":false},{"id":"d7901f40.2659d","type":"ui_tab","name":"Charts","icon":"dashboard","order":4}]

Finaly :smile: that was a part of my life

This is the function that do the correct thing I want:

let TussenVar = {};
let TotalToday = {};
let SaveOpname = {};
let Opname = {};
TotalToday = parseInt(flow.get("TotalToday"));
SaveOpname = parseInt(flow.get("Opname"));
TotalToday += SaveOpname;
flow.set("TotalToday",TotalToday);
msg.payload = TotalToday;
return msg;

1 Like

Hello Dimpie,

Welcome to the community and good to see that you found your first solution here. :slight_smile:

I just want to point you to an alternative solution I found in the forum these days to add/ increment easily a value to a global variable:

Might reduce lines in the code :slight_smile:

Cheers
Ranki

Hello Ranki, Thanks for that solution. It looks a nice extra for later.
But for now I think its not working in my case. I want to add with a variable. So i try this with Json change node like your post but with an extra variable :

$globalContext("SaveOpname")+$globalContext("Opname")

but give's me every time the same "Opname" Value.
It was a good try for me to learn more about that Json string.

See the flow

[{"id":"cdd9d760.82b0e8","type":"tab","label":"Flow 10","disabled":false,"info":""},{"id":"e922da56.888768","type":"function","z":"cdd9d760.82b0e8","name":"","func":"let StartValue    = flow.get(\"StartValue\");\nlet StopValue     = flow.get(\"StopValue\");\nlet GeheugenTotal = {};\nlet TussenVar     = {};\nlet TotalToday    = {};\nlet SaveOpname    = {};\nlet Opname        = {};\n\nif (StartValue == true) {\n    TotalToday = 0;\n    flow.set(\"TotalToday\",TotalToday);\n    StartValue = false;\n    flow.set(\"StartValue\",StartValue);\n}\nelse {\n    TotalToday  = parseFloat(flow.get(\"TotalToday\"));\n    SaveOpname  = (parseFloat(flow.get(\"Opname\")))/3600;\n    TotalToday  += SaveOpname;\n\n    flow.set(\"TotalToday\",TotalToday);\n        if (StopValue == true ) {\n        GeheugenTotal = TotalToday;\n        flow.set(\"GeheugenTotal\",GeheugenTotal);\n        StopValue = false;\n        flow.set(\"StopValue\",StopValue);\n    }\n}\nmsg.payload = Number (TotalToday.toFixed(2));\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n//var nothing = 0;\n//let TotalToday = 0;\n//let SaveOpname = 0;\n//let Opname = 0;\n//let TussenVar = 0;\n","finalize":"","libs":[],"x":620,"y":280,"wires":[["2509c804.c0a518","fea5b28d.dfd81"]]},{"id":"2509c804.c0a518","type":"debug","z":"cdd9d760.82b0e8","name":"opname","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":320,"wires":[]},{"id":"6cf15d42.4760b4","type":"sma-webconnect","z":"cdd9d760.82b0e8","ip_address":"192.168.0.134","right":"usr","use_tls":true,"device_selection":"sb_tripower","x":400,"y":240,"wires":[["e922da56.888768","616b207f.f7275","d0c0e09b.803fd","79bbc500.681d0c"]],"info":"{\r\n    \"sma_config\": {\r\n        \"id\": \"1\",\r\n        \"values\": {\r\n            \"6100_0046E500\": {\r\n                \"name\": \"phase1_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E600\": {\r\n                \"name\": \"phase2_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_0046E700\": {\r\n                \"name\": \"phase3_voltage\",\r\n                \"divider\": 100\r\n            },\r\n            \"6100_40463600\": {\r\n                \"name\": \"grid_feedin\",\r\n                \"divider\": 1\r\n            },\r\n            \"6400_00262200\": {\r\n                \"name\": \"daily\",\r\n                \"divider\": 1\r\n            },\r\n            \"6100_40263F00\": {\r\n                \"name\": \"power\",\r\n                \"divider\": 1\r\n            }\r\n        }\r\n    }\r\n}"},{"id":"d4bb8d3a.b1bda","type":"inject","z":"cdd9d760.82b0e8","name":"Solar opname per sec","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":240,"wires":[["6cf15d42.4760b4"]],"info":"{\n    \"sma_config\": {\n        \"id\": \"1\",\n        \"values\": {\n            \"v6100_402613F00\": {\n                \"name\": \"power\",\n                \"divider\": 1\n            }\n        }\n    }\n}"},{"id":"fea5b28d.dfd81","type":"ui_chart","z":"cdd9d760.82b0e8","name":"","group":"c6589eb6.bab1e","order":0,"width":0,"height":0,"label":"chart","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":790,"y":240,"wires":[[]]},{"id":"812f7f56.e17c2","type":"inject","z":"cdd9d760.82b0e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":280,"wires":[["dfe83940.e5aeb8","672639b3.e3d968","fa4e17f8.0bcbf8"]]},{"id":"dfe83940.e5aeb8","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"SaveOpname","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":320,"wires":[[]]},{"id":"616b207f.f7275","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"Opname","pt":"flow","to":"payload.power","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":240,"wires":[[]]},{"id":"672639b3.e3d968","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"TussenVar","pt":"flow","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":360,"wires":[[]]},{"id":"fa4e17f8.0bcbf8","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"TotalToday","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":400,"wires":[[]]},{"id":"d0c0e09b.803fd","type":"function","z":"cdd9d760.82b0e8","name":"","func":"let StartValue    = flow.get(\"StartValue\");\nlet StopValue     = flow.get(\"StopValue\");\nlet GeheugenTotal = flow.get(\"GeheugenTotal\");\nlet TussenVar     = {};\nlet TotalToday    = {};\nlet SaveOpname    = {};\nlet Opname        = {};\n\nif (StartValue == true) {\n    TotalToday = 0;\n    flow.set(\"TotalToday\",TotalToday);\n    StartValue = false;\n    flow.set(\"StartValue\",StartValue);\n}\nelse {\n    TotalToday  = parseFloat(flow.get(\"TotalToday\"));\n    SaveOpname  = (parseFloat(flow.get(\"Opname\")))/3600;\n    TotalToday  += SaveOpname;\n\n    flow.set(\"TotalToday\",TotalToday);\n        if (StopValue == true ) {\n        GeheugenTotal = TotalToday;\n        flow.set(\"GeheugenTotal\",GeheugenTotal);\n        StopValue = false;\n        flow.set(\"StopValue\",StopValue);\n    }\n}\nmsg.payload = GeheugenTotal;\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n//var nothing = 0;\n//let TotalToday = 0;\n//let SaveOpname = 0;\n//let Opname = 0;\n//let TussenVar = 0;\n","finalize":"","libs":[],"x":620,"y":340,"wires":[["8102f757.972788"]]},{"id":"8102f757.972788","type":"debug","z":"cdd9d760.82b0e8","name":"geheugen","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":360,"wires":[]},{"id":"8e22b7c0.32eea8","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"GeheugenTotal","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":460,"wires":[[]]},{"id":"4dce9a86.8fed14","type":"inject","z":"cdd9d760.82b0e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":460,"wires":[["8e22b7c0.32eea8","fc44edb1.66168"]]},{"id":"5b053d32.77de94","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"SaveOpname\")+$globalContext(\"Opname\") ","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":80,"wires":[["5d4e1697.ae2688"]]},{"id":"5d4e1697.ae2688","type":"debug","z":"cdd9d760.82b0e8","name":"test change","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":80,"wires":[]},{"id":"79bbc500.681d0c","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"Opname","pt":"global","to":"payload.power","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":100,"wires":[["5b053d32.77de94"]]},{"id":"fc44edb1.66168","type":"change","z":"cdd9d760.82b0e8","name":"","rules":[{"t":"set","p":"SaveOpname","pt":"global","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":60,"wires":[["5b053d32.77de94"]]},{"id":"c6589eb6.bab1e","type":"ui_group","name":"test optellen dagwaarden","tab":"d7901f40.2659d","order":4,"disp":true,"width":"6","collapse":false},{"id":"d7901f40.2659d","type":"ui_tab","name":"Charts","icon":"dashboard","order":4}]