Solar calculating

Hi,

I have a solar system and use multiple plug sockets to monitor my devices. I add up the total power consumption of all devices and subtract this from the total solar generation, which I call "grid consumption." This calculation is done every 10 seconds and displayed in Grafana.

I also have multiple plug sockets with battery backups that turn on and off gradually using a Node Gate and a switch between -10 and 200 watts. When the sun is shining and the grid consumption drops to -10, the first device turns on and opens the gate for the second socket and so on.

At the end of the day, I evaluate how much energy in kWh we saved by using solar power instead of regular electricity. However, I am running into a problem because negative values that are fed back into the grid do not represent energy that we save, but rather energy that we lose since we do not receive any feed-in tariffs.

My question is, how can I exclude the negative values from the calculation so that they do not appear in the final evaluation? This is becoming more important as we connect a larger solar system.

Here are the Parts for the calculation:

[
    {
        "id": "381d404ebd6d60ec",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "82074fe75c506fc9",
        "type": "mqtt in",
        "z": "381d404ebd6d60ec",
        "name": "Solaranlage",
        "topic": "b/strom/stecker-solar/SENSOR",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "8aa7c4c7.b6d308",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 450,
        "y": 180,
        "wires": [
            [
                "8b2d2202f429f388"
            ]
        ]
    },
    {
        "id": "31d2793efe61a39f",
        "type": "join",
        "z": "381d404ebd6d60ec",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "16",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 330,
        "y": 140,
        "wires": [
            [
                "0e0450d7936183ae"
            ]
        ]
    },
    {
        "id": "f481b05358748ed2",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Summe aller Verbraucher",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.L1 + payload.L2 +payload.L3 +payload.L4 +payload.L5 +payload.L6 +payload.L7 +payload.L8 +payload.L9 +payload.L10 +payload.L11 +payload.L12 +payload.L13 +payload.L14 +payload.L15 +payload.L16",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "V1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 140,
        "wires": [
            [
                "0d0962236b7a1afb"
            ]
        ]
    },
    {
        "id": "4c5129e0cc84a2d9",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Minus Solar",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.V1 - payload.S1",
                "tot": "jsonata"
            },
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.netzbezug",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1170,
        "y": 140,
        "wires": [
            [
                "189cda9822796309"
            ]
        ]
    },
    {
        "id": "8b2d2202f429f388",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Solaranlage Topic",
        "rules": [
            {
                "t": "move",
                "p": "payload.ENERGY.Power",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "S1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 690,
        "y": 180,
        "wires": [
            [
                "0d0962236b7a1afb"
            ]
        ]
    },
    {
        "id": "0d0962236b7a1afb",
        "type": "join",
        "z": "381d404ebd6d60ec",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 870,
        "y": 140,
        "wires": [
            [
                "87da9e0a2f46c8d7"
            ]
        ]
    },
    {
        "id": "0e0450d7936183ae",
        "type": "delay",
        "z": "381d404ebd6d60ec",
        "name": "5 Sec",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "allowrate": false,
        "outputs": 1,
        "x": 470,
        "y": 140,
        "wires": [
            [
                "f481b05358748ed2"
            ]
        ]
    },
    {
        "id": "87da9e0a2f46c8d7",
        "type": "delay",
        "z": "381d404ebd6d60ec",
        "name": "5 Sec",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "allowrate": false,
        "outputs": 1,
        "x": 1010,
        "y": 140,
        "wires": [
            [
                "4c5129e0cc84a2d9"
            ]
        ]
    },
    {
        "id": "189cda9822796309",
        "type": "link out",
        "z": "381d404ebd6d60ec",
        "name": "Netzbezug/Flurschaltung Out",
        "mode": "link",
        "links": [
            "4ee6342d183f867e",
            "e040f6efd87777ef"
        ],
        "x": 1295,
        "y": 220,
        "wires": []
    },
    {
        "id": "5b2a2e12b5a632b6",
        "type": "link in",
        "z": "381d404ebd6d60ec",
        "name": "Power Monitoring In",
        "links": [
            "4bacd8180a5001cb"
        ],
        "x": 55,
        "y": 140,
        "wires": [
            [
                "9e5dd6c9393f53bc"
            ]
        ]
    },
    {
        "id": "9e5dd6c9393f53bc",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Form Power",
        "rules": [
            {
                "t": "move",
                "p": "payload.power",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 170,
        "y": 140,
        "wires": [
            [
                "31d2793efe61a39f"
            ]
        ]
    },
    {
        "id": "3eda328590f57505",
        "type": "comment",
        "z": "381d404ebd6d60ec",
        "name": "Flurschaltung",
        "info": "",
        "x": 1350,
        "y": 180,
        "wires": []
    },
    {
        "id": "0b723a1cb1df6f3b",
        "type": "join",
        "z": "381d404ebd6d60ec",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "17",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 350,
        "y": 320,
        "wires": [
            [
                "8380d866e217a473"
            ]
        ]
    },
    {
        "id": "8380d866e217a473",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Summe aller Verbraucher",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.L0 +payload.L1 +payload.L2 +payload.L3 +payload.L4 +payload.L5 +payload.L6 +payload.L7 +payload.L8 +payload.L9 +payload.L10 +payload.L11 +payload.L12 +payload.L13 +payload.L14 +payload.L15 +payload.L16",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "kw1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 320,
        "wires": [
            [
                "c958a8e81531a7b8",
                "11639c41df99581b"
            ]
        ]
    },
    {
        "id": "c958a8e81531a7b8",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Move",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.kwtotal2023",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 320,
        "wires": [
            [
                "0715e16a4cb1755d"
            ]
        ]
    },
    {
        "id": "0715e16a4cb1755d",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Summe aller Verbraucher",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0.50 * payload.kwtotal2023",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "kostentotal",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 950,
        "y": 320,
        "wires": [
            [
                "c8e89797e8126f78"
            ]
        ]
    },
    {
        "id": "c8e89797e8126f78",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Move kwpreistotal2023",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.kwpreistotal2023",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1210,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "9326b98c090ca2c7",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Move kwpreistotalsolar2023",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.kwpreistotalsolar2023",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1540,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "5c9966010320b687",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Summe aller Verbraucher",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0.50 * payload.kwtotalsolar",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "kwpreistotalsolar",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1270,
        "y": 360,
        "wires": [
            [
                "9326b98c090ca2c7"
            ]
        ]
    },
    {
        "id": "9f6126e0f3427e36",
        "type": "mqtt in",
        "z": "381d404ebd6d60ec",
        "name": "Solaranlage",
        "topic": "b/strom/stecker-solar/SENSOR",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "8aa7c4c7.b6d308",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 110,
        "y": 360,
        "wires": [
            [
                "3a022a4a0f5fc8f9"
            ]
        ]
    },
    {
        "id": "3a022a4a0f5fc8f9",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload.ENERGY.Total",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "S1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 390,
        "y": 360,
        "wires": [
            [
                "11639c41df99581b",
                "22d6ce2cdc35a64b"
            ]
        ]
    },
    {
        "id": "11639c41df99581b",
        "type": "join",
        "z": "381d404ebd6d60ec",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 750,
        "y": 360,
        "wires": [
            [
                "b0e121f67551c54c"
            ]
        ]
    },
    {
        "id": "b0e121f67551c54c",
        "type": "delay",
        "z": "381d404ebd6d60ec",
        "name": "5 Sec",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "allowrate": false,
        "outputs": 1,
        "x": 890,
        "y": 360,
        "wires": [
            [
                "61655d6d2daba1ae"
            ]
        ]
    },
    {
        "id": "61655d6d2daba1ae",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Minus Solar",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.kw1 - payload.S1",
                "tot": "jsonata"
            },
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.kwtotalsolar",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1050,
        "y": 360,
        "wires": [
            [
                "5c9966010320b687"
            ]
        ]
    },
    {
        "id": "08fb6978680b1393",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Form Total",
        "rules": [
            {
                "t": "move",
                "p": "payload.total",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 190,
        "y": 320,
        "wires": [
            [
                "0b723a1cb1df6f3b"
            ]
        ]
    },
    {
        "id": "83a9200aacc9ff92",
        "type": "link in",
        "z": "381d404ebd6d60ec",
        "name": "Power Monitoring In",
        "links": [
            "4bacd8180a5001cb",
            "c0b61a0f26f282c2"
        ],
        "x": 55,
        "y": 320,
        "wires": [
            [
                "08fb6978680b1393"
            ]
        ]
    },
    {
        "id": "ce8059adde0704ef",
        "type": "comment",
        "z": "381d404ebd6d60ec",
        "name": "Stromkosten",
        "info": "",
        "x": 110,
        "y": 280,
        "wires": []
    },
    {
        "id": "22d6ce2cdc35a64b",
        "type": "change",
        "z": "381d404ebd6d60ec",
        "name": "Move kwsolar2023",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.kwsolar2023",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "8aa7c4c7.b6d308",
        "type": "mqtt-broker",
        "name": "Mosquitto",
        "broker": "172.50.0.5",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "compatmode": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

Thanks

I'm not able to load your flow at the moment, but I have a similar issue, and sorted it with a simple function node code.

let value = msg.payload
if (value >= 0) {
msg.payload = value
} else {
msg.payload = 0
}
return msg

The code lets numbers >= 0 pass straight through, but any negative values are output as zero, so they don't influence your calculations.

1 Like

That can be written a little more concisely using

msg.payload = Math.max(msg.payload, 0)
return msg
1 Like

Unfortunately, it turned out in the meantime that the pure calculation based on the watt values is not precise. I have 2 options. I can either calculate the kWh myself based on the output watt values, or I take the kWh from the intermediate plug.

Unfortunately, I don't know how to factor in my usage here.

Especially in cloudy weather, the value jumps back and forth. Since my intermediate plugs only output a value every 10 seconds, reading and calculating with the watt value is imprecise.

Actually, I would need a calculation of all negative values, which it then subtracts from the kWh value of the socket. I just don't have any ideas yet on how to implement that in a useful way.

Hier ein Beispiel:
2023-03-19 11_07_30-C - Erweiterte Ansicht - Dashboards - Grafana - Brave

I think what you are looking for is called a definite integral and you can solve it via the trapezoidal rule.
Basically, you approximate the "area" formed by your data points between where the values cross your x-axis.
For each of your data points P = (x,y) you calculate something like (it is hard to describe in text without subscript) (x2-x1)*(y1+y2)/2. [edit:] Then you add up those slices to get the area which would be your energy to deduct.

For a graphical representaion I quickly googled this: Understanding the trapezoidal rule (article) | Khan Academy

thats to high for me :smiley:

Its not exactly what i need. I tested with this functions, but i didnt get a good solution.

in best cast i can summ all minus watt points autmaticly. i tried to change the function into "if -1 or more, payload value else payload 0".

it wont work with both funktions.

let value = msg.payload
if (value >= -1) {
msg.payload = value
} else {
msg.payload = 0
}
return msg

i only get 0, no minus watts. :thinking:

What exactly do you want out of the function for different input values?

ok i did it.

for my graphs i use your function now. so i can remove the minus watts.

for my calculation to substract my "solar kw/h" with the minus watt, i do this:

[
    {
        "id": "2a256f1c87921943",
        "type": "mqtt in",
        "z": "d2b4c35830bc54a2",
        "name": "Solaranlage",
        "topic": "b/strom/stecker-solar/SENSOR",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "8aa7c4c7.b6d308",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 1070,
        "y": 1020,
        "wires": [
            [
                "05efdf14aad8fa26"
            ]
        ]
    },
    {
        "id": "05efdf14aad8fa26",
        "type": "change",
        "z": "d2b4c35830bc54a2",
        "name": "S1",
        "rules": [
            {
                "t": "move",
                "p": "payload.ENERGY.Total",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "S1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1450,
        "y": 1020,
        "wires": [
            [
                "84544606850f9681"
            ]
        ]
    },
    {
        "id": "eb0f7faa1a0ab31d",
        "type": "watt2kwh",
        "z": "d2b4c35830bc54a2",
        "format": "kwh",
        "maximum": "60",
        "maximumunit": "mins",
        "name": "",
        "x": 1600,
        "y": 980,
        "wires": [
            [
                "92e84adc.45c5e8"
            ]
        ]
    },
    {
        "id": "50a49ae3317b9398",
        "type": "link in",
        "z": "d2b4c35830bc54a2",
        "name": "link in 1",
        "links": [
            "4c21ae75fa2634e7"
        ],
        "x": 1015,
        "y": 980,
        "wires": [
            [
                "0b3db1cde0b783f4"
            ]
        ]
    },
    {
        "id": "92e84adc.45c5e8",
        "type": "function",
        "z": "d2b4c35830bc54a2",
        "name": "Store kwh",
        "func": "var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"solarminus\",0); \n } else {\nvar savedVal = flow.get('solarminus')||0;\nsavedVal += inputVal;\nflow.set(\"solarminus\",savedVal);\nmsg.payload = savedVal;\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1760,
        "y": 980,
        "wires": [
            [
                "31e01e271ad7bbfd"
            ]
        ]
    },
    {
        "id": "cd0704a291e0da62",
        "type": "switch",
        "z": "d2b4c35830bc54a2",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "lte",
                "v": "-1",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1290,
        "y": 980,
        "wires": [
            [],
            [
                "14d194618635363c"
            ]
        ]
    },
    {
        "id": "0d29c68be46639d7",
        "type": "change",
        "z": "d2b4c35830bc54a2",
        "name": "Substract",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.S1 - payload.W1",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2220,
        "y": 1020,
        "wires": [
            [
                "41496352691dbcc0"
            ]
        ]
    },
    {
        "id": "31e01e271ad7bbfd",
        "type": "change",
        "z": "d2b4c35830bc54a2",
        "name": "W1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "W1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1910,
        "y": 980,
        "wires": [
            [
                "84544606850f9681"
            ]
        ]
    },
    {
        "id": "41496352691dbcc0",
        "type": "change",
        "z": "d2b4c35830bc54a2",
        "name": "testkwsolar2023",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.testkwsolar2023",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2480,
        "y": 1020,
        "wires": [
            [
                "7940110d73e65ef7"
            ]
        ]
    },
    {
        "id": "0b3db1cde0b783f4",
        "type": "change",
        "z": "d2b4c35830bc54a2",
        "name": "to payload",
        "rules": [
            {
                "t": "move",
                "p": "payload.netzbezug",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1150,
        "y": 980,
        "wires": [
            [
                "cd0704a291e0da62"
            ]
        ]
    },
    {
        "id": "14d194618635363c",
        "type": "function",
        "z": "d2b4c35830bc54a2",
        "name": "function 1",
        "func": "msg.payload = msg.payload * -1;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1440,
        "y": 980,
        "wires": [
            [
                "eb0f7faa1a0ab31d"
            ]
        ]
    },
    {
        "id": "84544606850f9681",
        "type": "join",
        "z": "d2b4c35830bc54a2",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 2070,
        "y": 1020,
        "wires": [
            [
                "0d29c68be46639d7"
            ]
        ]
    },
    {
        "id": "8aa7c4c7.b6d308",
        "type": "mqtt-broker",
        "name": "Mosquitto",
        "broker": "172.50.0.5",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "compatmode": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

The Solarengine has a plug wo monitore all his values. i simply use his totalenergy to see, what i use. Now my solar engine is bigger and much time i go in minuswatt.

this watt i substract now. its important, cause we try to stay between 7 and 10 kw/h per day. if the solar engine generate 4 kw/h and we only use 2 of them, in the past it looks like 4. now i can remove them.

my last problem to solve is, to remove the "reset" of "watt2kwh" node. i hope 999999 works.
image

Why would you want to do that??
Are you not expecting any data to flow through the watt2kwh node for 999999999 hours??
Seems unlikely to me.

i want to calculate the minus solar over the year.

the 999999 not work. every time the kwh is reset to 0 :confused:

The node readme describes what the timeout is, and also how the node should be used.
There is also an example flow in the node-RED examples
Please re-read the readme, and come back to me if there is anything that you don't understand.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.