Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. Node-Red Modbus mehrere Slave ID´s abfragen

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Node-Red Modbus mehrere Slave ID´s abfragen

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Malaus last edited by Malaus

      Hallo Zusammen,

      ich habe drei SDM120 verbaut, die ich über einen Modbus USB Stick mit dem Raspberry Pi verbunden sind.
      Mit dem Modbus Adapter kann ich alle drei mit der jeweiligen Slave ID auslesen.
      ab508298-5d06-4bbc-890c-9f24ca91b010-image.png

      Ich beschäftige mich in letzter Zeit mit Node-Red und möchte nun von dort aus, die Daten abrufen und in ein Modbus TCP Register schreiben.
      Leider erhalte ich folgende Fehlermeldungen, sobald ich mehrere Slave ID´s abfrage.

      Client -> fsm broken state after init Get More About It By Logging  Serial@/dev/ttyUSB0:9600bit/s default Unit-Id: 1
      

      Ich weiß ehrlich gesagt nicht, wieso er mir hier immer die 1 anzeigt, obwohl ich eine 10, 11, 12 eingestellt habe.

      Mein Flow:

      
      
       [
          {
              "id": "757c82163ab2b168",
              "type": "tab",
              "label": "Modul 0",
              "disabled": false,
              "info": "",
              "env": []
          },
          {
              "id": "67b23b628c81cbc6",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "116",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "116",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 180,
              "wires": [
                  [
                      "3011b69a53a7cddc"
                  ],
                  []
              ]
          },
          {
              "id": "3160695992ac160c",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "117",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "117",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 240,
              "wires": [
                  [
                      "6d0ffb499c058d91"
                  ],
                  []
              ]
          },
          {
              "id": "ec873b51f55f6bae",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "118",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "118",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 300,
              "wires": [
                  [
                      "c45c071d3ca701af"
                  ],
                  []
              ]
          },
          {
              "id": "7a15a268d70a9e25",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "119",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "119",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 360,
              "wires": [
                  [
                      "0a265582ad32b5fc"
                  ],
                  []
              ]
          },
          {
              "id": "78df18b779b294fd",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "120",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "120",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 420,
              "wires": [
                  [
                      "86aa7943771efc79"
                  ],
                  []
              ]
          },
          {
              "id": "2395afb5385eba77",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "121",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "121",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 480,
              "wires": [
                  [
                      "5fdc1caf7ee5c591"
                  ],
                  []
              ]
          },
          {
              "id": "bb62771513958110",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "122",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "122",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 540,
              "wires": [
                  [
                      "7de72fbd14223162"
                  ],
                  []
              ]
          },
          {
              "id": "3707dd58cc2bd62e",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "125",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "125",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 600,
              "wires": [
                  [
                      "6eab3aebfde1cd64"
                  ],
                  []
              ]
          },
          {
              "id": "70a82da09c73768a",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "126",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "126",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 660,
              "wires": [
                  [
                      "d8f6bb5207520f5b"
                  ],
                  []
              ]
          },
          {
              "id": "a3250ae05b079322",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "127",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "",
              "dataType": "InputRegister",
              "adr": "127",
              "quantity": "1",
              "rate": "2",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 1450,
              "y": 720,
              "wires": [
                  [
                      "f0501e7bb08ba6d9"
                  ],
                  []
              ]
          },
          {
              "id": "3011b69a53a7cddc",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Kühlen",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1620,
              "y": 180,
              "wires": [
                  [
                      "4ceaef954de837f3"
                  ]
              ]
          },
          {
              "id": "6d0ffb499c058d91",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Abtauung",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1620,
              "y": 240,
              "wires": [
                  [
                      "0d1b5d693c7f56a5"
                  ]
              ]
          },
          {
              "id": "c45c071d3ca701af",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Lüfter",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1610,
              "y": 300,
              "wires": [
                  [
                      "24a312bc9ec4aaa0"
                  ]
              ]
          },
          {
              "id": "0a265582ad32b5fc",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Temperaturprognose",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1660,
              "y": 360,
              "wires": [
                  [
                      "a89df05023c7b44f"
                  ]
              ]
          },
          {
              "id": "86aa7943771efc79",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Temperaturalarm",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1650,
              "y": 420,
              "wires": [
                  [
                      "849b876610723e30"
                  ]
              ]
          },
          {
              "id": "5fdc1caf7ee5c591",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Sammelalarm",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1640,
              "y": 480,
              "wires": [
                  [
                      "78fbe283b41977e8"
                  ]
              ]
          },
          {
              "id": "7de72fbd14223162",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Schutzbetrieb",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1640,
              "y": 540,
              "wires": [
                  [
                      "a26278e40a8e56e9"
                  ]
              ]
          },
          {
              "id": "6eab3aebfde1cd64",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Kühlstelle aus",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1640,
              "y": 600,
              "wires": [
                  [
                      "a90c8a8ae2740bd2"
                  ]
              ]
          },
          {
              "id": "d8f6bb5207520f5b",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "2. Sollwert",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1630,
              "y": 660,
              "wires": [
                  [
                      "7d030ae97313af75"
                  ]
              ]
          },
          {
              "id": "f0501e7bb08ba6d9",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Kühlraumtür offen",
              "func": "let state;\nif (msg.payload == 1){\n    state = true;\n    msg.payload = 1;\n}else{\n    state = false;\n    msg.payload = 0;\n}\n\nnode.status({ fill: \"blue\", shape: \"ring\", text: state });\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 1650,
              "y": 720,
              "wires": [
                  [
                      "9f781838aa48043d"
                  ]
              ]
          },
          {
              "id": "4ceaef954de837f3",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.108_116_Kühlen",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 180,
              "wires": []
          },
          {
              "id": "0d1b5d693c7f56a5",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.109_117_Abtauung",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 240,
              "wires": []
          },
          {
              "id": "24a312bc9ec4aaa0",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.110_118_Lüfter",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 300,
              "wires": []
          },
          {
              "id": "a89df05023c7b44f",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.111_119_Temperaturprognose",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 360,
              "wires": []
          },
          {
              "id": "849b876610723e30",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.112_120_Temperaturalarm",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 420,
              "wires": []
          },
          {
              "id": "78fbe283b41977e8",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.113_121_Sammelalarm",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 480,
              "wires": []
          },
          {
              "id": "a26278e40a8e56e9",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.114_122_Schutzbetrieb",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 540,
              "wires": []
          },
          {
              "id": "a90c8a8ae2740bd2",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.116_125_Kühlstelle_aus",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 600,
              "wires": []
          },
          {
              "id": "7d030ae97313af75",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.117_126_2_Sollwert",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 660,
              "wires": []
          },
          {
              "id": "9f781838aa48043d",
              "type": "ioBroker out",
              "z": "757c82163ab2b168",
              "name": "Pilotmodul 0",
              "topic": "modbus.5.inputRegisters.118_127_Kühlraumtür_offen",
              "ack": "false",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1930,
              "y": 720,
              "wires": []
          },
          {
              "id": "60156fb849b39645",
              "type": "modbus-flex-server",
              "z": "757c82163ab2b168",
              "name": "Modbus Server ID10",
              "logEnabled": true,
              "serverAddress": "192.168.60.153",
              "serverPort": "502",
              "responseDelay": 100,
              "unitId": "10",
              "delayUnit": "ms",
              "coilsBufferSize": 20000,
              "registersBufferSize": 20000,
              "minAddress": 0,
              "splitAddress": 10000,
              "funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
              "funcGetDiscreteInput": "function getFlexDiscreteInput(addr, unitID) {\n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
              "funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
              "funcGetHoldingRegister": "function getFlexHoldingRegsiter(addr, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
              "funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\tnode.coils.writeUInt8(value, addr * node.bufferFactor)  \n\t} \n}",
              "funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor)  \n\t} \n}",
              "showErrors": true,
              "x": 140,
              "y": 280,
              "wires": [
                  [],
                  [],
                  [],
                  [],
                  []
              ]
          },
          {
              "id": "801dcedf6ff99022",
              "type": "modbus-flex-write",
              "z": "757c82163ab2b168",
              "name": "",
              "showStatusActivities": true,
              "showErrors": true,
              "server": "57cd262ee57c9e3e",
              "emptyMsgOnFail": false,
              "keepMsgProperties": false,
              "x": 1090,
              "y": 280,
              "wires": [
                  [],
                  []
              ]
          },
          {
              "id": "aaa3f95d27c96a7f",
              "type": "inject",
              "z": "757c82163ab2b168",
              "name": "JSON",
              "props": [
                  {
                      "p": "payload"
                  }
              ],
              "repeat": "",
              "crontab": "",
              "once": false,
              "onceDelay": 0.1,
              "topic": "",
              "payload": "[{\"_address\":0,\"name\":\"Voltage\",\"description\":\"Voltage\",\"unit\":\"V\",\"type\":\"floatbe\",\"len\":2,\"factor\":1,\"offset\":0,\"formula\":\"\",\"role\":\"level\",\"room\":\"\",\"cw\":false,\"isScale\":false},{\"_address\":6,\"name\":\"Current\",\"description\":\"Current\",\"unit\":\"A\",\"type\":\"floatbe\",\"len\":2,\"factor\":1,\"offset\":0,\"formula\":\"\",\"role\":\"level\",\"room\":\"\",\"cw\":false,\"isScale\":false},{\"_address\":12,\"name\":\"ActivePower\",\"description\":\"Active Power\",\"unit\":\"W\",\"type\":\"floatbe\",\"len\":2,\"factor\":1,\"offset\":0,\"formula\":\"\",\"role\":\"level\",\"room\":\"\",\"cw\":false,\"isScale\":false},{\"_address\":70,\"name\":\"Frequency\",\"description\":\"Frequency\",\"unit\":\"Hz\",\"type\":\"floatbe\",\"len\":2,\"factor\":1,\"offset\":0,\"formula\":\"\",\"role\":\"level\",\"room\":\"\",\"cw\":false,\"isScale\":false},{\"_address\":342,\"name\":\"TotalActiveEnergy\",\"description\":\"TotalActiveEnergy\",\"unit\":\"kWh\",\"type\":\"floatbe\",\"len\":2,\"factor\":1,\"offset\":0,\"formula\":\"\",\"role\":\"level\",\"room\":\"\",\"cw\":false,\"isScale\":false}]",
              "payloadType": "json",
              "x": 70,
              "y": 100,
              "wires": [
                  [
                      "f63b30aa5b358236"
                  ]
              ]
          },
          {
              "id": "78e6773f7dd46d2b",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "WriteModbus",
              "func": "msg = msg;\nmsg.payload = {\n    value: msg.values,\n    'fc': 6,\n    'unitid': msg.payload.unitid,\n    'address': msg.modbusRequest.address,\n    'quantity': msg.modbusRequest.quantity\n}\nreturn msg;\n\n",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 870,
              "y": 280,
              "wires": [
                  [
                      "801dcedf6ff99022"
                  ]
              ]
          },
          {
              "id": "f63b30aa5b358236",
              "type": "split",
              "z": "757c82163ab2b168",
              "name": "Split array",
              "splt": "\\n",
              "spltType": "str",
              "arraySplt": "1",
              "arraySpltType": "len",
              "stream": false,
              "addname": "parts",
              "x": 240,
              "y": 100,
              "wires": [
                  [
                      "2346241f9dd847f2",
                      "f0a0e093ab9e863b",
                      "c2e47a43ec77fb54"
                  ]
              ]
          },
          {
              "id": "2346241f9dd847f2",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "ReadModbus",
              "func": "msg = msg.payload;\nconst fc = 4;\nconst unitid = 11;\n\nmsg = {\n    topic : msg.name,\n    payload : {\n            'fc': fc,\n            'unitid': JSON.parse(unitid),\n            'address': msg._address,//JSON.parse(y.number),\n            'quantity': 2,\n            'value': 2\n        }\n    }\n\nnode.send(msg);\n",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 430,
              "y": 280,
              "wires": [
                  [
                      "06195ea03e3f1937"
                  ]
              ]
          },
          {
              "id": "4f60d13402a66b28",
              "type": "comment",
              "z": "757c82163ab2b168",
              "name": "L1 ID 10 - read/write",
              "info": "",
              "x": 410,
              "y": 220,
              "wires": []
          },
          {
              "id": "843fab7b7f24209a",
              "type": "comment",
              "z": "757c82163ab2b168",
              "name": "L2 ID 11 - read/write",
              "info": "",
              "x": 410,
              "y": 440,
              "wires": []
          },
          {
              "id": "bcd5a46753363cec",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "WriteModbus",
              "func": "msg = msg;\nmsg.payload = {\n    value: msg.values,\n    'fc': 6,\n    'unitid': msg.payload.unitid,\n    'address': msg.modbusRequest.address,\n    'quantity': msg.modbusRequest.quantity\n}\nreturn msg;\n\n",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 870,
              "y": 700,
              "wires": [
                  [
                      "8d1d044af77e7c32"
                  ]
              ]
          },
          {
              "id": "c2e47a43ec77fb54",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "ReadModbus",
              "func": "msg = msg.payload;\nconst fc = 4;\nconst unitid = 12;\n\nmsg = {\n    topic : msg.name,\n    payload : {\n            'fc': fc,\n            'unitid': JSON.parse(unitid),\n            'address': msg._address,//JSON.parse(y.number),\n            'quantity': 2,\n            'value': 2\n        }\n    }\n\nnode.send(msg);\n",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 430,
              "y": 700,
              "wires": [
                  [
                      "0a216ec2ce918fe7"
                  ]
              ]
          },
          {
              "id": "c64f3e42e42210eb",
              "type": "comment",
              "z": "757c82163ab2b168",
              "name": "L3 ID 12 - read/write",
              "info": "",
              "x": 410,
              "y": 640,
              "wires": []
          },
          {
              "id": "f0a0e093ab9e863b",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "ReadModbus",
              "func": "msg = msg.payload;\nconst fc = 4;\nconst unitid = 12;\n\nmsg = {\n    topic : msg.name,\n    payload : {\n            'fc': fc,\n            'unitid': JSON.parse(unitid),\n            'address': msg._address,//JSON.parse(y.number),\n            'quantity': 2,\n            'value': 2\n        }\n    }\n\nnode.send(msg);\n",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 430,
              "y": 500,
              "wires": [
                  [
                      "7bbdf1b30eb12e6f"
                  ]
              ]
          },
          {
              "id": "a3df994479efa04a",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "WriteModbus",
              "func": "msg = msg;\nmsg.payload = {\n    value: msg.values,\n    'fc': 6,\n    'unitid': msg.payload.unitid,\n    'address': msg.modbusRequest.address,\n    'quantity': msg.modbusRequest.quantity\n}\nreturn msg;\n\n",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 870,
              "y": 500,
              "wires": [
                  [
                      "948a4b10292e6a1f"
                  ]
              ]
          },
          {
              "id": "f16ad2835a23f356",
              "type": "modbus-flex-server",
              "z": "757c82163ab2b168",
              "name": "Modbus Server ID11",
              "logEnabled": true,
              "serverAddress": "192.168.60.153",
              "serverPort": "502",
              "responseDelay": 100,
              "unitId": "11",
              "delayUnit": "ms",
              "coilsBufferSize": 20000,
              "registersBufferSize": 20000,
              "minAddress": 0,
              "splitAddress": 10000,
              "funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
              "funcGetDiscreteInput": "function getFlexDiscreteInput(addr, unitID) {\n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
              "funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
              "funcGetHoldingRegister": "function getFlexHoldingRegsiter(addr, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
              "funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\tnode.coils.writeUInt8(value, addr * node.bufferFactor)  \n\t} \n}",
              "funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor)  \n\t} \n}",
              "showErrors": true,
              "x": 140,
              "y": 500,
              "wires": [
                  [],
                  [],
                  [],
                  [],
                  []
              ]
          },
          {
              "id": "687dd443cb088c25",
              "type": "debug",
              "z": "757c82163ab2b168",
              "name": "debug 18",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "false",
              "statusVal": "",
              "statusType": "auto",
              "x": 660,
              "y": 1000,
              "wires": []
          },
          {
              "id": "428092a5d1348fb9",
              "type": "modbus-flex-server",
              "z": "757c82163ab2b168",
              "name": "Modbus Server ID12",
              "logEnabled": true,
              "serverAddress": "192.168.60.153",
              "serverPort": "502",
              "responseDelay": 100,
              "unitId": "12",
              "delayUnit": "ms",
              "coilsBufferSize": 20000,
              "registersBufferSize": 20000,
              "minAddress": 0,
              "splitAddress": 10000,
              "funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
              "funcGetDiscreteInput": "function getFlexDiscreteInput(addr, unitID) {\n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
              "funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
              "funcGetHoldingRegister": "function getFlexHoldingRegsiter(addr, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
              "funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\tnode.coils.writeUInt8(value, addr * node.bufferFactor)  \n\t} \n}",
              "funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor)  \n\t} \n}",
              "showErrors": true,
              "x": 140,
              "y": 700,
              "wires": [
                  [],
                  [],
                  [],
                  [],
                  []
              ]
          },
          {
              "id": "1b7c133ccb13a0d6",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "SDM 120 Voltage",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "10",
              "dataType": "InputRegister",
              "adr": "0",
              "quantity": "2",
              "rate": "1",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 440,
              "y": 1080,
              "wires": [
                  [
                      "66e3b1a5c272ab63"
                  ],
                  [
                      "687dd443cb088c25"
                  ]
              ]
          },
          {
              "id": "66e3b1a5c272ab63",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Voltage",
              "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"voltage\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload});    \n\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "x": 669,
              "y": 1073,
              "wires": [
                  []
              ]
          },
          {
              "id": "bf1b5b8a5c9ca3dd",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Current",
              "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"current\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload});    \n\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "x": 668,
              "y": 1131,
              "wires": [
                  []
              ]
          },
          {
              "id": "ba252094442041c4",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Power",
              "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"power\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload});    \n\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "x": 659,
              "y": 1184,
              "wires": [
                  []
              ]
          },
          {
              "id": "1d96d36bcc3b7f2a",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Frequency",
              "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"frequency\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload});    \n\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "x": 679,
              "y": 1240,
              "wires": [
                  []
              ]
          },
          {
              "id": "16e146f5fa5daf92",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Energy",
              "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(2));\nmsg.topic = \"energy\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload});    \n\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "x": 669,
              "y": 1300,
              "wires": [
                  []
              ]
          },
          {
              "id": "e39a6a9af95d666f",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "SDM 120 Current",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "10",
              "dataType": "InputRegister",
              "adr": "6",
              "quantity": "2",
              "rate": "1",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 449,
              "y": 1138,
              "wires": [
                  [
                      "bf1b5b8a5c9ca3dd"
                  ],
                  []
              ]
          },
          {
              "id": "0715571ce6120477",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "SDM 120 Power",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "10",
              "dataType": "InputRegister",
              "adr": "12",
              "quantity": "2",
              "rate": "1",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 439,
              "y": 1190,
              "wires": [
                  [
                      "ba252094442041c4"
                  ],
                  []
              ]
          },
          {
              "id": "69c01e9f3eb108ab",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "SDM 120 Frequency",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "10",
              "dataType": "InputRegister",
              "adr": "70",
              "quantity": "2",
              "rate": "1",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 459,
              "y": 1246,
              "wires": [
                  [
                      "1d96d36bcc3b7f2a"
                  ],
                  []
              ]
          },
          {
              "id": "8649077255508a72",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "SDM 120 Energy",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "10",
              "dataType": "InputRegister",
              "adr": "342",
              "quantity": "2",
              "rate": "1",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 437,
              "y": 1305,
              "wires": [
                  [
                      "16e146f5fa5daf92"
                  ],
                  []
              ]
          },
          {
              "id": "33439a04c8377a85",
              "type": "modbus-read",
              "z": "757c82163ab2b168",
              "name": "SDM 120 Voltage",
              "topic": "",
              "showStatusActivities": true,
              "logIOActivities": false,
              "showErrors": true,
              "unitid": "10",
              "dataType": "InputRegister",
              "adr": "0",
              "quantity": "2",
              "rate": "1",
              "rateUnit": "s",
              "delayOnStart": false,
              "startDelayTime": "",
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "x": 440,
              "y": 1400,
              "wires": [
                  [
                      "805c211adb031882"
                  ],
                  []
              ]
          },
          {
              "id": "805c211adb031882",
              "type": "function",
              "z": "757c82163ab2b168",
              "name": "Voltage",
              "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"voltage\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload});    \n\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "x": 669,
              "y": 1393,
              "wires": [
                  []
              ]
          },
          {
              "id": "06195ea03e3f1937",
              "type": "modbus-flex-getter",
              "z": "757c82163ab2b168",
              "name": "",
              "showStatusActivities": false,
              "showErrors": false,
              "logIOActivities": false,
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "keepMsgProperties": false,
              "x": 650,
              "y": 280,
              "wires": [
                  [
                      "78e6773f7dd46d2b"
                  ],
                  []
              ]
          },
          {
              "id": "7bbdf1b30eb12e6f",
              "type": "modbus-flex-getter",
              "z": "757c82163ab2b168",
              "name": "",
              "showStatusActivities": false,
              "showErrors": false,
              "logIOActivities": false,
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "keepMsgProperties": false,
              "x": 650,
              "y": 500,
              "wires": [
                  [
                      "a3df994479efa04a"
                  ],
                  []
              ]
          },
          {
              "id": "948a4b10292e6a1f",
              "type": "modbus-flex-write",
              "z": "757c82163ab2b168",
              "name": "",
              "showStatusActivities": true,
              "showErrors": true,
              "server": "96c4889733a047a6",
              "emptyMsgOnFail": false,
              "keepMsgProperties": false,
              "x": 1090,
              "y": 500,
              "wires": [
                  [],
                  []
              ]
          },
          {
              "id": "0a216ec2ce918fe7",
              "type": "modbus-flex-getter",
              "z": "757c82163ab2b168",
              "name": "",
              "showStatusActivities": false,
              "showErrors": false,
              "logIOActivities": false,
              "server": "40f20c7f.13a934",
              "useIOFile": false,
              "ioFile": "",
              "useIOForPayload": false,
              "emptyMsgOnFail": false,
              "keepMsgProperties": false,
              "x": 650,
              "y": 700,
              "wires": [
                  [
                      "bcd5a46753363cec"
                  ],
                  []
              ]
          },
          {
              "id": "8d1d044af77e7c32",
              "type": "modbus-flex-write",
              "z": "757c82163ab2b168",
              "name": "",
              "showStatusActivities": true,
              "showErrors": true,
              "server": "28c8b36f179c502c",
              "emptyMsgOnFail": false,
              "keepMsgProperties": false,
              "x": 1090,
              "y": 700,
              "wires": [
                  [],
                  []
              ]
          },
          {
              "id": "57cd262ee57c9e3e",
              "type": "modbus-client",
              "name": "10",
              "clienttype": "tcp",
              "bufferCommands": true,
              "stateLogEnabled": false,
              "queueLogEnabled": false,
              "failureLogEnabled": true,
              "tcpHost": "192.168.60.153",
              "tcpPort": "502",
              "tcpType": "DEFAULT",
              "serialPort": "/dev/ttyUSB",
              "serialType": "RTU-BUFFERD",
              "serialBaudrate": "9600",
              "serialDatabits": "8",
              "serialStopbits": "1",
              "serialParity": "none",
              "serialConnectionDelay": "100",
              "serialAsciiResponseStartDelimiter": "0x3A",
              "unit_id": "",
              "commandDelay": 1,
              "clientTimeout": 1000,
              "reconnectOnTimeout": true,
              "reconnectTimeout": 2000,
              "parallelUnitIdsAllowed": false
          },
          {
              "id": "40f20c7f.13a934",
              "type": "modbus-client",
              "name": "Serial_10",
              "clienttype": "serial",
              "bufferCommands": true,
              "stateLogEnabled": false,
              "queueLogEnabled": true,
              "failureLogEnabled": true,
              "tcpHost": "127.0.0.1",
              "tcpPort": "502",
              "tcpType": "DEFAULT",
              "serialPort": "/dev/ttyUSB0",
              "serialType": "RTU-BUFFERD",
              "serialBaudrate": "9600",
              "serialDatabits": "8",
              "serialStopbits": "1",
              "serialParity": "none",
              "serialConnectionDelay": "100",
              "serialAsciiResponseStartDelimiter": "",
              "unit_id": "",
              "commandDelay": 100,
              "clientTimeout": 2000,
              "reconnectOnTimeout": false,
              "reconnectTimeout": 5000,
              "parallelUnitIdsAllowed": true
          },
          {
              "id": "96c4889733a047a6",
              "type": "modbus-client",
              "name": "11",
              "clienttype": "tcp",
              "bufferCommands": true,
              "stateLogEnabled": false,
              "queueLogEnabled": false,
              "failureLogEnabled": true,
              "tcpHost": "192.168.60.153",
              "tcpPort": "502",
              "tcpType": "DEFAULT",
              "serialPort": "/dev/ttyUSB",
              "serialType": "RTU-BUFFERD",
              "serialBaudrate": "9600",
              "serialDatabits": "8",
              "serialStopbits": "1",
              "serialParity": "none",
              "serialConnectionDelay": "100",
              "serialAsciiResponseStartDelimiter": "0x3A",
              "unit_id": "",
              "commandDelay": "1",
              "clientTimeout": "1000",
              "reconnectOnTimeout": true,
              "reconnectTimeout": "2000",
              "parallelUnitIdsAllowed": true
          },
          {
              "id": "28c8b36f179c502c",
              "type": "modbus-client",
              "name": "12",
              "clienttype": "tcp",
              "bufferCommands": true,
              "stateLogEnabled": false,
              "queueLogEnabled": false,
              "failureLogEnabled": true,
              "tcpHost": "192.168.60.153",
              "tcpPort": "502",
              "tcpType": "DEFAULT",
              "serialPort": "/dev/ttyUSB",
              "serialType": "RTU-BUFFERD",
              "serialBaudrate": "9600",
              "serialDatabits": "8",
              "serialStopbits": "1",
              "serialParity": "none",
              "serialConnectionDelay": "100",
              "serialAsciiResponseStartDelimiter": "0x3A",
              "unit_id": 12,
              "commandDelay": 1,
              "clientTimeout": 1000,
              "reconnectOnTimeout": true,
              "reconnectTimeout": 2000,
              "parallelUnitIdsAllowed": true
          }
      ]
      

      Wenn ich den offiziellen Flow benutze, funktioniert es bei einer ID. Kommt eine weitere dazu, erhalte ich wieder die gleiche Meldung wie oben.
      https://flows.nodered.org/flow/75a4715fb6a3595057343a92abc493e4

      wendy2702 1 Reply Last reply Reply Quote 0
      • wendy2702
        wendy2702 @Malaus last edited by

        @malaus Du solltest den Titel editieren und erwähnen das es sich um "Node-Red" handelt.

        1 Reply Last reply Reply Quote 1
        • mickym
          mickym Most Active last edited by

          @malaus sagte in Node-Red Modbus mehrere Slave ID´s abfragen:

          1. Wenn Du einen Flow postest - dann bitte in Code-Tags da ansonsten nicht importierbar da die Forensoftware bestimmte Zeichen zur Formatierung verwendet.
          2. Falls Du Modbus Nodes und den Adapter verwendest, dann weiss ich nicht, ob das zu Konflikten kommt, Wenn Du über den iobroker Adapter kommunizierst, dann brauchst Du doch die Node-Red Nodes nicht mehr.
          M 1 Reply Last reply Reply Quote 0
          • M
            Malaus @mickym last edited by Malaus

            @mickym Danke für den Hinweis. Habe es im ersten Post korrigiert.

            Hier wäre auch ein Screenshot:
            8361a7c2-88ad-41b9-b0a9-a5a3bee50012-image.png

            Den Modbus Adapter muss ich stoppen, sonst kann ich keine Daten abrufen.

            Weshalb ich das ganze über NodeRed machen möchte, weil ich die Daten anschließend an Modbus TCP schicken möchte. Wenn ich das über den Modbus Adapter mache, muss ich ein Javascript schreiben und dort die Werte an die neue Modbus Instanz übertragen. Und da ich zurzeit viel mit NodeRed ausprobiere, dachte ich es wäre doch schöner das ganze hier umzusetzen.

            Was ich aber noch nicht verstehe ist, dass ich diese drei Geräte über den Modbus Adapter erreiche und bei NodeRed nicht bzw. dort immer nur eins gleichzeitig. Liegt das vielleicht daran, dass ich nur eine aktive Verbindung aufbauen darf?

            mickym G 2 Replies Last reply Reply Quote 0
            • mickym
              mickym Most Active @Malaus last edited by

              @malaus Aber du kannst doch die Datenpunkte über des Modbus Adapters in Node-Red auslesen und beschreiben. Dafür brauchst Du die Modbus Nodes nicht. Und musst auch nichts programmieren.

              M 1 Reply Last reply Reply Quote 0
              • M
                Malaus @mickym last edited by Malaus

                @mickym ums programmieren gehts mir nicht. Ich wollte es einfach ausprobieren beides in NodeRed umzusetzen. Klar, ich kann die Daten auch von ioBroker ins NodeRed holen und diese dort weiterleiten an Modbus TCP.
                Es wundert mich halt noch immer, wieso das mit dem Modbus Adapter funktioniert aber nicht mit NodeRed.

                mickym 1 Reply Last reply Reply Quote 0
                • mickym
                  mickym Most Active @Malaus last edited by mickym

                  @malaus Wie gesagt kann es sein, dass ich da was beisst. 😉 Vielleicht musst den Adapter mal deaktivieren und schauen, ob es sich dann anders verhält. Ich kann Dir sonst leider nichts dazu sagen - weil alles was mit Schnittstellen zu Geräten zu tun hat, ich nicht nachvollziehen kann.

                  1 Reply Last reply Reply Quote 0
                  • G
                    Garf @Malaus last edited by

                    @malaus sagte in Node-Red Modbus mehrere Slave ID´s abfragen:

                    Was ich aber noch nicht verstehe ist, dass ich diese drei Geräte über den Modbus Adapter erreiche und bei NodeRed nicht bzw. dort immer nur eins gleichzeitig. Liegt das vielleicht daran, dass ich nur eine aktive Verbindung aufbauen darf?

                    Aber er liest doch Daten aus.
                    58e5ff52-2a53-41c2-96f3-a91df6d849ce-grafik.png

                    Der Flow kommt mir recht seltsam vor. Den drei SDM hast Du doch unterschiedliche Adressen vergeben? Ich würde sie nacheinander mal einzeln und auch nur einen DP abfragen. Dazu würde ich nicht das Flex Getter verwenden. Ich würde in kleinen Schritten vorgehen. Um wieder Dezimalzahlen zu bekommen gibt es den BufferParser.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      Malaus @Garf last edited by Malaus

                      @garf sagte in Node-Red Modbus mehrere Slave ID´s abfragen:

                      Aber er liest doch Daten aus.
                      58e5ff52-2a53-41c2-96f3-a91df6d849ce-grafik.png

                      Das war aus einem Versuch mit nur einer Geräten ID.

                      Der Flow kommt mir recht seltsam vor. Den drei SDM hast Du doch unterschiedliche Adressen vergeben? Ich würde sie nacheinander mal einzeln und auch nur einen DP abfragen. Dazu würde ich nicht das Flex Getter verwenden. Ich würde in kleinen Schritten vorgehen. Um wieder Dezimalzahlen zu bekommen gibt es den BufferParser.

                      Wieso nicht das Flex Getter benutzen?

                      Ich hab das ganze mal so ausprobiert:
                      e81570fb-bc99-4bba-9201-2fe6994c9749-image.png
                      938515e0-669a-42e5-a073-802f1ee016b4-image.png

                      Hier schicke ich eine Anfrage an das Gerät 10. Das funktioniert. Baue ich nun in die Funktion eine weitere Anfrage mit einer anderen Geräte ID ein, erhalte ich eine Fehlermeldung.

                      Baue ich hingegen eine zweite Funktion für das Gerät 11 und drücke nacheinander, funktioniert es.
                      1ff05d7a-fd2a-4c70-95c7-f005c7d5510c-image.png

                      Wenn ich jetzt einen weitern Schritt gehe und das ganze so baue, geht es auch:
                      6b5736df-eafb-4e84-9fa8-42a7665e44cc-image.png
                      Obwohl ich hier eine Dauerschleife eingebaut habe...

                      Bedeutet für mich, dass ich das so bauen muss, das erst die Anfragen an eine andere ID geschickt werden darf, wenn gerade keine Kommunikation stattfindet. Vermutlich ist das dann so im Modbus Adapter eingebaut.
                      Jetzt stellt sich mir die Frage, wie bekomme ich mit, dass der Lauf mit der Abfrage einer ID beendet ist?
                      Ich habe das ganze ja als JSON gebaut und frage durch ein Split nacheinander alles ab.
                      e0227220-cf78-418e-a9ab-e7ae8c1278ff-image.png
                      Alles in eine JSON packen und nacheinander abfragen lassen, geht nicht. Vermutlich wird ein Delay zw. den ID´s benötigt.

                      Vielleicht mit einem Zähler, der die Nachrichten am Ende liest und sobald die Menge der Nachrichten erreicht ist, aktiviert es die nächste ID. - funktioniert nicht wie gedacht.

                      Meine Lösung:
                      bf2f9e42-31d7-4f27-9756-5ac32e0ab036-image.png
                      Ich frage bei "JSON ID11" und "JSON ID12" ab, welches topic zuletzt abgefragt worden ist.
                      Ist es das letzte, kann gestartet werden.
                      286c6626-6036-4149-97ef-1c3e75a71431-image.png
                      So kann ich nun alle drei Geräte ID´s abfragen.

                      @mickym hast du vielleicht eine Idee, wie man das in NodeRed umsetzen könnte?
                      vielleicht gibts hier eine elegantere Lösung?

                      mickym G 2 Replies Last reply Reply Quote 0
                      • mickym
                        mickym Most Active @Malaus last edited by

                        @malaus Ich mach Die mal einen Flow , wie es evtl. dann gehen könnte. Kann es sein, dass die Obkelte immer gleich ausschauen und sich nur die ID ändert? - Wenn ja dann poste mir doch mal bitte EIN Objekt - wo man nur die ID austauschen muss. Wenn sich die Objekte sonst noch unterscheiden halt das ganze Array mit den 3 Objekten - hier in Code Tags.

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          Malaus @mickym last edited by

                          @mickym
                          Die Objekte, die ich abfrage sind bei allen drei Geräten gleich. Sie unterscheiden sich nur von der Geräten ID (unitId).
                          Ich weiß, du wolltest nur eins, ich hab dir aber mal zwei kopiert, damit der Unterschied bzw. das was gleich ist, ersichtlicher ist.

                          {
                            "unitId": 10,
                            "_address": 0,
                            "name": "Voltage",
                            "description": "Voltage",
                            "unit": "V",
                            "type": "floatbe",
                            "len": 2,
                            "factor": 1,
                            "offset": 0,
                            "formula": "",
                            "role": "level",
                            "room": "",
                            "cw": false,
                            "isScale": false
                          },
                          {
                           "unitId": 10,
                            "_address": 6,
                            "name": "Current",
                            "description": "Current",
                            "unit": "A",
                            "type": "floatbe",
                            "len": 2,
                            "factor": 1,
                            "offset": 0,
                            "formula": "",
                            "role": "level",
                            "room": "",
                            "cw": false,
                            "isScale": false
                          },
                          

                          Das ganze sieht inzwischen bei mir so aus:
                          810ea760-cffe-4c2c-8a93-3538dd2e7433-image.png
                          Flow:

                          [
                             {
                                 "id": "c54bca7562265ca3",
                                 "type": "tab",
                                 "label": "Flow 3",
                                 "disabled": false,
                                 "info": "",
                                 "env": []
                             },
                             {
                                 "id": "f2922e884087f046",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "WriteModbus",
                                 "func": "msg = msg;\n\nmsg.payload = {\n    value: msg.payload,\n    'fc': 6,\n    'unitid': 1,//msg.unitId,\n    'address': msg.modbusRequest.address,\n    'quantity': msg.modbusRequest.quantity\n}\nreturn msg;\n\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 1030,
                                 "y": 280,
                                 "wires": [
                                     [
                                         "99c1f11c70531f02"
                                     ]
                                 ]
                             },
                             {
                                 "id": "815a99d2e6bf9ed4",
                                 "type": "split",
                                 "z": "c54bca7562265ca3",
                                 "name": "Split array",
                                 "splt": "\\n",
                                 "spltType": "str",
                                 "arraySplt": "1",
                                 "arraySpltType": "len",
                                 "stream": false,
                                 "addname": "parts",
                                 "x": 360,
                                 "y": 320,
                                 "wires": [
                                     [
                                         "f3f2d24ab23758cd"
                                     ]
                                 ]
                             },
                             {
                                 "id": "f3f2d24ab23758cd",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "ReadModbus",
                                 "func": "msg = msg.payload;\nconst fc = 4;\n//const unitid = 10;\n\nmsg = {\n    topic : msg.name,\n    payload : {\n            'fc': fc,\n            'unitid': msg.unitId,//JSON.parse(unitid),\n            'address': msg._address,//JSON.parse(y.number),\n            'quantity': 2,\n            'value': 2\n        }\n    }\n\nnode.send(msg);\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 530,
                                 "y": 320,
                                 "wires": [
                                     [
                                         "1c1d3d0c781fb502"
                                     ]
                                 ]
                             },
                             {
                                 "id": "6550c3991f50a8f4",
                                 "type": "comment",
                                 "z": "c54bca7562265ca3",
                                 "name": "L1 ID 10 - read/write",
                                 "info": "",
                                 "x": 490,
                                 "y": 260,
                                 "wires": []
                             },
                             {
                                 "id": "8d95de296353e88f",
                                 "type": "comment",
                                 "z": "c54bca7562265ca3",
                                 "name": "L2 ID 11 - read/write",
                                 "info": "",
                                 "x": 490,
                                 "y": 480,
                                 "wires": []
                             },
                             {
                                 "id": "972d431852b0de4d",
                                 "type": "comment",
                                 "z": "c54bca7562265ca3",
                                 "name": "L3 ID 12 - read/write",
                                 "info": "",
                                 "x": 490,
                                 "y": 680,
                                 "wires": []
                             },
                             {
                                 "id": "1c1d3d0c781fb502",
                                 "type": "modbus-flex-getter",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "showStatusActivities": false,
                                 "showErrors": false,
                                 "logIOActivities": false,
                                 "server": "40f20c7f.13a934",
                                 "useIOFile": false,
                                 "ioFile": "",
                                 "useIOForPayload": false,
                                 "emptyMsgOnFail": false,
                                 "keepMsgProperties": false,
                                 "x": 730,
                                 "y": 320,
                                 "wires": [
                                     [
                                         "f2922e884087f046"
                                     ],
                                     [
                                         "ee5558d45eeaf040",
                                         "a035f7f84b852f5b"
                                     ]
                                 ]
                             },
                             {
                                 "id": "ee5558d45eeaf040",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "JSON ID11",
                                 "func": "let x = msg;\nif (x.topic === \"TotalReactiveEnergy\") {\n\n\nmsg.payload = \n        [\n            {\n                \"unitId\": 11,\n                \"_address\": 0,\n                \"name\": \"Voltage\",\n                \"description\": \"Voltage\",\n                \"unit\": \"V\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 6,\n                \"name\": \"Current\",\n                \"description\": \"Current\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 12,\n                \"name\": \"ActivePower\",\n                \"description\": \"Active Power\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 18,\n                \"name\": \"ApparentPower\",\n                \"description\": \"ApparentPower\",\n                \"unit\": \"VA\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 24,\n                \"name\": \"ReactivePower\",\n                \"description\": \"ReactivePower\",\n                \"unit\": \"VAr\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 30,\n                \"name\": \"PowerFactor\",\n                \"description\": \"PowerFactor\",\n                \"unit\": \"\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 70,\n                \"name\": \"Frequency\",\n                \"description\": \"Frequency\",\n                \"unit\": \"Hz\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 72,\n                \"name\": \"ActiveEnergy\",\n                \"description\": \"Active Energy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 74,\n                \"name\": \"ExportActiveEnergy\",\n                \"description\": \"ExportActiveEnergy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 74,\n                \"name\": \"TotalSystemPowerDemand\",\n                \"description\": \"TotalSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 76,\n                \"name\": \"ImportReactiveEnergy\",\n                \"description\": \"ImportReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 76,\n                \"name\": \"MaxTotalSystemPowerDemand\",\n                \"description\": \"MaxTotalSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 78,\n                \"name\": \"ExportReactiveEnergy\",\n                \"description\": \"ExportReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 88,\n                \"name\": \"ImportSystemPowerDemand\",\n                \"description\": \"ImportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 90,\n                \"name\": \"MaxImportSystemPowerDemand\",\n                \"description\": \"MaxImportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 92,\n                \"name\": \"ExportSystemPowerDemand\",\n                \"description\": \"ExportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 94,\n                \"name\": \"MaxExportSystemPowerDemand\",\n                \"description\": \"MaxExportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 258,\n                \"name\": \"CurrentDemand\",\n                \"description\": \"CurrentDemand\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 264,\n                \"name\": \"MaxCurrentDemand\",\n                \"description\": \"MaxCurrentDemand\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 342,\n                \"name\": \"TotalActiveEnergy\",\n                \"description\": \"TotalActiveEnergy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 11,\n                \"_address\": 344,\n                \"name\": \"TotalReactiveEnergy\",\n                \"description\": \"TotalReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            }\n\n        ]\n\n\nreturn msg;\n}",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 210,
                                 "y": 540,
                                 "wires": [
                                     [
                                         "82f015af713aaed9"
                                     ]
                                 ]
                             },
                             {
                                 "id": "7a55b60b988b7063",
                                 "type": "modbus-flex-getter",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "showStatusActivities": false,
                                 "showErrors": false,
                                 "logIOActivities": false,
                                 "server": "40f20c7f.13a934",
                                 "useIOFile": false,
                                 "ioFile": "",
                                 "useIOForPayload": false,
                                 "emptyMsgOnFail": false,
                                 "keepMsgProperties": false,
                                 "x": 730,
                                 "y": 540,
                                 "wires": [
                                     [
                                         "c41c8139b9c03e79"
                                     ],
                                     [
                                         "48aa3a74bcafa90e",
                                         "363902c7450bf34a"
                                     ]
                                 ]
                             },
                             {
                                 "id": "82f015af713aaed9",
                                 "type": "split",
                                 "z": "c54bca7562265ca3",
                                 "name": "Split array",
                                 "splt": "\\n",
                                 "spltType": "str",
                                 "arraySplt": "1",
                                 "arraySpltType": "len",
                                 "stream": false,
                                 "addname": "parts",
                                 "x": 360,
                                 "y": 540,
                                 "wires": [
                                     [
                                         "5f7fb500131410b5"
                                     ]
                                 ]
                             },
                             {
                                 "id": "5f7fb500131410b5",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "ReadModbus",
                                 "func": "msg = msg.payload;\nconst fc = 4;\n//const unitid = 10;\n\nmsg = {\n    topic : msg.name,\n    payload : {\n            'fc': fc,\n            'unitid': msg.unitId,//JSON.parse(unitid),\n            'address': msg._address,//JSON.parse(y.number),\n            'quantity': 2,\n            'value': 2\n        }\n    }\n\nnode.send(msg);\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 530,
                                 "y": 540,
                                 "wires": [
                                     [
                                         "7a55b60b988b7063"
                                     ]
                                 ]
                             },
                             {
                                 "id": "48aa3a74bcafa90e",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "JSON ID12",
                                 "func": "let x = msg;\nif (x.topic === \"TotalReactiveEnergy\") {\n\n\n    msg.payload = \n    [\n        {\n            \"unitId\": 12,\n            \"_address\": 0,\n            \"name\": \"Voltage\",\n            \"description\": \"Voltage\",\n            \"unit\": \"V\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 6,\n            \"name\": \"Current\",\n            \"description\": \"Current\",\n            \"unit\": \"A\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 12,\n            \"name\": \"ActivePower\",\n            \"description\": \"Active Power\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 18,\n            \"name\": \"ApparentPower\",\n            \"description\": \"ApparentPower\",\n            \"unit\": \"VA\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 24,\n            \"name\": \"ReactivePower\",\n            \"description\": \"ReactivePower\",\n            \"unit\": \"VAr\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 30,\n            \"name\": \"PowerFactor\",\n            \"description\": \"PowerFactor\",\n            \"unit\": \"\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 70,\n            \"name\": \"Frequency\",\n            \"description\": \"Frequency\",\n            \"unit\": \"Hz\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 72,\n            \"name\": \"ActiveEnergy\",\n            \"description\": \"Active Energy\",\n            \"unit\": \"kWh\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 74,\n            \"name\": \"ExportActiveEnergy\",\n            \"description\": \"ExportActiveEnergy\",\n            \"unit\": \"kWh\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 74,\n            \"name\": \"TotalSystemPowerDemand\",\n            \"description\": \"TotalSystemPowerDemand\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 76,\n            \"name\": \"ImportReactiveEnergy\",\n            \"description\": \"ImportReactiveEnergy\",\n            \"unit\": \"kvarh\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 76,\n            \"name\": \"MaxTotalSystemPowerDemand\",\n            \"description\": \"MaxTotalSystemPowerDemand\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 78,\n            \"name\": \"ExportReactiveEnergy\",\n            \"description\": \"ExportReactiveEnergy\",\n            \"unit\": \"kvarh\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 88,\n            \"name\": \"ImportSystemPowerDemand\",\n            \"description\": \"ImportSystemPowerDemand\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 90,\n            \"name\": \"MaxImportSystemPowerDemand\",\n            \"description\": \"MaxImportSystemPowerDemand\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 92,\n            \"name\": \"ExportSystemPowerDemand\",\n            \"description\": \"ExportSystemPowerDemand\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 94,\n            \"name\": \"MaxExportSystemPowerDemand\",\n            \"description\": \"MaxExportSystemPowerDemand\",\n            \"unit\": \"W\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 258,\n            \"name\": \"CurrentDemand\",\n            \"description\": \"CurrentDemand\",\n            \"unit\": \"A\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 264,\n            \"name\": \"MaxCurrentDemand\",\n            \"description\": \"MaxCurrentDemand\",\n            \"unit\": \"A\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 342,\n            \"name\": \"TotalActiveEnergy\",\n            \"description\": \"TotalActiveEnergy\",\n            \"unit\": \"kWh\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        },\n        {\n            \"unitId\": 12,\n            \"_address\": 344,\n            \"name\": \"TotalReactiveEnergy\",\n            \"description\": \"TotalReactiveEnergy\",\n            \"unit\": \"kvarh\",\n            \"type\": \"floatbe\",\n            \"len\": 2,\n            \"factor\": 1,\n            \"offset\": 0,\n            \"formula\": \"\",\n            \"role\": \"level\",\n            \"room\": \"\",\n            \"cw\": false,\n            \"isScale\": false\n        }\n\n    ]\n\n\n\nreturn msg;\n}",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 210,
                                 "y": 740,
                                 "wires": [
                                     [
                                         "5ba607adfe619264"
                                     ]
                                 ]
                             },
                             {
                                 "id": "77c985566abb5e50",
                                 "type": "modbus-flex-getter",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "showStatusActivities": false,
                                 "showErrors": false,
                                 "logIOActivities": false,
                                 "server": "40f20c7f.13a934",
                                 "useIOFile": false,
                                 "ioFile": "",
                                 "useIOForPayload": false,
                                 "emptyMsgOnFail": false,
                                 "keepMsgProperties": false,
                                 "x": 730,
                                 "y": 740,
                                 "wires": [
                                     [
                                         "e7d9c9ab5ee6383f"
                                     ],
                                     [
                                         "66b67a91e4198f33",
                                         "ebc8a38e5380b0e3"
                                     ]
                                 ]
                             },
                             {
                                 "id": "5ba607adfe619264",
                                 "type": "split",
                                 "z": "c54bca7562265ca3",
                                 "name": "Split array",
                                 "splt": "\\n",
                                 "spltType": "str",
                                 "arraySplt": "1",
                                 "arraySpltType": "len",
                                 "stream": false,
                                 "addname": "parts",
                                 "x": 360,
                                 "y": 740,
                                 "wires": [
                                     [
                                         "76c860654c1beb5c"
                                     ]
                                 ]
                             },
                             {
                                 "id": "76c860654c1beb5c",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "ReadModbus",
                                 "func": "msg = msg.payload;\nconst fc = 4;\n//const unitid = 10;\n\nmsg = {\n    topic : msg.name,\n    payload : {\n            'fc': fc,\n            'unitid': msg.unitId,//JSON.parse(unitid),\n            'address': msg._address,//JSON.parse(y.number),\n            'quantity': 2,\n            'value': 2\n        }\n    }\n\nnode.send(msg);\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 530,
                                 "y": 740,
                                 "wires": [
                                     [
                                         "77c985566abb5e50"
                                     ]
                                 ]
                             },
                             {
                                 "id": "ebc8a38e5380b0e3",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "JSON ID10",
                                 "func": "let x = msg;\nif (x.topic === \"TotalReactiveEnergy\") {\n\n\n    msg.payload = \n        [\n            {\n                \"unitId\": 10,\n                \"_address\": 0,\n                \"name\": \"Voltage\",\n                \"description\": \"Voltage\",\n                \"unit\": \"V\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 6,\n                \"name\": \"Current\",\n                \"description\": \"Current\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 12,\n                \"name\": \"ActivePower\",\n                \"description\": \"Active Power\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 18,\n                \"name\": \"ApparentPower\",\n                \"description\": \"ApparentPower\",\n                \"unit\": \"VA\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 24,\n                \"name\": \"ReactivePower\",\n                \"description\": \"ReactivePower\",\n                \"unit\": \"VAr\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 30,\n                \"name\": \"PowerFactor\",\n                \"description\": \"PowerFactor\",\n                \"unit\": \"\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 70,\n                \"name\": \"Frequency\",\n                \"description\": \"Frequency\",\n                \"unit\": \"Hz\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 72,\n                \"name\": \"ActiveEnergy\",\n                \"description\": \"Active Energy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 74,\n                \"name\": \"ExportActiveEnergy\",\n                \"description\": \"ExportActiveEnergy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 74,\n                \"name\": \"TotalSystemPowerDemand\",\n                \"description\": \"TotalSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 76,\n                \"name\": \"ImportReactiveEnergy\",\n                \"description\": \"ImportReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 76,\n                \"name\": \"MaxTotalSystemPowerDemand\",\n                \"description\": \"MaxTotalSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 78,\n                \"name\": \"ExportReactiveEnergy\",\n                \"description\": \"ExportReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 88,\n                \"name\": \"ImportSystemPowerDemand\",\n                \"description\": \"ImportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 90,\n                \"name\": \"MaxImportSystemPowerDemand\",\n                \"description\": \"MaxImportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 92,\n                \"name\": \"ExportSystemPowerDemand\",\n                \"description\": \"ExportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 94,\n                \"name\": \"MaxExportSystemPowerDemand\",\n                \"description\": \"MaxExportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 258,\n                \"name\": \"CurrentDemand\",\n                \"description\": \"CurrentDemand\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 264,\n                \"name\": \"MaxCurrentDemand\",\n                \"description\": \"MaxCurrentDemand\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 342,\n                \"name\": \"TotalActiveEnergy\",\n                \"description\": \"TotalActiveEnergy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 344,\n                \"name\": \"TotalReactiveEnergy\",\n                \"description\": \"TotalReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            }\n\n        ]\n\nreturn msg;\n}",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 210,
                                 "y": 320,
                                 "wires": [
                                     [
                                         "815a99d2e6bf9ed4"
                                     ]
                                 ]
                             },
                             {
                                 "id": "7d7e7f06c4fe1986",
                                 "type": "inject",
                                 "z": "c54bca7562265ca3",
                                 "name": "Start",
                                 "props": [
                                     {
                                         "p": "payload"
                                     },
                                     {
                                         "p": "topic",
                                         "vt": "str"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "",
                                 "payloadType": "date",
                                 "x": 190,
                                 "y": 200,
                                 "wires": [
                                     [
                                         "01a58d010ff88442"
                                     ]
                                 ]
                             },
                             {
                                 "id": "01a58d010ff88442",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "JSON ID10",
                                 "func": "msg.payload = \n[\n            {\n                \"unitId\": 10,\n                \"_address\": 0,\n                \"name\": \"Voltage\",\n                \"description\": \"Voltage\",\n                \"unit\": \"V\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 6,\n                \"name\": \"Current\",\n                \"description\": \"Current\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 12,\n                \"name\": \"ActivePower\",\n                \"description\": \"Active Power\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 18,\n                \"name\": \"ApparentPower\",\n                \"description\": \"ApparentPower\",\n                \"unit\": \"VA\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 24,\n                \"name\": \"ReactivePower\",\n                \"description\": \"ReactivePower\",\n                \"unit\": \"VAr\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 30,\n                \"name\": \"PowerFactor\",\n                \"description\": \"PowerFactor\",\n                \"unit\": \"\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 70,\n                \"name\": \"Frequency\",\n                \"description\": \"Frequency\",\n                \"unit\": \"Hz\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 72,\n                \"name\": \"ActiveEnergy\",\n                \"description\": \"Active Energy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 74,\n                \"name\": \"ExportActiveEnergy\",\n                \"description\": \"ExportActiveEnergy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 74,\n                \"name\": \"TotalSystemPowerDemand\",\n                \"description\": \"TotalSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 76,\n                \"name\": \"ImportReactiveEnergy\",\n                \"description\": \"ImportReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 76,\n                \"name\": \"MaxTotalSystemPowerDemand\",\n                \"description\": \"MaxTotalSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 78,\n                \"name\": \"ExportReactiveEnergy\",\n                \"description\": \"ExportReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 88,\n                \"name\": \"ImportSystemPowerDemand\",\n                \"description\": \"ImportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 90,\n                \"name\": \"MaxImportSystemPowerDemand\",\n                \"description\": \"MaxImportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 92,\n                \"name\": \"ExportSystemPowerDemand\",\n                \"description\": \"ExportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 94,\n                \"name\": \"MaxExportSystemPowerDemand\",\n                \"description\": \"MaxExportSystemPowerDemand\",\n                \"unit\": \"W\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 258,\n                \"name\": \"CurrentDemand\",\n                \"description\": \"CurrentDemand\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 264,\n                \"name\": \"MaxCurrentDemand\",\n                \"description\": \"MaxCurrentDemand\",\n                \"unit\": \"A\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 342,\n                \"name\": \"TotalActiveEnergy\",\n                \"description\": \"TotalActiveEnergy\",\n                \"unit\": \"kWh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            },\n            {\n                \"unitId\": 10,\n                \"_address\": 344,\n                \"name\": \"TotalReactiveEnergy\",\n                \"description\": \"TotalReactiveEnergy\",\n                \"unit\": \"kvarh\",\n                \"type\": \"floatbe\",\n                \"len\": 2,\n                \"factor\": 1,\n                \"offset\": 0,\n                \"formula\": \"\",\n                \"role\": \"level\",\n                \"room\": \"\",\n                \"cw\": false,\n                \"isScale\": false\n            }\n]\n\nreturn msg;\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 330,
                                 "y": 200,
                                 "wires": [
                                     [
                                         "815a99d2e6bf9ed4"
                                     ]
                                 ]
                             },
                             {
                                 "id": "99c1f11c70531f02",
                                 "type": "modbus-flex-write",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "showStatusActivities": true,
                                 "showErrors": true,
                                 "server": "17022420f90b4c00",
                                 "emptyMsgOnFail": false,
                                 "keepMsgProperties": false,
                                 "x": 1330,
                                 "y": 500,
                                 "wires": [
                                     [
                                         "d6ba8355a5f61ed8"
                                     ],
                                     []
                                 ]
                             },
                             {
                                 "id": "c41c8139b9c03e79",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "WriteModbus",
                                 "func": "msg = msg;\n\nmsg.payload = {\n    value: msg.payload,\n    'fc': 6,\n    'unitid': 1,//msg.unitId,\n    'address': msg.modbusRequest.address + 1000,\n    'quantity': msg.modbusRequest.quantity\n}\nreturn msg;\n\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 1030,
                                 "y": 500,
                                 "wires": [
                                     [
                                         "99c1f11c70531f02"
                                     ]
                                 ]
                             },
                             {
                                 "id": "d6ba8355a5f61ed8",
                                 "type": "modbus-response",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "registerShowMax": 20,
                                 "x": 1550,
                                 "y": 500,
                                 "wires": []
                             },
                             {
                                 "id": "e7d9c9ab5ee6383f",
                                 "type": "function",
                                 "z": "c54bca7562265ca3",
                                 "name": "WriteModbus",
                                 "func": "msg = msg;\n\nmsg.payload = {\n    value: msg.payload,\n    'fc': 6,\n    'unitid': 1,//msg.unitId,\n    'address': msg.modbusRequest.address + 2000,\n    'quantity': msg.modbusRequest.quantity\n}\nreturn msg;\n\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 1030,
                                 "y": 700,
                                 "wires": [
                                     [
                                         "99c1f11c70531f02"
                                     ]
                                 ]
                             },
                             {
                                 "id": "31181ec89d6ec4a7",
                                 "type": "modbus-flex-server",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "logEnabled": true,
                                 "serverAddress": "192.168.60.153",
                                 "serverPort": "502",
                                 "responseDelay": 100,
                                 "unitId": "1",
                                 "delayUnit": "ms",
                                 "coilsBufferSize": 20000,
                                 "registersBufferSize": 20000,
                                 "minAddress": 0,
                                 "splitAddress": 10000,
                                 "funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
                                 "funcGetDiscreteInput": "function getFlexDiscreteInput(addr, unitID) {\n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t}  \n}",
                                 "funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
                                 "funcGetHoldingRegister": "function getFlexHoldingRegsiter(addr, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor)  \n\t} \n}",
                                 "funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\tnode.coils.writeUInt8(value, addr * node.bufferFactor)  \n\t} \n}",
                                 "funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor)  \n\t} \n}",
                                 "showErrors": true,
                                 "x": 1240,
                                 "y": 160,
                                 "wires": [
                                     [],
                                     [],
                                     [],
                                     [],
                                     []
                                 ]
                             },
                             {
                                 "id": "a035f7f84b852f5b",
                                 "type": "modbus-response",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "registerShowMax": 20,
                                 "x": 1030,
                                 "y": 340,
                                 "wires": []
                             },
                             {
                                 "id": "363902c7450bf34a",
                                 "type": "modbus-response",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "registerShowMax": 20,
                                 "x": 1030,
                                 "y": 560,
                                 "wires": []
                             },
                             {
                                 "id": "66b67a91e4198f33",
                                 "type": "modbus-response",
                                 "z": "c54bca7562265ca3",
                                 "name": "",
                                 "registerShowMax": 20,
                                 "x": 1030,
                                 "y": 760,
                                 "wires": []
                             },
                             {
                                 "id": "40f20c7f.13a934",
                                 "type": "modbus-client",
                                 "name": "Serial_10",
                                 "clienttype": "serial",
                                 "bufferCommands": true,
                                 "stateLogEnabled": false,
                                 "queueLogEnabled": true,
                                 "failureLogEnabled": true,
                                 "tcpHost": "127.0.0.1",
                                 "tcpPort": "502",
                                 "tcpType": "DEFAULT",
                                 "serialPort": "/dev/ttyUSB0",
                                 "serialType": "RTU",
                                 "serialBaudrate": "9600",
                                 "serialDatabits": "8",
                                 "serialStopbits": "2",
                                 "serialParity": "none",
                                 "serialConnectionDelay": "100",
                                 "serialAsciiResponseStartDelimiter": "",
                                 "unit_id": "10",
                                 "commandDelay": "20",
                                 "clientTimeout": "2000",
                                 "reconnectOnTimeout": false,
                                 "reconnectTimeout": "5000",
                                 "parallelUnitIdsAllowed": true
                             },
                             {
                                 "id": "17022420f90b4c00",
                                 "type": "modbus-client",
                                 "name": "neutral",
                                 "clienttype": "tcp",
                                 "bufferCommands": true,
                                 "stateLogEnabled": false,
                                 "queueLogEnabled": false,
                                 "failureLogEnabled": true,
                                 "tcpHost": "192.168.60.153",
                                 "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
                             }
                          ]
                          

                          mickym 1 Reply Last reply Reply Quote 0
                          • mickym
                            mickym Most Active @Malaus last edited by mickym

                            @malaus So ich habe ja kein Modbus - und im Prinzip sendest Du ja nicht nur ein Nachricht in dieses Flex Getter, sondern wie ich das sehe 21 * 3 - und dass da die Hardware aus dem Tritt kommt, das wundert mich ehrlich gesagt nicht.

                            Mir ist auch nicht klar, warum Dein Array oder Deine Objekte soviele Informationen haben (aber vielleicht ist das nur ein anderer Output), wenn Du dann bei Deinem ReadModbus dann die meisten Informationen wieder wegschmeisst.

                            So hier ein paar Optimierungsvorschläge: 😉

                            Nun wie bekannt, bin ich kein Freund von Codierung und function Nodes, wenn es nicht sein muss. Wenn es also um reine Änderungen der payload geht - solltest Du es in meinen Augen vermeiden - dafür gibts die Change Nodes. Wie sowas geht habe ich Dir in meinem Flow mal gezeigt.

                            Als erstes habe ich festgestellt, dass Du in Deiner split Node hier msg.parts eingetragen hast - ich weiß das Feld ist rot - aber Du kannst es ignorieren, weil Du ja kein Objekt aufsplittest, sondern ein Array. Insofern gilt das für Dich gar nicht.

                            e1363012-39aa-44ee-bfab-ed3384508346-image.png

                            So ich musst natürlich diese Modbus Flex Getter Node simulieren - deshalb hab ich nur mal in etwas das angenommen, was vielleicht aus dieser Node rauskommen könnte anhand der Screenshots die ich gesehen habe.

                            Du hast ja auch bereits schon viel richtiges gesagt und festgestellt:

                            dbcf9b03-503a-4fa3-afd0-9ecb185831f4-image.png

                            Die einfachste Variante ist wohl einfach wirklich die Nachrichtenrate mit einer delay Node zu begrenzen, um der Getter Node genügend Zeit zu geben bzw. der Hardware genügend Zeit zu geben, die Anfragen zu kompletieren. Die werden halt nicht selbst gepuffert. (dann kommt man auch ganz ohne function Nodes aus).

                            Die 2. Variante entspricht in etwa der, die Du jetzt hast, wobei - da alles gleich ist bis auf die ID - ich diese 3 Flows halt zusammengefasst habe. In dem Fall musst Du wirklich mit einer function Nodes arbeiten, da diese einen Kontext hat, der durch das Array der IDs, durch die Du iterieren willst speichern kann und einen zugrhörigen pointer. Mit jeder payload wird der pointer wieder zurückgesetzt.

                            Der Code ist nicht kompliziert - aber ist halt wirklich eine der Fälle, wo eine Function Node Sinn macht und ein paar JS Kenntnisse haben sollte. 😉

                            if (msg.payload) {
                                context.set("data",msg.payload);
                                context.set("pointer",0)
                            }
                            var array = context.get("data");
                            var pointer = context.get("pointer");
                            pointer ++;
                            
                            if ( pointer <= array.length)
                            {
                                msg.payload = array[pointer - 1];
                                context.set("pointer",pointer);
                                return msg;
                            }
                            

                            Wie gesagt woher diese Mengen Adressen etc. herkommen das weiss ich alles nicht und muss es auch nicht wissen. Ich hab nur einfach das was Du mit Deinen Function Nodes machst, mit Change Nodes vereinfacht. 😉 Was aus der Getter Node rauskommt ist natürlich reine Fantasie. 😉

                            msg.payload = {
                                    data : [0,0],
                                    buffer: Buffer.alloc(3)
                                }
                            
                            msg.modbusRequest = {
                                    address : 99,
                                    quantity : 2
                                }
                            
                            
                            if (msg.parts.index === msg.parts.count -1) return [msg,{payload:true}];
                            

                            Ich hab jetzt halt nur gewartet bist das ganze Array mit den 21 Nachrichten durchgelaufen ist. 😉

                            818cd83f-d37e-42c2-889f-113d6e46bd87-image.png

                            Viel Spass beim Nachvollziehen - wenn ich keine groben Fehler gemacht habe und ich Deinen Flow einigermassen verstanden habe, sollte dann meine Optimierung funktionieren. 😉

                            [
                               {
                                   "id": "ee9289b738d222e9",
                                   "type": "inject",
                                   "z": "7e6af0015415146d",
                                   "name": "Mehrere IDs",
                                   "props": [
                                       {
                                           "p": "payload"
                                       }
                                   ],
                                   "repeat": "",
                                   "crontab": "",
                                   "once": false,
                                   "onceDelay": 0.1,
                                   "topic": "",
                                   "payload": "[10,11,12]",
                                   "payloadType": "json",
                                   "x": 210,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "1f7b484dfe38737d"
                                       ]
                                   ]
                               },
                               {
                                   "id": "1f7b484dfe38737d",
                                   "type": "split",
                                   "z": "7e6af0015415146d",
                                   "name": "",
                                   "splt": "\\n",
                                   "spltType": "str",
                                   "arraySplt": 1,
                                   "arraySpltType": "len",
                                   "stream": false,
                                   "addname": "",
                                   "x": 370,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "78f4943b61ab8c1f"
                                       ]
                                   ]
                               },
                               {
                                   "id": "78f4943b61ab8c1f",
                                   "type": "delay",
                                   "z": "7e6af0015415146d",
                                   "name": "",
                                   "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": 560,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "db6d5fd49b87aecb"
                                       ]
                                   ]
                               },
                               {
                                   "id": "db6d5fd49b87aecb",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "create Array",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "[\t            {\t                \"unitId\": payload,\t                \"_address\": 0,\t                \"name\": \"Voltage\",\t                \"description\": \"Voltage\",\t                \"unit\": \"V\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 6,\t                \"name\": \"Current\",\t                \"description\": \"Current\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 12,\t                \"name\": \"ActivePower\",\t                \"description\": \"Active Power\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 18,\t                \"name\": \"ApparentPower\",\t                \"description\": \"ApparentPower\",\t                \"unit\": \"VA\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 24,\t                \"name\": \"ReactivePower\",\t                \"description\": \"ReactivePower\",\t                \"unit\": \"VAr\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 30,\t                \"name\": \"PowerFactor\",\t                \"description\": \"PowerFactor\",\t                \"unit\": \"\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 70,\t                \"name\": \"Frequency\",\t                \"description\": \"Frequency\",\t                \"unit\": \"Hz\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 72,\t                \"name\": \"ActiveEnergy\",\t                \"description\": \"Active Energy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 74,\t                \"name\": \"ExportActiveEnergy\",\t                \"description\": \"ExportActiveEnergy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 74,\t                \"name\": \"TotalSystemPowerDemand\",\t                \"description\": \"TotalSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 76,\t                \"name\": \"ImportReactiveEnergy\",\t                \"description\": \"ImportReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 76,\t                \"name\": \"MaxTotalSystemPowerDemand\",\t                \"description\": \"MaxTotalSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 78,\t                \"name\": \"ExportReactiveEnergy\",\t                \"description\": \"ExportReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 88,\t                \"name\": \"ImportSystemPowerDemand\",\t                \"description\": \"ImportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 90,\t                \"name\": \"MaxImportSystemPowerDemand\",\t                \"description\": \"MaxImportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 92,\t                \"name\": \"ExportSystemPowerDemand\",\t                \"description\": \"ExportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 94,\t                \"name\": \"MaxExportSystemPowerDemand\",\t                \"description\": \"MaxExportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 258,\t                \"name\": \"CurrentDemand\",\t                \"description\": \"CurrentDemand\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 264,\t                \"name\": \"MaxCurrentDemand\",\t                \"description\": \"MaxCurrentDemand\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 342,\t                \"name\": \"TotalActiveEnergy\",\t                \"description\": \"TotalActiveEnergy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 344,\t                \"name\": \"TotalReactiveEnergy\",\t                \"description\": \"TotalReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            }\t]",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 770,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "99c71b0c490445ea"
                                       ]
                                   ]
                               },
                               {
                                   "id": "d60cf4b733f4031c",
                                   "type": "debug",
                                   "z": "7e6af0015415146d",
                                   "name": "Write Modbus",
                                   "active": true,
                                   "tosidebar": true,
                                   "console": false,
                                   "tostatus": false,
                                   "complete": "payload",
                                   "targetType": "msg",
                                   "statusVal": "",
                                   "statusType": "auto",
                                   "x": 1760,
                                   "y": 680,
                                   "wires": []
                               },
                               {
                                   "id": "c5a4f19c99adb81f",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "Read Modubis",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "topic",
                                           "pt": "msg",
                                           "to": "name",
                                           "tot": "msg"
                                       },
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "{\t   \"fc\": 4,\t   \"unitid\": payload.unitId,\t   \"address\": payload._address,\t   \"quantity\": 2,\t   \"value\": 2\t}",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 1120,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "35a644d37a829731"
                                       ]
                                   ]
                               },
                               {
                                   "id": "99c71b0c490445ea",
                                   "type": "split",
                                   "z": "7e6af0015415146d",
                                   "name": "split Array",
                                   "splt": "\\n",
                                   "spltType": "str",
                                   "arraySplt": 1,
                                   "arraySpltType": "len",
                                   "stream": false,
                                   "addname": "",
                                   "x": 940,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "c5a4f19c99adb81f"
                                       ]
                                   ]
                               },
                               {
                                   "id": "35a644d37a829731",
                                   "type": "function",
                                   "z": "7e6af0015415146d",
                                   "name": "Simulate Modbus getter",
                                   "func": "msg.payload = {\n        data : [0,0],\n        buffer: Buffer.alloc(3)\n    }\n\nmsg.modbusRequest = {\n        address : 99,\n        quantity : 2\n    }\n\n\nif (msg.parts.index === msg.parts.count -1) return [msg,{payload:true}];",
                                   "outputs": 2,
                                   "noerr": 0,
                                   "initialize": "",
                                   "finalize": "",
                                   "libs": [],
                                   "x": 1350,
                                   "y": 700,
                                   "wires": [
                                       [
                                           "411349fd18118a0e"
                                       ],
                                       []
                                   ]
                               },
                               {
                                   "id": "411349fd18118a0e",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "WriteModbus",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "{\t    \"value\": payload,\t    \"fc\": 6,\t    \"unitid\" : 1, /* unitId */\t    \"address\": modbusRequest.address,\t    \"quantity\": modbusRequest.quantity\t}",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 1570,
                                   "y": 680,
                                   "wires": [
                                       [
                                           "d60cf4b733f4031c"
                                       ]
                                   ]
                               },
                               {
                                   "id": "99637116a4a92e38",
                                   "type": "comment",
                                   "z": "7e6af0015415146d",
                                   "name": "Einfache Variante fixes Delay",
                                   "info": "",
                                   "x": 240,
                                   "y": 640,
                                   "wires": []
                               },
                               {
                                   "id": "36239d1d9d361a2e",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "create Array",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "[\t            {\t                \"unitId\": payload,\t                \"_address\": 0,\t                \"name\": \"Voltage\",\t                \"description\": \"Voltage\",\t                \"unit\": \"V\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 6,\t                \"name\": \"Current\",\t                \"description\": \"Current\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 12,\t                \"name\": \"ActivePower\",\t                \"description\": \"Active Power\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 18,\t                \"name\": \"ApparentPower\",\t                \"description\": \"ApparentPower\",\t                \"unit\": \"VA\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 24,\t                \"name\": \"ReactivePower\",\t                \"description\": \"ReactivePower\",\t                \"unit\": \"VAr\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 30,\t                \"name\": \"PowerFactor\",\t                \"description\": \"PowerFactor\",\t                \"unit\": \"\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 70,\t                \"name\": \"Frequency\",\t                \"description\": \"Frequency\",\t                \"unit\": \"Hz\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 72,\t                \"name\": \"ActiveEnergy\",\t                \"description\": \"Active Energy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 74,\t                \"name\": \"ExportActiveEnergy\",\t                \"description\": \"ExportActiveEnergy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 74,\t                \"name\": \"TotalSystemPowerDemand\",\t                \"description\": \"TotalSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 76,\t                \"name\": \"ImportReactiveEnergy\",\t                \"description\": \"ImportReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 76,\t                \"name\": \"MaxTotalSystemPowerDemand\",\t                \"description\": \"MaxTotalSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 78,\t                \"name\": \"ExportReactiveEnergy\",\t                \"description\": \"ExportReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 88,\t                \"name\": \"ImportSystemPowerDemand\",\t                \"description\": \"ImportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 90,\t                \"name\": \"MaxImportSystemPowerDemand\",\t                \"description\": \"MaxImportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 92,\t                \"name\": \"ExportSystemPowerDemand\",\t                \"description\": \"ExportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 94,\t                \"name\": \"MaxExportSystemPowerDemand\",\t                \"description\": \"MaxExportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 258,\t                \"name\": \"CurrentDemand\",\t                \"description\": \"CurrentDemand\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 264,\t                \"name\": \"MaxCurrentDemand\",\t                \"description\": \"MaxCurrentDemand\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 342,\t                \"name\": \"TotalActiveEnergy\",\t                \"description\": \"TotalActiveEnergy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 344,\t                \"name\": \"TotalReactiveEnergy\",\t                \"description\": \"TotalReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            }\t]",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 610,
                                   "y": 860,
                                   "wires": [
                                       [
                                           "833e22472f593063"
                                       ]
                                   ]
                               },
                               {
                                   "id": "8b8fb28987277d75",
                                   "type": "function",
                                   "z": "7e6af0015415146d",
                                   "name": "Trigger IDs",
                                   "func": "if (msg.payload) {\n    context.set(\"data\",msg.payload);\n    context.set(\"pointer\",0)\n}\nvar array = context.get(\"data\");\nvar pointer = context.get(\"pointer\");\npointer ++;\n\nif ( pointer <= array.length)\n{\n    msg.payload = array[pointer - 1];\n    context.set(\"pointer\",pointer);\n    return msg;\n}\n\n",
                                   "outputs": 1,
                                   "noerr": 0,
                                   "initialize": "",
                                   "finalize": "",
                                   "libs": [],
                                   "x": 430,
                                   "y": 860,
                                   "wires": [
                                       [
                                           "36239d1d9d361a2e"
                                       ]
                                   ]
                               },
                               {
                                   "id": "6521f44463e25c3c",
                                   "type": "inject",
                                   "z": "7e6af0015415146d",
                                   "name": "Mehrere IDs",
                                   "props": [
                                       {
                                           "p": "payload"
                                       }
                                   ],
                                   "repeat": "",
                                   "crontab": "",
                                   "once": false,
                                   "onceDelay": 0.1,
                                   "topic": "",
                                   "payload": "[10,11,12]",
                                   "payloadType": "json",
                                   "x": 230,
                                   "y": 860,
                                   "wires": [
                                       [
                                           "8b8fb28987277d75"
                                       ]
                                   ]
                               },
                               {
                                   "id": "4661666a374e732c",
                                   "type": "debug",
                                   "z": "7e6af0015415146d",
                                   "name": "Write Modbus",
                                   "active": true,
                                   "tosidebar": true,
                                   "console": false,
                                   "tostatus": false,
                                   "complete": "payload",
                                   "targetType": "msg",
                                   "statusVal": "",
                                   "statusType": "auto",
                                   "x": 1600,
                                   "y": 840,
                                   "wires": []
                               },
                               {
                                   "id": "557989f42ddad473",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "Read Modubis",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "topic",
                                           "pt": "msg",
                                           "to": "name",
                                           "tot": "msg"
                                       },
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "{\t   \"fc\": 4,\t   \"unitid\": payload.unitId,\t   \"address\": payload._address,\t   \"quantity\": 2,\t   \"value\": 2\t}",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 960,
                                   "y": 860,
                                   "wires": [
                                       [
                                           "0f4f661c760aa72b"
                                       ]
                                   ]
                               },
                               {
                                   "id": "833e22472f593063",
                                   "type": "split",
                                   "z": "7e6af0015415146d",
                                   "name": "split Array",
                                   "splt": "\\n",
                                   "spltType": "str",
                                   "arraySplt": 1,
                                   "arraySpltType": "len",
                                   "stream": false,
                                   "addname": "",
                                   "x": 780,
                                   "y": 860,
                                   "wires": [
                                       [
                                           "557989f42ddad473"
                                       ]
                                   ]
                               },
                               {
                                   "id": "0f4f661c760aa72b",
                                   "type": "function",
                                   "z": "7e6af0015415146d",
                                   "name": "Simulate Modbus getter",
                                   "func": "msg.payload = {\n        data : [0,0],\n        buffer: Buffer.alloc(3)\n    }\n\nmsg.modbusRequest = {\n        address : 99,\n        quantity : 2\n    }\n\n\nif (msg.parts.index === msg.parts.count -1) return [msg,{payload:true}];",
                                   "outputs": 2,
                                   "noerr": 0,
                                   "initialize": "",
                                   "finalize": "",
                                   "libs": [],
                                   "x": 1190,
                                   "y": 860,
                                   "wires": [
                                       [
                                           "5e5a202488c31ae0"
                                       ],
                                       [
                                           "4a433464d06dc6d8"
                                       ]
                                   ]
                               },
                               {
                                   "id": "5e5a202488c31ae0",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "WriteModbus",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "{\t    \"value\": payload,\t    \"fc\": 6,\t    \"unitid\" : 1, /* unitId */\t    \"address\": modbusRequest.address,\t    \"quantity\": modbusRequest.quantity\t}",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 1410,
                                   "y": 840,
                                   "wires": [
                                       [
                                           "4661666a374e732c"
                                       ]
                                   ]
                               },
                               {
                                   "id": "4a433464d06dc6d8",
                                   "type": "change",
                                   "z": "7e6af0015415146d",
                                   "name": "Trigger next ID",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "trigger",
                                           "pt": "msg",
                                           "to": "true",
                                           "tot": "bool"
                                       },
                                       {
                                           "t": "delete",
                                           "p": "payload",
                                           "pt": "msg"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 740,
                                   "y": 940,
                                   "wires": [
                                       [
                                           "8b8fb28987277d75"
                                       ]
                                   ]
                               },
                               {
                                   "id": "112befc65439e8b7",
                                   "type": "comment",
                                   "z": "7e6af0015415146d",
                                   "name": "Getriggert by Getter Node",
                                   "info": "",
                                   "x": 230,
                                   "y": 800,
                                   "wires": []
                               }
                            ]
                            

                            Auch und noch eine kleine Bemerkung:

                            c3e4b821-da63-49a0-a9c7-ebae597e3fbc-image.png

                            node.send zu nutzen, sollte man vermeiden und lieber return msg verwenden. Warum manche meinen sie wollen jetzt node.send verwenden, weiß ich nicht. node.send sollte man nur bei asynchroner Verarbeitung nutzen und dann auch mit node.done abschließen. Also sollte das immer der Sonderfall sein.

                            Hier ein Auszug aus der Online Doku. Was sonst nämlich passieren kann ist, dass die function Node noch weiter wurschtelt und der Flow hinten dran schon munter weiter läuft.

                            6aa17dae-45e9-4819-a008-6d766e750364-image.png

                            Bei Dir machte das zwar nichts aus, da es der letzte Befehl ist, aber muss ja nicht sein, wenn man mit return msg die function Node korrekt beenden kann.

                            Fazit aus dem Ganzen: Funktioniert eigentlich wie es soll - nur sollte man warten, bis ein Gerät auch alle Anfragen bearbeiten konnte und deshalb wartet bis die Getter Node wieder aufnahmefähig sind. 😉

                            Den Rechtschreibfehler in der ChangeNode mit Read Modubis statt Read Modbus im Namen der Change NOde möge man mir verzeihen, deswegen exportiere ich nicht wieder alles neu. 😉

                            EDIT:
                            Falls das aber mit der einen GETTER Node nicht funktioniert mit dem Trigger und Dein Flow nur funktioniert, weil Du 3 Getter-Nodes hast, dann muss Dein Flow so bleiben, da nur dann die GETTER Nodes parallel arbeiten können. Oder Du setzt wirklich die Delay Node ein. Die Frage ist halt ob der 2. Ausgang der Getter Node wirklich signalisiert, dass sie fertig ist oder nicht. Wie gesagt, ich tu mir bei dem Ganzen halt schwer, weil ich diese Hardware nicht kenne und deshalb auch die Nodes nicht. Aber in jedem Fall denke ich, hab ich ein paar Alternativen aufgezeigt-

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              Malaus @mickym last edited by Malaus

                              @mickym sagte in Node-Red Modbus mehrere Slave ID´s abfragen:

                              Mir ist auch nicht klar, warum Dein Array oder Deine Objekte soviele Informationen haben (aber vielleicht ist das nur ein anderer Output), wenn Du dann bei Deinem ReadModbus dann die meisten Informationen wieder wegschmeisst.

                              Das liegt daran, dass ich diese Daten direkt aus dem Modbus Adapter genommen habe. Aber wie du schon bemerkt hast, sind die meisten Daten irrelevant.

                              So hier ein paar Optimierungsvorschläge: 😉

                              Nun wie bekannt, bin ich kein Freund von Codierung und function Nodes, wenn es nicht sein muss. Wenn es also um reine Änderungen der payload geht - solltest Du es in meinen Augen vermeiden - dafür gibts die Change Nodes. Wie sowas geht habe ich Dir in meinem Flow mal gezeigt.

                              Sehr schöne Idee, diese Change Nodes für sowas zu nutzen!

                              Als erstes habe ich festgestellt, dass Du in Deiner split Node hier msg.parts eingetragen hast - ich weiß das Feld ist rot - aber Du kannst es ignorieren, weil Du ja kein Objekt aufsplittest, sondern ein Array. Insofern gilt das für Dich gar nicht.

                              Das kam von ein paar vorherigen Versuchen, das ganze zu splitten, Modbus Abfrage und mit dessen Wert, das ganze wieder zusammenzufügen.

                              Die 2. Variante entspricht in etwa der, die Du jetzt hast, wobei - da alles gleich ist bis auf die ID - ich diese 3 Flows halt zusammengefasst habe. In dem Fall musst Du wirklich mit einer function Nodes arbeiten, da diese einen Kontext hat, der durch das Array der IDs, durch die Du iterieren willst speichern kann und einen zugrhörigen pointer. Mit jeder payload wird der pointer wieder zurückgesetzt.

                              Die 2. Variante funktioniert nicht. Ich vermute, dass es daran liegt, dass nun jeder Wert einzeln abgefragt wird und dadurch der Trigger next ID aktiviert wird. Durch mein Abfragen der Namen habe ich das verhindert.
                              2441dc0a-20d4-4812-9813-ed2c9cacc875-image.png

                              Auch und noch eine kleine Bemerkung:
                              node.send zu nutzen, sollte man vermeiden und lieber return msg verwenden. Warum manche meinen sie wollen jetzt node.send verwenden, weiß ich nicht. node.send sollte man nur bei asynchroner Verarbeitung nutzen und dann auch mit node.done abschließen. Also sollte das immer der Sonderfall sein.

                              Hier ein Auszug aus der Online Doku. Was sonst nämlich passieren kann ist, dass die function Node noch weiter wurschtelt und der Flow hinten dran schon munter weiter läuft.
                              Bei Dir machte das zwar nichts aus, da es der letzte Befehl ist, aber muss ja nicht sein, wenn man mit return msg die function Node korrekt beenden kann.

                              Danke für diesen Hinweis! Werde ich mir merken.

                              EDIT:
                              Es wird mir das topic nicht mitgenommen.
                              vor dem Read Modbus
                              f34fe674-440e-4db8-9b71-97190f3d102a-image.png

                              Nach dem Read Modbus
                              a86ac1e3-b268-472a-80c9-e8abc66edcc6-image.png

                              mickym 1 Reply Last reply Reply Quote 0
                              • mickym
                                mickym Most Active @Malaus last edited by mickym

                                @malaus Ok das war mein Fehler. Wenn das alles war - ansonsten schau ich gerade - dass man erst wenn sich die id wechselt triggert.

                                Du musst die Change node im Read Modbus entsprechend ändern, um das topic zu setzen:

                                17710ebd-33d0-463f-945d-4e7ead36a36d-image.png

                                Bei Dir war aber der Name auch nicht Bestandteil der payload, sondern im topic:

                                msg = {
                                    topic : msg.name,
                                    payload : {
                                            'fc': fc,
                                            'unitid': msg.unitId,//JSON.parse(unitid),
                                            'address': msg._address,//JSON.parse(y.number),
                                            'quantity': 2,
                                            'value': 2
                                        }
                                    }
                                
                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  Malaus @mickym last edited by Malaus

                                  @mickym ich hätte bei bei dem trigger ein switch benutzt, der Ausschau nach dem letzten Wert hält.
                                  5bbcd714-4c14-4d47-9f9b-27878ec09ffe-image.png

                                  Muss das nicht anders herum sein?
                                  Ich hab ja vor dem Read Modbus ein payload.name
                                  f749bcd1-2e52-4dfe-91e2-1f948c20d4e0-image.png
                                  und möchte diese nun als topic

                                  Dann sollte das doch so aussehen:
                                  9ef19dfb-a3cf-49b8-8a14-d864121b2dca-image.png

                                  Das kommt nach der Änderung zurück:
                                  71d7e840-127f-446a-b407-f2779c67a5dc-image.png

                                  mickym 1 Reply Last reply Reply Quote 0
                                  • mickym
                                    mickym Most Active @Malaus last edited by

                                    @malaus Nein das sieht nicht andersrum aus. Du musst das Lesen wie es geschrieben ist.

                                    Setze msg.topic auf msg.payload.name. Du willst das topic doch setzen - das vorher gar nicht da war. 😉

                                    Bei mir kommt wenn du die Change Node entsprechend änderst, der Name aus dem ursprünglichen Objekt als payload an:

                                    61da66e0-e2f2-45a3-b2af-ac335ef4e06e-image.png

                                    M mickym 2 Replies Last reply Reply Quote 0
                                    • M
                                      Malaus @mickym last edited by

                                      @mickym achso habe das anders herum verstanden.
                                      Aber jetzt geht es! und mit dem Switch funktioniert auch.

                                      9c1fbaf8-4c52-4a9e-8280-363e59b5aed1-image.png

                                      Danke!

                                      1 Reply Last reply Reply Quote 0
                                      • mickym
                                        mickym Most Active @mickym last edited by mickym

                                        Wie sieht der switch aus? ggf. kannst dann auch eine filter Node nehmen. 😉

                                        M 1 Reply Last reply Reply Quote 0
                                        • M
                                          Malaus @mickym last edited by

                                          @mickym

                                          059dc944-14b4-4285-acd3-433616d618c2-image.png

                                          mickym 1 Reply Last reply Reply Quote 0
                                          • mickym
                                            mickym Most Active @Malaus last edited by mickym

                                            @malaus Na ja - ich verstehe, weil Du sagst das ist das letzte Element in Deinem array. Dann finde ich es intuitiver und besser - wirklich die id als topic zu nehmen und hab mal eine filter Node verwendet. Ich weiss nicht, ob aus dem unteren Teil einfach die Eingangsobjekte durchgereicht werden. Aber dann spart man sich das topic einfach.

                                            Falls also am unteren Ausgang der GETTER Node einfach das Eingangsobjekt durchkommt:
                                            Für mich wäre dann das am saubersten:

                                            8db35761-97e7-40f7-930b-891dc36509f7-image.png

                                            [
                                               {
                                                   "id": "36239d1d9d361a2e",
                                                   "type": "change",
                                                   "z": "7e6af0015415146d",
                                                   "name": "create Array",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "[\t            {\t                \"unitId\": payload,\t                \"_address\": 0,\t                \"name\": \"Voltage\",\t                \"description\": \"Voltage\",\t                \"unit\": \"V\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 6,\t                \"name\": \"Current\",\t                \"description\": \"Current\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 12,\t                \"name\": \"ActivePower\",\t                \"description\": \"Active Power\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 18,\t                \"name\": \"ApparentPower\",\t                \"description\": \"ApparentPower\",\t                \"unit\": \"VA\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 24,\t                \"name\": \"ReactivePower\",\t                \"description\": \"ReactivePower\",\t                \"unit\": \"VAr\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 30,\t                \"name\": \"PowerFactor\",\t                \"description\": \"PowerFactor\",\t                \"unit\": \"\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 70,\t                \"name\": \"Frequency\",\t                \"description\": \"Frequency\",\t                \"unit\": \"Hz\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 72,\t                \"name\": \"ActiveEnergy\",\t                \"description\": \"Active Energy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 74,\t                \"name\": \"ExportActiveEnergy\",\t                \"description\": \"ExportActiveEnergy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 74,\t                \"name\": \"TotalSystemPowerDemand\",\t                \"description\": \"TotalSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 76,\t                \"name\": \"ImportReactiveEnergy\",\t                \"description\": \"ImportReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 76,\t                \"name\": \"MaxTotalSystemPowerDemand\",\t                \"description\": \"MaxTotalSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 78,\t                \"name\": \"ExportReactiveEnergy\",\t                \"description\": \"ExportReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 88,\t                \"name\": \"ImportSystemPowerDemand\",\t                \"description\": \"ImportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 90,\t                \"name\": \"MaxImportSystemPowerDemand\",\t                \"description\": \"MaxImportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 92,\t                \"name\": \"ExportSystemPowerDemand\",\t                \"description\": \"ExportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 94,\t                \"name\": \"MaxExportSystemPowerDemand\",\t                \"description\": \"MaxExportSystemPowerDemand\",\t                \"unit\": \"W\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 258,\t                \"name\": \"CurrentDemand\",\t                \"description\": \"CurrentDemand\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 264,\t                \"name\": \"MaxCurrentDemand\",\t                \"description\": \"MaxCurrentDemand\",\t                \"unit\": \"A\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 342,\t                \"name\": \"TotalActiveEnergy\",\t                \"description\": \"TotalActiveEnergy\",\t                \"unit\": \"kWh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            },\t            {\t                \"unitId\": payload,\t                \"_address\": 344,\t                \"name\": \"TotalReactiveEnergy\",\t                \"description\": \"TotalReactiveEnergy\",\t                \"unit\": \"kvarh\",\t                \"type\": \"floatbe\",\t                \"len\": 2,\t                \"factor\": 1,\t                \"offset\": 0,\t                \"formula\": \"\",\t                \"role\": \"level\",\t                \"room\": \"\",\t                \"cw\": false,\t                \"isScale\": false\t            }\t]",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 730,
                                                   "y": 860,
                                                   "wires": [
                                                       [
                                                           "833e22472f593063"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "8b8fb28987277d75",
                                                   "type": "function",
                                                   "z": "7e6af0015415146d",
                                                   "name": "Trigger IDs",
                                                   "func": "if (msg.payload) {\n    context.set(\"data\",msg.payload);\n    context.set(\"pointer\",0)\n}\nvar array = context.get(\"data\");\nvar pointer = context.get(\"pointer\");\npointer ++;\n\nif ( pointer <= array.length)\n{\n    msg.payload = array[pointer - 1];\n    context.set(\"pointer\",pointer);\n    return msg;\n}\n\n",
                                                   "outputs": 1,
                                                   "noerr": 0,
                                                   "initialize": "",
                                                   "finalize": "",
                                                   "libs": [],
                                                   "x": 550,
                                                   "y": 860,
                                                   "wires": [
                                                       [
                                                           "36239d1d9d361a2e"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "6521f44463e25c3c",
                                                   "type": "inject",
                                                   "z": "7e6af0015415146d",
                                                   "name": "Mehrere IDs",
                                                   "props": [
                                                       {
                                                           "p": "payload"
                                                       }
                                                   ],
                                                   "repeat": "",
                                                   "crontab": "",
                                                   "once": false,
                                                   "onceDelay": 0.1,
                                                   "topic": "",
                                                   "payload": "[10,11,12]",
                                                   "payloadType": "json",
                                                   "x": 230,
                                                   "y": 860,
                                                   "wires": [
                                                       [
                                                           "8b8fb28987277d75",
                                                           "1332eadf8470bb16"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "557989f42ddad473",
                                                   "type": "change",
                                                   "z": "7e6af0015415146d",
                                                   "name": "Read Modbus",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "{\t   \"fc\": 4,\t   \"unitid\": payload.unitId,\t   \"address\": payload._address,\t   \"quantity\": 2,\t   \"value\": 2\t}",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1080,
                                                   "y": 860,
                                                   "wires": [
                                                       [
                                                           "0f4f661c760aa72b"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "833e22472f593063",
                                                   "type": "split",
                                                   "z": "7e6af0015415146d",
                                                   "name": "split Array",
                                                   "splt": "\\n",
                                                   "spltType": "str",
                                                   "arraySplt": 1,
                                                   "arraySpltType": "len",
                                                   "stream": false,
                                                   "addname": "",
                                                   "x": 900,
                                                   "y": 860,
                                                   "wires": [
                                                       [
                                                           "557989f42ddad473"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "0f4f661c760aa72b",
                                                   "type": "function",
                                                   "z": "7e6af0015415146d",
                                                   "name": "Simulate Modbus getter",
                                                   "func": "var newmsg= {\n    payload : {\n        data : [0,0],\n        buffer: Buffer.alloc(3)\n    },\n    modbusRequest : {\n        address : 99,\n        quantity : 2\n    }\n}\n\n\nreturn [newmsg,msg];",
                                                   "outputs": 2,
                                                   "noerr": 0,
                                                   "initialize": "",
                                                   "finalize": "",
                                                   "libs": [],
                                                   "x": 1310,
                                                   "y": 860,
                                                   "wires": [
                                                       [
                                                           "5e5a202488c31ae0"
                                                       ],
                                                       [
                                                           "7b697360af0a0b1f"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "5e5a202488c31ae0",
                                                   "type": "change",
                                                   "z": "7e6af0015415146d",
                                                   "name": "WriteModbus",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "{\t    \"value\": payload,\t    \"fc\": 6,\t    \"unitid\" : 1, /* unitId */\t    \"address\": modbusRequest.address,\t    \"quantity\": modbusRequest.quantity\t}",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1530,
                                                   "y": 840,
                                                   "wires": [
                                                       []
                                                   ]
                                               },
                                               {
                                                   "id": "112befc65439e8b7",
                                                   "type": "comment",
                                                   "z": "7e6af0015415146d",
                                                   "name": "Getriggert by Getter Node",
                                                   "info": "",
                                                   "x": 230,
                                                   "y": 800,
                                                   "wires": []
                                               },
                                               {
                                                   "id": "4a433464d06dc6d8",
                                                   "type": "change",
                                                   "z": "7e6af0015415146d",
                                                   "name": "Trigger next ID",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "trigger",
                                                           "pt": "msg",
                                                           "to": "true",
                                                           "tot": "bool"
                                                       },
                                                       {
                                                           "t": "delete",
                                                           "p": "payload",
                                                           "pt": "msg"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 880,
                                                   "y": 920,
                                                   "wires": [
                                                       [
                                                           "8b8fb28987277d75"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "7b697360af0a0b1f",
                                                   "type": "rbe",
                                                   "z": "7e6af0015415146d",
                                                   "name": "",
                                                   "func": "rbe",
                                                   "gap": "",
                                                   "start": "",
                                                   "inout": "out",
                                                   "septopics": false,
                                                   "property": "payload.unitid",
                                                   "topi": "topic",
                                                   "x": 1310,
                                                   "y": 980,
                                                   "wires": [
                                                       [
                                                           "4a433464d06dc6d8",
                                                           "d3be5bf799cfff52"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "1332eadf8470bb16",
                                                   "type": "change",
                                                   "z": "7e6af0015415146d",
                                                   "name": "",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "reset",
                                                           "pt": "msg",
                                                           "to": "true",
                                                           "tot": "bool"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 460,
                                                   "y": 980,
                                                   "wires": [
                                                       [
                                                           "7b697360af0a0b1f"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "d3be5bf799cfff52",
                                                   "type": "debug",
                                                   "z": "7e6af0015415146d",
                                                   "name": "new ID",
                                                   "active": true,
                                                   "tosidebar": true,
                                                   "console": false,
                                                   "tostatus": false,
                                                   "complete": "payload",
                                                   "targetType": "msg",
                                                   "statusVal": "",
                                                   "statusType": "auto",
                                                   "x": 1500,
                                                   "y": 980,
                                                   "wires": []
                                               }
                                            ]
                                            

                                            Dann kann man nämlich auch mal eine andere Reihenfolge beim createArray erstellen verwenden ohne das es Folgen haben würde. 😉

                                            M 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.1k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript node-red
                                            4
                                            36
                                            2841
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo