How to use RBE node with object

I have object var a = {
"a1": 0,
"a2": 0,
"a3": 0,
"a4": 0,
"a5": 0,
"a6": 0,
"a7": 1,

}

How to check changed value with RBE.
How to create new topic for each value and send to RBE?

[
    {
        "id": "6404444bc697d3b4",
        "type": "rbe",
        "z": "77aa57dc9b449835",
        "name": "",
        "func": "rbei",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 270,
        "y": 100,
        "wires": [
            [
                "981b751314734123"
            ]
        ]
    },
    {
        "id": "e2dc086d7ccb4383",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 90,
        "y": 60,
        "wires": [
            [
                "6404444bc697d3b4"
            ]
        ]
    },
    {
        "id": "5ab06ea56ae9e4a5",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 90,
        "y": 120,
        "wires": [
            [
                "6404444bc697d3b4"
            ]
        ]
    },
    {
        "id": "981b751314734123",
        "type": "debug",
        "z": "77aa57dc9b449835",
        "name": "debug 398",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 410,
        "y": 100,
        "wires": []
    },
    {
        "id": "a3bd23215374c9d7",
        "type": "function",
        "z": "77aa57dc9b449835",
        "name": "function 503",
        "func": "msg.payload = {\n    \"a1\": 0,\n    \"a2\": 0,\n    \"a3\": 0,\n    \"a4\": 0,\n    \"a5\": 0,\n    \"a6\": 0,\n    \"a7\": 0,\n    \n    }\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 250,
        "y": 220,
        "wires": [
            [
                "d102b09971b8fdb9"
            ]
        ]
    },
    {
        "id": "beaf3671431508ac",
        "type": "function",
        "z": "77aa57dc9b449835",
        "name": "function 504",
        "func": "msg.payload = {\n    \"a1\": 0,\n    \"a2\": 0,\n    \"a3\": 0,\n    \"a4\": 0,\n    \"a5\": 0,\n    \"a6\": 0,\n    \"a7\": 1,\n    \n    }\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 250,
        "y": 280,
        "wires": [
            [
                "d102b09971b8fdb9"
            ]
        ]
    },
    {
        "id": "687f3640c739891c",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 220,
        "wires": [
            [
                "a3bd23215374c9d7"
            ]
        ]
    },
    {
        "id": "63c4abf560daaec9",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 280,
        "wires": [
            [
                "beaf3671431508ac"
            ]
        ]
    },
    {
        "id": "d102b09971b8fdb9",
        "type": "rbe",
        "z": "77aa57dc9b449835",
        "name": "",
        "func": "rbei",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 410,
        "y": 240,
        "wires": [
            [
                "2d44c67ec6a8ce4a"
            ]
        ]
    },
    {
        "id": "2d44c67ec6a8ce4a",
        "type": "debug",
        "z": "77aa57dc9b449835",
        "name": "debug 399",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 570,
        "y": 240,
        "wires": []
    }
]

you could convert the object to string (pass it through a JSON node) then pass it through the RBE then pass it once more through a JSON node to convert it back to an Object.

which function ?

:point_down:

Not sure how to say it any clearer. Perhaps my 2nd best explanation will help :wink:

Pass the msg with the payload object through a JSON node (converts it to string) then through the RBE then back through the JSON node to convert it back to an object.

Maybe I'm too newbie :slight_smile:
I thinking about this and it's work with RBE (Apply mode separately for each msg.topic)

for (let x in obj) {
    console.log(x + ": " + obj[x])
    node.send({
        "payload": {
            'opis': x,
            'value': obj[x]
        },
        'topic': x
    });
}

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