Start Stop Payload passthrogh

Dear Node Red Forum Team,
I am a beginner in Node Red programming, really nice, I like it.
I would need your help about creating a Node for my new project and don't really find any information on the internet how to realize the following sketch.
I have a 3 phase solar system which measures the consumption in W.
I use sum to get them in one data and the power-monitor to calculate in kWh.

What I need is "switch" when the inverter switches from sun to bypass, the calculated kWh should be outputted to another data point. I would try to draw what I have in mind.

3 data inputs - sum - "switch" "when on sun power" -w to kWh - data point to InfluxDB
"when on grid power" -w to kWh - data point to InfluxDB

I also have no experience with JavaScript.

Thank you very much in advance for your help.

Happy New Year!

Hello @Phoenix, welcome to Node-red.

Note that a group of nodes joined together by wires, down which data messages flow is called a Flow, not a Node.

Looks like you have two challenges to tackle.

Most nodes can only process a single message at a time. Once it has been sent to the output, everything about it is forgotten.
So you can't just add up the values from three inputs.
The usual way to tackle it is to give each input a different msg.topic. Depending how they arrive into the flow (eg by mqtt), they may already have this. Then fed them into a Join node set to "manual join". This will give you a single message with all three values. Then you save to add them up.

The second challenge: a second output when on grid power is also possible using msg.topic and a Switch node set to test msg.topic.

Good luck!

Ps. You can do nearly everything in Node-red without using JavaScript. If there is something you can't master just using core and contributed nodes but you can do it with one hand tied behind your back in Python, C, Bash, etc,v it's easy to patch in external executables with the Exec node.

Hello @jbudd,
thanks for the prompt reply.
I know it's a Flow, sorry for that.
Forgot to mention that the "switch" needs to be change from a different node.
I will try to make a schematic, maybe it will be easier to understand.

Have a search for " node-red-contrib-simple-gate" in node library.

Untitled 2
This suggests that you don't understand about each message being processed completely independently. Your "grid/sun switch" cannot change how WR[1-3] are handled.

I don't recognise your "Math" node so I don't know if it's capable of adding up the three inputs.

@E1cid this is exactly what I need.
Thank you very much.

HAPPY NEW YEAR!!!

I've solved it like this:

[
    {
        "id": "c89231cf7bc89672",
        "type": "power-monitor",
        "z": "a0ffbde30d80ea16",
        "name": "Sunpower",
        "startthreshold": 0,
        "stopthreshold": 0,
        "startafter": 1,
        "stopafter": 1,
        "energydecimals": 4,
        "emitidle": true,
        "x": 760,
        "y": 2140,
        "wires": [
            [
                "d5a54472a201cbdc"
            ]
        ]
    },
    {
        "id": "cd2091a50475dec8",
        "type": "ioBroker in",
        "z": "a0ffbde30d80ea16",
        "name": "WR1 out W",
        "topic": "modbus.0.inputRegisters.1.30011_WR1_Output_Active_Power",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "fireOnStart": "false",
        "outFormat": "MQTT",
        "x": 110,
        "y": 2080,
        "wires": [
            [
                "40fba0e03b4fc497"
            ]
        ]
    },
    {
        "id": "41efb2dbbfa7137d",
        "type": "ioBroker in",
        "z": "a0ffbde30d80ea16",
        "name": "WR2 out W",
        "topic": "modbus.0.inputRegisters.2.30011_WR2_Output_Active_Power",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "fireOnStart": "false",
        "outFormat": "MQTT",
        "x": 110,
        "y": 2140,
        "wires": [
            [
                "40fba0e03b4fc497"
            ]
        ]
    },
    {
        "id": "a127358e0172d4c2",
        "type": "ioBroker in",
        "z": "a0ffbde30d80ea16",
        "name": "WR3 out W",
        "topic": "modbus.0.inputRegisters.3.30011_WR3_Output_Active_Power",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "fireOnStart": "false",
        "outFormat": "MQTT",
        "x": 110,
        "y": 2200,
        "wires": [
            [
                "40fba0e03b4fc497"
            ]
        ]
    },
    {
        "id": "40fba0e03b4fc497",
        "type": "SumUltimate",
        "z": "a0ffbde30d80ea16",
        "name": "Math",
        "property": "payload",
        "math": "sum",
        "x": 370,
        "y": 2140,
        "wires": [
            [
                "2a499531e3138ce8",
                "9b35d3a4ef0539a1"
            ]
        ]
    },
    {
        "id": "d5a54472a201cbdc",
        "type": "change",
        "z": "a0ffbde30d80ea16",
        "name": "kWh-filter",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.energy",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 940,
        "y": 2140,
        "wires": [
            [
                "bdd8fabfbf06033d"
            ]
        ]
    },
    {
        "id": "d95d01336f6e8475",
        "type": "ioBroker in",
        "z": "a0ffbde30d80ea16",
        "name": "WR1 Status",
        "topic": "modbus.0.inputRegisters.1.30001_WR1_System_Status",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "fireOnStart": "false",
        "outFormat": "MQTT",
        "x": 110,
        "y": 2020,
        "wires": [
            [
                "4397f011ef4eda1d",
                "a21e3f46ba6a5266"
            ]
        ]
    },
    {
        "id": "2a499531e3138ce8",
        "type": "gate",
        "z": "a0ffbde30d80ea16",
        "name": "",
        "controlTopic": "control",
        "defaultState": "open",
        "openCmd": "open",
        "closeCmd": "close",
        "toggleCmd": "toggle",
        "defaultCmd": "default",
        "statusCmd": "status",
        "persist": false,
        "storeName": "memory",
        "x": 610,
        "y": 2140,
        "wires": [
            [
                "c89231cf7bc89672"
            ]
        ]
    },
    {
        "id": "9b35d3a4ef0539a1",
        "type": "gate",
        "z": "a0ffbde30d80ea16",
        "name": "",
        "controlTopic": "control",
        "defaultState": "open",
        "openCmd": "open",
        "closeCmd": "close",
        "toggleCmd": "toggle",
        "defaultCmd": "default",
        "statusCmd": "status",
        "persist": false,
        "storeName": "memory",
        "x": 610,
        "y": 2060,
        "wires": [
            [
                "e2b365800f85f979"
            ]
        ]
    },
    {
        "id": "e2b365800f85f979",
        "type": "power-monitor",
        "z": "a0ffbde30d80ea16",
        "name": "Gridpower",
        "startthreshold": 0,
        "stopthreshold": 0,
        "startafter": 1,
        "stopafter": 1,
        "energydecimals": 4,
        "emitidle": true,
        "x": 770,
        "y": 2060,
        "wires": [
            [
                "5dae14685eec6ad9"
            ]
        ]
    },
    {
        "id": "5dae14685eec6ad9",
        "type": "change",
        "z": "a0ffbde30d80ea16",
        "name": "kWh-filter",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.energy",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 940,
        "y": 2060,
        "wires": [
            [
                "ac128e4e63a2e37b"
            ]
        ]
    },
    {
        "id": "4397f011ef4eda1d",
        "type": "function",
        "z": "a0ffbde30d80ea16",
        "name": "12 = open",
        "func": "if (msg.payload === 12)\n    msg.payload = \"open\";\n\nelse msg.payload = \"close\";\nmsg.topic = \"control\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 2100,
        "wires": [
            [
                "2a499531e3138ce8"
            ]
        ]
    },
    {
        "id": "a21e3f46ba6a5266",
        "type": "function",
        "z": "a0ffbde30d80ea16",
        "name": "12 = close",
        "func": "if (msg.payload === 12)\n    msg.payload = \"close\";\n\nelse msg.payload = \"open\";\nmsg.topic = \"control\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 390,
        "y": 2060,
        "wires": [
            [
                "9b35d3a4ef0539a1"
            ]
        ]
    },
    {
        "id": "e65615fc24e4335b",
        "type": "ioBroker out",
        "z": "a0ffbde30d80ea16",
        "name": "Sonne",
        "topic": "0_userdata.0.PV_Anlage.WR.Aus_Sonne_Verbraucht",
        "ack": "true",
        "autoCreate": "false",
        "stateName": "",
        "role": "",
        "payloadType": "",
        "readonly": "",
        "stateUnit": "",
        "stateMin": "",
        "stateMax": "",
        "x": 1230,
        "y": 2140,
        "wires": []
    },
    {
        "id": "9e8d2a77f258a878",
        "type": "ioBroker out",
        "z": "a0ffbde30d80ea16",
        "name": "Netz",
        "topic": "0_userdata.0.PV_Anlage.WR.Aus_Netz_Verbraucht",
        "ack": "true",
        "autoCreate": "false",
        "stateName": "",
        "role": "",
        "payloadType": "",
        "readonly": "",
        "stateUnit": "",
        "stateMin": "",
        "stateMax": "",
        "x": 1230,
        "y": 2060,
        "wires": []
    },
    {
        "id": "ac128e4e63a2e37b",
        "type": "delay",
        "z": "a0ffbde30d80ea16",
        "name": "1/s",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1090,
        "y": 2060,
        "wires": [
            [
                "9e8d2a77f258a878"
            ]
        ]
    },
    {
        "id": "bdd8fabfbf06033d",
        "type": "delay",
        "z": "a0ffbde30d80ea16",
        "name": "1/s",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1090,
        "y": 2140,
        "wires": [
            [
                "e65615fc24e4335b"
            ]
        ]
    }
]

Thank you all for your help.
BR
Phoenix

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