[{"id":"8f7657bd13cc9a4b","type":"comment","z":"b3b413d1.05b1b","name":"info","info":"This flow adds each subsequent value, and saves it back to flow context. An inject node then deletes the context value at each midnight.","x":145,"y":1525,"wires":[]},{"id":"74280b50.f704a4","type":"inject","z":"b3b413d1.05b1b","name":"1 kW feed","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"1000","payloadType":"str","x":165,"y":1565,"wires":[["5eb66b22.1a4de4"]]},{"id":"5eb66b22.1a4de4","type":"watt2kwh","z":"b3b413d1.05b1b","format":"kwh","maximum":"5","maximumunit":"mins","name":"","x":331,"y":1565,"wires":[["92e84adc.45c5e8"]]},{"id":"92e84adc.45c5e8","type":"function","z":"b3b413d1.05b1b","name":"Store kwh","func":"var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"energyVal\",0); \n } else {\nvar savedVal = flow.get('energyVal')||0;\nsavedVal += inputVal;\nflow.set(\"energyVal\",savedVal);\nmsg.payload = savedVal;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":485,"y":1605,"wires":[["486cc458.d7051c"]]},{"id":"486cc458.d7051c","type":"debug","z":"b3b413d1.05b1b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":645,"y":1605,"wires":[]},{"id":"6a75c8e5.1ee598","type":"inject","z":"b3b413d1.05b1b","name":"reset","repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":345,"y":1605,"wires":[["92e84adc.45c5e8"]]}]
