I further my point : 2 identical flows, one injecting 1 kW/s, the other 2 kW/s. they give the same energy stored. Please help !
[
{
"id": "72985628cd69b236",
"type": "function",
"z": "4fe759c01b309d0a",
"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": 620,
"y": 2520,
"wires": [
[
"2f7c403dc696f005",
"62fc58e95b92ba3f",
"75c409b68ba81ef1"
]
]
},
{
"id": "f0342efc1df3ec36",
"type": "watt2kwh",
"z": "4fe759c01b309d0a",
"format": "kwh",
"maximum": "60",
"maximumunit": "mins",
"name": "",
"x": 380,
"y": 2480,
"wires": [
[
"72985628cd69b236"
]
]
},
{
"id": "8a6d0f53c496353c",
"type": "inject",
"z": "4fe759c01b309d0a",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "1",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1000",
"payloadType": "num",
"x": 180,
"y": 2540,
"wires": [
[
"f0342efc1df3ec36"
]
]
},
{
"id": "2f7c403dc696f005",
"type": "debug",
"z": "4fe759c01b309d0a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 2480,
"wires": []
},
{
"id": "400ccdd38c87a58a",
"type": "function",
"z": "4fe759c01b309d0a",
"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": 620,
"y": 2640,
"wires": [
[
"6c9caf2dc266bf9a",
"844083559b2e28ed",
"ac0beed0fc15f477"
]
]
},
{
"id": "38d80f0408df092e",
"type": "watt2kwh",
"z": "4fe759c01b309d0a",
"format": "kwh",
"maximum": "60",
"maximumunit": "mins",
"name": "",
"x": 380,
"y": 2600,
"wires": [
[
"400ccdd38c87a58a"
]
]
},
{
"id": "3fd908d1c1f43cda",
"type": "inject",
"z": "4fe759c01b309d0a",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "1",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "2000",
"payloadType": "num",
"x": 180,
"y": 2660,
"wires": [
[
"38d80f0408df092e"
]
]
},
{
"id": "6c9caf2dc266bf9a",
"type": "debug",
"z": "4fe759c01b309d0a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 2600,
"wires": []
},
{
"id": "844083559b2e28ed",
"type": "ui_chart",
"z": "4fe759c01b309d0a",
"name": "",
"group": "54ec15a15f8c33b7",
"order": 1,
"width": 0,
"height": 0,
"label": "2 kW/s",
"chartType": "line",
"legend": "false",
"xformat": "dd HH:mm",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "0",
"ymax": "1",
"removeOlder": 1,
"removeOlderPoints": "100",
"removeOlderUnit": "86400",
"cutout": 0,
"useOneColor": false,
"useUTC": true,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 1070,
"y": 2640,
"wires": [
[]
]
},
{
"id": "62fc58e95b92ba3f",
"type": "ui_chart",
"z": "4fe759c01b309d0a",
"name": "",
"group": "54ec15a15f8c33b7",
"order": 1,
"width": 0,
"height": 0,
"label": "1 kW/s",
"chartType": "line",
"legend": "false",
"xformat": "dd HH:mm",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "0",
"ymax": "1",
"removeOlder": 1,
"removeOlderPoints": "100",
"removeOlderUnit": "86400",
"cutout": 0,
"useOneColor": false,
"useUTC": true,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 1070,
"y": 2520,
"wires": [
[]
]
},
{
"id": "ac0beed0fc15f477",
"type": "ui_gauge",
"z": "4fe759c01b309d0a",
"name": "",
"group": "54ec15a15f8c33b7",
"order": 1,
"width": 0,
"height": 0,
"gtype": "wave",
"title": "2 kW/s",
"label": "W",
"format": "{{value}}",
"min": 0,
"max": "10000",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 1070,
"y": 2700,
"wires": []
},
{
"id": "75c409b68ba81ef1",
"type": "ui_gauge",
"z": "4fe759c01b309d0a",
"name": "",
"group": "54ec15a15f8c33b7",
"order": 1,
"width": 0,
"height": 0,
"gtype": "wave",
"title": "1 kw/s",
"label": "W",
"format": "{{value}}",
"min": 0,
"max": "10000",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 1095.6666259765625,
"y": 2560.666748046875,
"wires": []
},
{
"id": "54ec15a15f8c33b7",
"type": "ui_group",
"name": "test",
"tab": "9d3d0269bc96b7c1",
"order": 3,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "9d3d0269bc96b7c1",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]