ik heb ook een tripower en heb gebruik gemaakt van een node (watt2kWh) die dit voor je doet. Ik heb hier de flow (input in watt)voor een complete meting:
[
{
"id": "f78046356bcc08fa",
"type": "group",
"z": "8ad03162.29812",
"name": "Actual",
"style": {
"fill": "#bfdbef",
"label": true,
"color": "#000000"
},
"nodes": [
"a33cbd7f45aab38b",
"9dba3d682762a657",
"5725e21cc56fdc8f",
"1bdc7cc7f10283a2",
"d91967a7215421f6",
"424293e46163377d",
"9f475179af1a8a9a",
"3c1c87a354deafce",
"10de3f362dc39ea2",
"727958dafe41d6cb",
"748fedc947cb2922"
],
"x": 2154,
"y": 528,
"w": 923,
"h": 213
},
{
"id": "3f235640b7cb44a9",
"type": "subflow",
"name": "0.xx",
"info": "",
"category": "",
"in": [
{
"x": 60,
"y": 75,
"wires": [
{
"id": "87ed2ab53564d859"
},
{
"id": "57918fca3037144d"
}
]
}
],
"out": [
{
"x": 315,
"y": 75,
"wires": [
{
"id": "57918fca3037144d",
"port": 0
}
]
}
],
"env": [],
"meta": {},
"color": "#DDAA99"
},
{
"id": "87ed2ab53564d859",
"type": "function",
"z": "3f235640b7cb44a9",
"d": true,
"name": "0.xx",
"func": "msg.payload = msg.payload.toFixed(2);\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 185,
"y": 75,
"wires": [
[]
]
},
{
"id": "57918fca3037144d",
"type": "change",
"z": "3f235640b7cb44a9",
"name": "Convert to 0.xx",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$number(msg.payload)\t\t",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$round(msg.payload, 2)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 210,
"y": 160,
"wires": [
[]
]
},
{
"id": "d95f30fe955f4847",
"type": "subflow",
"name": "EnergyMeter to Production",
"info": "",
"category": "",
"in": [
{
"x": 305,
"y": 375,
"wires": [
{
"id": "948246a809f33085"
}
]
}
],
"out": [
{
"x": 1045,
"y": 375,
"wires": [
{
"id": "d5f9c56c7aa5ef72",
"port": 0
}
]
}
],
"env": [],
"meta": {},
"color": "#3FADB5",
"icon": "node-red-contrib-watt2kwh/power.png"
},
{
"id": "948246a809f33085",
"type": "energyMeter",
"z": "d95f30fe955f4847",
"name": "",
"topic": "",
"inputformat": "w",
"accuracy": "100",
"price": "",
"x": 485,
"y": 375,
"wires": [
[
"371ebe83edcbf263"
]
]
},
{
"id": "371ebe83edcbf263",
"type": "json",
"z": "d95f30fe955f4847",
"name": "convert",
"property": "payload.daily",
"action": "str",
"pretty": false,
"x": 660,
"y": 375,
"wires": [
[
"d5f9c56c7aa5ef72"
]
]
},
{
"id": "d5f9c56c7aa5ef72",
"type": "function",
"z": "d95f30fe955f4847",
"name": "Production Today",
"func": "var msg = msg.payload.daily ;\n\n\n\nreturn [{ payload: msg }]",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 840,
"y": 375,
"wires": [
[]
]
},
{
"id": "a33cbd7f45aab38b",
"type": "function",
"z": "8ad03162.29812",
"d": true,
"g": "f78046356bcc08fa",
"name": "Sensor 5140",
"func": "msg = msg.payload ;\n\nvar msg1 = {};\n\nmsg1.payload = { \"command\": \"udevice\", \"idx\": 5140, \"svalue\": msg, \"parse\": false } ; \n\nreturn [[msg1]];\n\n\n\n//msg1.payload = {\"command\": \"udevice\", \"idx\": 5132, \"svalue\": msg, \"parse\": false } ;\n\n//msg1.payload = { \"command\": \"udevice\", \"idx\": 5132, \"svalue\": msg, \"parse\": false };\n//{\"command\":\"udevice\", \"idx\":1234, \"svalue\":\"us;cu\"}\n//payload.svalue.daily\n//payload.daily\n//payload.svalue",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2730,
"y": 700,
"wires": [
[]
]
},
{
"id": "9dba3d682762a657",
"type": "change",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "last",
"rules": [
{
"t": "set",
"p": "#:(storeInFile)::last_daily",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2815,
"y": 640,
"wires": [
[]
]
},
{
"id": "5725e21cc56fdc8f",
"type": "inject",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "Last Used",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "0.3",
"topic": "",
"payload": "#:(storeInFile)::last_daily",
"payloadType": "flow",
"x": 2350,
"y": 640,
"wires": [
[
"1bdc7cc7f10283a2"
]
]
},
{
"id": "1bdc7cc7f10283a2",
"type": "change",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "Last daily",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "ldaily",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2525,
"y": 640,
"wires": [
[
"d91967a7215421f6"
]
]
},
{
"id": "d91967a7215421f6",
"type": "SumUltimate",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "sum",
"property": "payload",
"math": "sum",
"x": 2685,
"y": 595,
"wires": [
[
"a33cbd7f45aab38b",
"9dba3d682762a657",
"3c1c87a354deafce",
"52a61e92e8efef5a",
"748fedc947cb2922"
]
]
},
{
"id": "424293e46163377d",
"type": "change",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "P today",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "Ptoday",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2525,
"y": 595,
"wires": [
[
"d91967a7215421f6"
]
]
},
{
"id": "9f475179af1a8a9a",
"type": "inject",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "newday",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 00 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "last_daily",
"payload": "0",
"payloadType": "num",
"x": 2360,
"y": 685,
"wires": [
[
"1bdc7cc7f10283a2"
]
]
},
{
"id": "3c1c87a354deafce",
"type": "function",
"z": "8ad03162.29812",
"d": true,
"g": "f78046356bcc08fa",
"name": "0.xx",
"func": "msg.payload= msg.payload.toFixed(2);\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2830,
"y": 580,
"wires": [
[
"58f759ec555632c0"
]
]
},
{
"id": "10de3f362dc39ea2",
"type": "subflow:d95f30fe955f4847",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "",
"x": 2300,
"y": 600,
"wires": [
[
"424293e46163377d"
]
]
},
{
"id": "727958dafe41d6cb",
"type": "group",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "usage",
"style": {
"fill": "#7fb7df",
"label": true,
"color": "#000000"
},
"nodes": [
"58f759ec555632c0"
],
"x": 2899,
"y": 554,
"w": 152,
"h": 82
},
{
"id": "58f759ec555632c0",
"type": "ui_text",
"z": "8ad03162.29812",
"g": "727958dafe41d6cb",
"group": "3b8704e026eae2c8",
"order": 5,
"width": 6,
"height": 1,
"name": "Actual",
"label": "Actual",
"format": "{{msg.payload}} kWh",
"layout": "row-spread",
"className": "",
"style": true,
"font": "",
"fontSize": "16",
"color": "#0a95eb",
"x": 2975,
"y": 595,
"wires": []
},
{
"id": "3b8704e026eae2c8",
"type": "ui_group",
"name": "Usage Today",
"tab": "cccf47e4.857ec8",
"order": 1,
"disp": true,
"width": "6",
"collapse": true,
"className": ""
},
{
"id": "cccf47e4.857ec8",
"type": "ui_tab",
"name": "Energy",
"icon": "battery_charging_60",
"order": 2,
"disabled": false,
"hidden": false
},
{
"id": "748fedc947cb2922",
"type": "subflow:3f235640b7cb44a9",
"z": "8ad03162.29812",
"g": "f78046356bcc08fa",
"name": "",
"x": 2830,
"y": 580,
"wires": [
[
"58f759ec555632c0"
]
]
},
{
"id": "17813cbb0f1eff7e",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-simple-energymeter": "0.7.2",
"node-red-contrib-boolean-logic-ultimate": "1.1.27",
"node-red-dashboard": "3.6.5"
}
}
]