From buffer-parser to values

Hi together,
beeing a novice in Node-Red, I kindly ask for support in my first steps.

I managed to connect to a "modbus source" (KSEM), getting power injected to grid (middle) and received (top). Now I like to add both values to a single one ?

For two single values I got an example. However how do I get the values from debug6 and debug4 into the inject node (replacing "20 and "1").

Any help is welcome !
Thanks

Hi, welcome to the forum. Sorry, I can't help with the question but I've posted in the image for you and changed the category and tag to help people understand it better.

Oh, actually, I may be able to help.

Node-RED is flow-based so if you want to combine values, the best thing is to make gathering the data all part of one connected set of nodes. Not sure what the orange nodes are here but it looks like they can't be combined which makes things a little harder.

So to achieve it with your setup, I think you will need to write both values separately to a common flow variable. You can use the change node to do that. So have a startup flow that creates a variable object that can hold 2 values (an array or an object). Then the 2 start nodes you have there will feed into that.

Give me a couple of minutes to set up an example.

[{"id":"0aeff87d60a98cf7","type":"inject","z":"30fdd9a9702231b0","name":"Value 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"$formatInteger($random() * 100, \"0\")\t","payloadType":"jsonata","x":210,"y":2540,"wires":[["632d4fea7987727c"]]},{"id":"edc4413835772881","type":"inject","z":"30fdd9a9702231b0","name":"Value 2","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"$formatInteger($random() * 100, \"0\")","payloadType":"jsonata","x":210,"y":2660,"wires":[["edfa815baf56347f"]]},{"id":"632d4fea7987727c","type":"change","z":"30fdd9a9702231b0","name":"","rules":[{"t":"set","p":"mystore.val1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":2540,"wires":[["5ae39ea11d0ee939","49ad6404c0697e19"]]},{"id":"edfa815baf56347f","type":"change","z":"30fdd9a9702231b0","name":"","rules":[{"t":"set","p":"mystore.val2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":2660,"wires":[["6eb6c5410fbdc835","cae0f290505b378d"]]},{"id":"5ae39ea11d0ee939","type":"debug","z":"30fdd9a9702231b0","name":"payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":2540,"wires":[]},{"id":"6eb6c5410fbdc835","type":"debug","z":"30fdd9a9702231b0","name":"flow.mystore","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"$flowContext(\"mystore\")\t","targetType":"jsonata","statusVal":"","statusType":"auto","x":690,"y":2700,"wires":[]},{"id":"49ad6404c0697e19","type":"debug","z":"30fdd9a9702231b0","name":"flow.mystore","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"$flowContext(\"mystore\")\t","targetType":"jsonata","statusVal":"","statusType":"auto","x":690,"y":2580,"wires":[]},{"id":"cae0f290505b378d","type":"debug","z":"30fdd9a9702231b0","name":"payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":2660,"wires":[]}]

Note that, at the point of receipt of one of the values, the other value may still have a previous figure. This may or may not be an issue for you. Things get a lot more complex if you have to coordinate both values to have had updates before you use/show them.

Hi thanks for help.

However the input comes via Modbus: P-Bezug and P-Einsp., resp. debug6 and debug4.

I tried to sketch it as follows:

Both values "P-Bezug" and "P-Einsp." are synchronized.

How can I upload my Node-Red "Flow" export ?

You would normally just wire from the buffer parser to the change nodes and not use inject nodes. why do you ant to use inject nodes, do you require some timer or repeat function the inject nodes offer. If so you might want to look a the cron plus node. If you want them in the same message you would normally join them.

The inject nodes needs to be replaced, they are just used to test the sum-function.

I assume, just to "wire from parser to change nodes" isn't that easy:

Please post your flow, and debug 4 and 6 values in text format.

How to import/export a flow

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

I will then look at the jsonata expressionyou have used

[
    {
        "id": "03a396edb292a231",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "53ab8c795075ebaf",
        "type": "modbus-read",
        "z": "03a396edb292a231",
        "name": "P-Einsp.",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "",
        "dataType": "HoldingRegister",
        "adr": "2",
        "quantity": "2",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": true,
        "startDelayTime": "10",
        "server": "cc73dd7ed0ec7878",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 140,
        "y": 380,
        "wires": [
            [
                "a487c9c347817d2f"
            ],
            [
                "4dc5b84a160a51b6"
            ]
        ]
    },
    {
        "id": "a487c9c347817d2f",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 3",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 380,
        "wires": []
    },
    {
        "id": "4dc5b84a160a51b6",
        "type": "buffer-parser",
        "z": "03a396edb292a231",
        "name": "",
        "data": "payload.buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "uint32le",
                "name": "temp1",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint32be",
                "name": "temp2",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 170,
        "y": 460,
        "wires": [
            [
                "9ff9a27c6cd822a3",
                "96c90e44ff4480de"
            ]
        ]
    },
    {
        "id": "9ff9a27c6cd822a3",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 460,
        "wires": []
    },
    {
        "id": "2685cdde1ffd9c43",
        "type": "modbus-read",
        "z": "03a396edb292a231",
        "name": "P-Bezug",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "",
        "dataType": "HoldingRegister",
        "adr": "0",
        "quantity": "2",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": true,
        "startDelayTime": "10",
        "server": "cc73dd7ed0ec7878",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 140,
        "y": 160,
        "wires": [
            [
                "271b7f1fa6a4e276"
            ],
            [
                "3368288c707c0745"
            ]
        ]
    },
    {
        "id": "271b7f1fa6a4e276",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 5",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 160,
        "wires": []
    },
    {
        "id": "3368288c707c0745",
        "type": "buffer-parser",
        "z": "03a396edb292a231",
        "name": "",
        "data": "payload.buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int32be",
                "name": "temp3",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint32le",
                "name": "temp4",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 170,
        "y": 220,
        "wires": [
            [
                "889e8f826cbe539f"
            ]
        ]
    },
    {
        "id": "889e8f826cbe539f",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 6",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 220,
        "wires": []
    },
    {
        "id": "364362509034c10f",
        "type": "inject",
        "z": "03a396edb292a231",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "20",
        "payloadType": "num",
        "x": 110,
        "y": 540,
        "wires": [
            [
                "6689ad89631f9faf"
            ]
        ]
    },
    {
        "id": "282b88cfcc391588",
        "type": "join",
        "z": "03a396edb292a231",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "num",
        "reduceFixup": "",
        "x": 450,
        "y": 540,
        "wires": [
            [
                "71304130f6d73719"
            ]
        ]
    },
    {
        "id": "6689ad89631f9faf",
        "type": "change",
        "z": "03a396edb292a231",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "parts",
                "pt": "msg",
                "to": "1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 540,
        "wires": [
            [
                "282b88cfcc391588"
            ]
        ]
    },
    {
        "id": "96c90e44ff4480de",
        "type": "change",
        "z": "03a396edb292a231",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "parts",
                "pt": "msg",
                "to": "2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 580,
        "wires": [
            [
                "282b88cfcc391588"
            ]
        ]
    },
    {
        "id": "71304130f6d73719",
        "type": "change",
        "z": "03a396edb292a231",
        "name": "$sum(payload)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$sum(payload)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 540,
        "wires": [
            [
                "2082de158de1720e"
            ]
        ]
    },
    {
        "id": "2082de158de1720e",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 830,
        "y": 540,
        "wires": []
    },
    {
        "id": "cc73dd7ed0ec7878",
        "type": "modbus-client",
        "name": "KSEM",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "192.168.178.61",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": 1,
        "commandDelay": 1,
        "clientTimeout": 1000,
        "reconnectOnTimeout": true,
        "reconnectTimeout": 2000,
        "parallelUnitIdsAllowed": true,
        "showWarnings": true,
        "showLogs": true
    }
]

Sorry my headline looks like this:
grafik

The
grafik
tiles are missing.

Right side icon it is an option there, some browsers layout is different.

Still require debug 4 and 6 in text format.

Do you require the sum of all 4 temps? or sum of temp1's and sum of temp2's?

No just two: the sum of temp2 and temp3.

Are you going to supply the debug data i asked for in a text format? If you want help it is only polite to supply the data required to help you.

I'm not that familar with the tool node-red yet.

Like this ?

{"temp3":330,"temp4":1241579520}
{"temp1":0,"temp2":0}
grafik

Example of joining output and then adding 2 values.

[{"id":"364362509034c10f","type":"inject","z":"03a396edb292a231","name":"simulate bF output","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"temp3\":330,\"temp4\":1241579520}","payloadType":"json","x":170,"y":200,"wires":[["1de232ee08047294"]]},{"id":"1de232ee08047294","type":"change","z":"03a396edb292a231","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"BF1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":200,"wires":[["282b88cfcc391588","a487c9c347817d2f"]]},{"id":"282b88cfcc391588","type":"join","z":"03a396edb292a231","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":"num","reduceFixup":"","x":490,"y":260,"wires":[["71304130f6d73719"]]},{"id":"a487c9c347817d2f","type":"debug","z":"03a396edb292a231","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":360,"y":380,"wires":[]},{"id":"97154fb78a270292","type":"change","z":"03a396edb292a231","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"BF2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":300,"wires":[["282b88cfcc391588","9ff9a27c6cd822a3"]]},{"id":"71304130f6d73719","type":"change","z":"03a396edb292a231","name":"$sum(payload)","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.BF1.temp3 + $$.payload.BF2.temp1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":400,"wires":[["2082de158de1720e"]]},{"id":"a801c79f5e7717a3","type":"inject","z":"03a396edb292a231","name":"simulate BF output","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":" {\"temp1\":0,\"temp2\":0}","payloadType":"json","x":150,"y":300,"wires":[["97154fb78a270292"]]},{"id":"9ff9a27c6cd822a3","type":"debug","z":"03a396edb292a231","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":360,"y":460,"wires":[]},{"id":"2082de158de1720e","type":"debug","z":"03a396edb292a231","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","statusVal":"payload","statusType":"auto","x":830,"y":540,"wires":[]}]

I do not have buffer parser installed so have simulated it with two injects.

p.s surround the debug info with triple backticks, using </> then we get a copy button, makes life easier.

I think these essentials videos will help you understand the basics

Now I found the tiles

[
    {
        "id": "03a396edb292a231",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "53ab8c795075ebaf",
        "type": "modbus-read",
        "z": "03a396edb292a231",
        "name": "P-Einsp.",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "",
        "dataType": "HoldingRegister",
        "adr": "2",
        "quantity": "2",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": true,
        "startDelayTime": "10",
        "server": "cc73dd7ed0ec7878",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 140,
        "y": 380,
        "wires": [
            [
                "a487c9c347817d2f"
            ],
            [
                "4dc5b84a160a51b6"
            ]
        ]
    },
    {
        "id": "a487c9c347817d2f",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 3",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 380,
        "wires": []
    },
    {
        "id": "4dc5b84a160a51b6",
        "type": "buffer-parser",
        "z": "03a396edb292a231",
        "name": "",
        "data": "payload.buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "uint32le",
                "name": "temp1",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint32be",
                "name": "temp2",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 170,
        "y": 460,
        "wires": [
            [
                "9ff9a27c6cd822a3",
                "96c90e44ff4480de"
            ]
        ]
    },
    {
        "id": "9ff9a27c6cd822a3",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 460,
        "wires": []
    },
    {
        "id": "2685cdde1ffd9c43",
        "type": "modbus-read",
        "z": "03a396edb292a231",
        "name": "P-Bezug",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "",
        "dataType": "HoldingRegister",
        "adr": "0",
        "quantity": "2",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": true,
        "startDelayTime": "10",
        "server": "cc73dd7ed0ec7878",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 140,
        "y": 160,
        "wires": [
            [
                "271b7f1fa6a4e276"
            ],
            [
                "3368288c707c0745"
            ]
        ]
    },
    {
        "id": "271b7f1fa6a4e276",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 5",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 160,
        "wires": []
    },
    {
        "id": "3368288c707c0745",
        "type": "buffer-parser",
        "z": "03a396edb292a231",
        "name": "",
        "data": "payload.buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int32be",
                "name": "temp3",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint32le",
                "name": "temp4",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 170,
        "y": 220,
        "wires": [
            [
                "889e8f826cbe539f"
            ]
        ]
    },
    {
        "id": "889e8f826cbe539f",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "debug 6",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 220,
        "wires": []
    },
    {
        "id": "364362509034c10f",
        "type": "inject",
        "z": "03a396edb292a231",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "20",
        "payloadType": "num",
        "x": 110,
        "y": 540,
        "wires": [
            [
                "6689ad89631f9faf"
            ]
        ]
    },
    {
        "id": "282b88cfcc391588",
        "type": "join",
        "z": "03a396edb292a231",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "num",
        "reduceFixup": "",
        "x": 450,
        "y": 540,
        "wires": [
            [
                "71304130f6d73719"
            ]
        ]
    },
    {
        "id": "6689ad89631f9faf",
        "type": "change",
        "z": "03a396edb292a231",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "parts",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 540,
        "wires": [
            [
                "282b88cfcc391588"
            ]
        ]
    },
    {
        "id": "96c90e44ff4480de",
        "type": "change",
        "z": "03a396edb292a231",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "parts",
                "pt": "msg",
                "to": "2",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 580,
        "wires": [
            [
                "282b88cfcc391588"
            ]
        ]
    },
    {
        "id": "71304130f6d73719",
        "type": "change",
        "z": "03a396edb292a231",
        "name": "$sum(payload)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$sum(payload)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 540,
        "wires": [
            [
                "2082de158de1720e"
            ]
        ]
    },
    {
        "id": "2082de158de1720e",
        "type": "debug",
        "z": "03a396edb292a231",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 830,
        "y": 540,
        "wires": []
    },
    {
        "id": "cc73dd7ed0ec7878",
        "type": "modbus-client",
        "name": "KSEM",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "192.168.178.61",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": 1,
        "commandDelay": 1,
        "clientTimeout": 1000,
        "reconnectOnTimeout": true,
        "reconnectTimeout": 2000,
        "parallelUnitIdsAllowed": true,
        "showWarnings": true,
        "showLogs": true
    }
]

Thanks a lot E1cid, much appreciated.

The video I take tomorrow (loc is close to 8 pm and my wife is now back from work :wink: )

I got the message from your example, how to make an inject node using an array.

However the question remains, how I transfer values from "buffer parser" to an array ?

Tomorrow is another day

You are not understanding the inject nodes simulate the output of the buffer nodes, as i do not have them on my machine. That is why i require the text debug data so i could simulate the buffer node output.

Just delete the injects and wire the buffer nodes to the change nodes, not sure which way round, but if first try does not work reverse the wiring.

[edit] You could also join using merge and a count of 4,
just add the buffer nodes direct to the join node
e.g.

[{"id":"364362509034c10f","type":"inject","z":"03a396edb292a231","name":"simulate bF output","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"temp3\":330,\"temp4\":1241579520}","payloadType":"json","x":170,"y":200,"wires":[["282b88cfcc391588","a487c9c347817d2f"]]},{"id":"282b88cfcc391588","type":"join","z":"03a396edb292a231","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":490,"y":260,"wires":[["71304130f6d73719"]]},{"id":"a487c9c347817d2f","type":"debug","z":"03a396edb292a231","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":360,"y":380,"wires":[]},{"id":"a801c79f5e7717a3","type":"inject","z":"03a396edb292a231","name":"simulate BF output","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":" {\"temp1\":0,\"temp2\":0}","payloadType":"json","x":150,"y":300,"wires":[["282b88cfcc391588","9ff9a27c6cd822a3"]]},{"id":"71304130f6d73719","type":"change","z":"03a396edb292a231","name":"add temp1 to temp3","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.temp3 + $$.payload.temp1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":400,"wires":[["2082de158de1720e"]]},{"id":"9ff9a27c6cd822a3","type":"debug","z":"03a396edb292a231","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":360,"y":460,"wires":[]},{"id":"2082de158de1720e","type":"debug","z":"03a396edb292a231","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","statusVal":"payload","statusType":"auto","x":830,"y":540,"wires":[]}]

I doubt they are in terms that Node-RED understands. For now assume they are not. In my example, I replaced them with manual injects so you could see how it works. Take the output either from the orange nodes or the blue nodes and feed into change nodes as in my example.

Can you post screenshots of what your modbus nodes are configured as ?

I would suggest you could use a different combination of nodes - for example if you see the screenshot below -

You can see i send an inject every 10 seconds to kick the process off - it first sends a modbus request to the inverter for some information - which is returned and i then move that using the change node into another part of the message. I then do a 2nd query to that inverter (for a different set of registers) and move the results of that query into a different part of the message - here are the screenshots of each of them

image

image

And this is what it looks like in a single message

image

They are no totally synchronized (in terms of both being read at the exact same moment) but for most home requirements are good enough (sub second difference)

Craig

1 Like