Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Node-Red
  5. Node-Red Modbus mehrere Slave ID´s abfragen

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    13
    1
    112

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    11
    1
    558

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    24
    1
    1.7k

Node-Red Modbus mehrere Slave ID´s abfragen

Geplant Angeheftet Gesperrt Verschoben Node-Red
javascriptnode-red
36 Beiträge 4 Kommentatoren 5.0k Aufrufe 4 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • G Garf

    @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 Offline
    M Offline
    Malaus
    schrieb am zuletzt editiert von Malaus
    #9

    @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?

    mickymM G 2 Antworten Letzte Antwort
    0
    • M 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?

      mickymM Offline
      mickymM Offline
      mickym
      Most Active
      schrieb am zuletzt editiert von
      #10

      @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.

      Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

      M 1 Antwort Letzte Antwort
      0
      • mickymM mickym

        @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 Offline
        M Offline
        Malaus
        schrieb am zuletzt editiert von
        #11

        @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
           }
        ]
        

        mickymM 1 Antwort Letzte Antwort
        0
        • M Malaus

          @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
             }
          ]
          

          mickymM Offline
          mickymM Offline
          mickym
          Most Active
          schrieb am zuletzt editiert von mickym
          #12

          @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-

          Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

          M 1 Antwort Letzte Antwort
          0
          • mickymM 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 Offline
            M Offline
            Malaus
            schrieb am zuletzt editiert von Malaus
            #13

            @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

            mickymM 1 Antwort Letzte Antwort
            0
            • M 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

              mickymM Offline
              mickymM Offline
              mickym
              Most Active
              schrieb am zuletzt editiert von mickym
              #14

              @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
                      }
                  }
              

              Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

              M 1 Antwort Letzte Antwort
              0
              • mickymM 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 Offline
                M Offline
                Malaus
                schrieb am zuletzt editiert von Malaus
                #15

                @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

                mickymM 1 Antwort Letzte Antwort
                0
                • M 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

                  mickymM Offline
                  mickymM Offline
                  mickym
                  Most Active
                  schrieb am zuletzt editiert von
                  #16

                  @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

                  Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                  M mickymM 2 Antworten Letzte Antwort
                  0
                  • mickymM mickym

                    @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 Offline
                    M Offline
                    Malaus
                    schrieb am zuletzt editiert von
                    #17

                    @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 Antwort Letzte Antwort
                    0
                    • mickymM mickym

                      @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

                      mickymM Offline
                      mickymM Offline
                      mickym
                      Most Active
                      schrieb am zuletzt editiert von mickym
                      #18

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

                      Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                      M 1 Antwort Letzte Antwort
                      0
                      • mickymM mickym

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

                        M Offline
                        M Offline
                        Malaus
                        schrieb am zuletzt editiert von
                        #19

                        @mickym

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

                        mickymM 1 Antwort Letzte Antwort
                        0
                        • M Malaus

                          @mickym

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

                          mickymM Offline
                          mickymM Offline
                          mickym
                          Most Active
                          schrieb am zuletzt editiert von mickym
                          #20

                          @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. ;)

                          Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                          M 1 Antwort Letzte Antwort
                          0
                          • mickymM 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 Offline
                            M Offline
                            Malaus
                            schrieb am zuletzt editiert von
                            #21

                            @mickym
                            b7e59bee-f32b-4e6c-abb3-c75e9ccf6d14-image.png

                            Bei debug 19 erhalte ich keine Werte. Der Durchlauf wird nur mit einer ID gemacht.
                            Den Filter verstehe ich nicht so ganz:
                            a5443fb9-a5cf-4bfe-8617-41e7e02753eb-image.png

                            Bei Read Modbus hast du das Topic rausgenommen, ist das so gewollt? Ändert aber auch nichts, wenn ich es wieder einsetze.

                            mickymM 1 Antwort Letzte Antwort
                            0
                            • M Malaus

                              @mickym
                              b7e59bee-f32b-4e6c-abb3-c75e9ccf6d14-image.png

                              Bei debug 19 erhalte ich keine Werte. Der Durchlauf wird nur mit einer ID gemacht.
                              Den Filter verstehe ich nicht so ganz:
                              a5443fb9-a5cf-4bfe-8617-41e7e02753eb-image.png

                              Bei Read Modbus hast du das Topic rausgenommen, ist das so gewollt? Ändert aber auch nichts, wenn ich es wieder einsetze.

                              mickymM Offline
                              mickymM Offline
                              mickym
                              Most Active
                              schrieb am zuletzt editiert von mickym
                              #22

                              @malaus Ja ich weiss - ich war der Meinung . dass unten einfach die Eingangsobjekte rauskommen - deswegen habe ich das topic auch wieder raus genommen. Kannst Du mal die Nachrichten, die aus debug 18 rauskommen posten und ist da die ID drin? Ich kann halt immer nur Vermutungen anstellen, was die GETTER Node ausspukt. ;) Am Besten das ganze Nachrichtenobjekt in debug 18 ausgeben lassen und hier in CodeTags einbetten.

                              Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                              M 1 Antwort Letzte Antwort
                              0
                              • mickymM mickym

                                @malaus Ja ich weiss - ich war der Meinung . dass unten einfach die Eingangsobjekte rauskommen - deswegen habe ich das topic auch wieder raus genommen. Kannst Du mal die Nachrichten, die aus debug 18 rauskommen posten und ist da die ID drin? Ich kann halt immer nur Vermutungen anstellen, was die GETTER Node ausspukt. ;) Am Besten das ganze Nachrichtenobjekt in debug 18 ausgeben lassen und hier in CodeTags einbetten.

                                M Offline
                                M Offline
                                Malaus
                                schrieb am zuletzt editiert von
                                #23

                                @mickym
                                26511c59-dced-4006-904f-9c10dbf5c554-image.png

                                Die Getter Node spuckt mir jeden Wert einzeln aus.

                                mickymM 1 Antwort Letzte Antwort
                                0
                                • M Malaus

                                  @mickym
                                  26511c59-dced-4006-904f-9c10dbf5c554-image.png

                                  Die Getter Node spuckt mir jeden Wert einzeln aus.

                                  mickymM Offline
                                  mickymM Offline
                                  mickym
                                  Most Active
                                  schrieb am zuletzt editiert von mickym
                                  #24

                                  Nein ok - ich habe gerade einen Denkfehler gemacht - es wird ja nun bei jedem 1. Element geändert - sorry mein Fehler. Ich werde was einbauen, dass man das letzte Element automatisch erkennt. Sorry - einen Augenblick!!!
                                  Noch eine Frage ich sehe gerade die GETTER node - und deshalb auch der Fehler die queued je ID. ;)

                                  Kannst Du mal schauen, ob das letzte Element aus debug 18 queuelength 0 hat?

                                  f7541025-64f1-4641-9da7-ee7f625253e7-image.png

                                  Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                                  M 1 Antwort Letzte Antwort
                                  0
                                  • mickymM mickym

                                    Nein ok - ich habe gerade einen Denkfehler gemacht - es wird ja nun bei jedem 1. Element geändert - sorry mein Fehler. Ich werde was einbauen, dass man das letzte Element automatisch erkennt. Sorry - einen Augenblick!!!
                                    Noch eine Frage ich sehe gerade die GETTER node - und deshalb auch der Fehler die queued je ID. ;)

                                    Kannst Du mal schauen, ob das letzte Element aus debug 18 queuelength 0 hat?

                                    f7541025-64f1-4641-9da7-ee7f625253e7-image.png

                                    M Offline
                                    M Offline
                                    Malaus
                                    schrieb am zuletzt editiert von
                                    #25

                                    @mickym das letzte hat die 20

                                    3fc02eb3-82ef-4a6b-afc3-feeab3a439a4-image.png

                                    mickymM 1 Antwort Letzte Antwort
                                    0
                                    • M Malaus

                                      @mickym das letzte hat die 20

                                      3fc02eb3-82ef-4a6b-afc3-feeab3a439a4-image.png

                                      mickymM Offline
                                      mickymM Offline
                                      mickym
                                      Most Active
                                      schrieb am zuletzt editiert von mickym
                                      #26

                                      Ok danke. ;) - Das heißt die queuelänge baut sich auf und wird nur intern abgearbeitet ;)

                                      Die msg.parts Eigenschaft scheint nicht durch zu kommen, sondern nur das topic - dann müssen wir ggf. doch das topic nutzen aber nicht anhand des Namens sondern dann würde ich wirklich nach der msg.parts Eigenschaft das topic setzen.

                                      das heißt wir wissen ja wieviele Elemente kommen und setzten da topic entsprechend.

                                      Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                                      M 1 Antwort Letzte Antwort
                                      0
                                      • mickymM mickym

                                        Ok danke. ;) - Das heißt die queuelänge baut sich auf und wird nur intern abgearbeitet ;)

                                        Die msg.parts Eigenschaft scheint nicht durch zu kommen, sondern nur das topic - dann müssen wir ggf. doch das topic nutzen aber nicht anhand des Namens sondern dann würde ich wirklich nach der msg.parts Eigenschaft das topic setzen.

                                        das heißt wir wissen ja wieviele Elemente kommen und setzten da topic entsprechend.

                                        M Offline
                                        M Offline
                                        Malaus
                                        schrieb am zuletzt editiert von
                                        #27

                                        @mickym
                                        das erste:
                                        e8014b45-e262-4662-8f09-74729f4fbee8-image.png

                                        das letzte:
                                        cda61a06-3590-465e-bcb6-6ed44750a75d-image.png

                                        mickymM 1 Antwort Letzte Antwort
                                        0
                                        • M Malaus

                                          @mickym
                                          das erste:
                                          e8014b45-e262-4662-8f09-74729f4fbee8-image.png

                                          das letzte:
                                          cda61a06-3590-465e-bcb6-6ed44750a75d-image.png

                                          mickymM Offline
                                          mickymM Offline
                                          mickym
                                          Most Active
                                          schrieb am zuletzt editiert von mickym
                                          #28

                                          @malaus Ok wenn das topic das Einzige war was durchkommt (das msg.parts Objekt wird leider durch die GETTER Node nicht durchgereicht oder ist das enthalten?) , dann nehmen wir im Prinzip deine Lösung, setzen das topic aber nicht einen bestimmten Namen in dem array, sondern lassen einfach runterzählen. ;)

                                          a933b1df-2e2c-4eac-98f6-3838033521a4-image.png

                                          Das sollte dann aber auch tun. ;)

                                          Ist also im Prinzip dein Flow mit dem switch als trigger nur das ich im topic nun die Anzahl der noch zu erwartenden Elemente durchreiche:

                                          [
                                             {
                                                 "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"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "557989f42ddad473",
                                                 "type": "change",
                                                 "z": "7e6af0015415146d",
                                                 "name": "Read Modbus",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "topic",
                                                         "pt": "msg",
                                                         "to": "parts.count - parts.index - 1",
                                                         "tot": "jsonata"
                                                     },
                                                     {
                                                         "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 msg2 = {\n    topic : msg.topic,\n    queueLengthByUnitId : {\n        unitID: msg.payload.unitid,\n        queueLength: msg.parts.index\n    }\n}\n\n\nvar msg1 = {\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 [msg1,msg2];",
                                                 "outputs": 2,
                                                 "noerr": 0,
                                                 "initialize": "",
                                                 "finalize": "",
                                                 "libs": [],
                                                 "x": 1310,
                                                 "y": 860,
                                                 "wires": [
                                                     [
                                                         "5e5a202488c31ae0"
                                                     ],
                                                     [
                                                         "3a68bda0a135f481"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "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": 780,
                                                 "y": 920,
                                                 "wires": [
                                                     [
                                                         "8b8fb28987277d75"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "315c37ef4aceb5d4",
                                                 "type": "debug",
                                                 "z": "7e6af0015415146d",
                                                 "name": "next ID wenn topic 0 (array zu ende)",
                                                 "active": true,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "true",
                                                 "targetType": "full",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1330,
                                                 "y": 980,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "3a68bda0a135f481",
                                                 "type": "switch",
                                                 "z": "7e6af0015415146d",
                                                 "name": "",
                                                 "property": "topic",
                                                 "propertyType": "msg",
                                                 "rules": [
                                                     {
                                                         "t": "eq",
                                                         "v": "0",
                                                         "vt": "num"
                                                     }
                                                 ],
                                                 "checkall": "true",
                                                 "repair": false,
                                                 "outputs": 1,
                                                 "x": 1050,
                                                 "y": 980,
                                                 "wires": [
                                                     [
                                                         "4a433464d06dc6d8",
                                                         "315c37ef4aceb5d4"
                                                     ]
                                                 ]
                                             }
                                          ]
                                          

                                          Hier konntest Du ja auch nach dem topic filtern: https://forum.iobroker.net/post/947167 - also sollte es jetzt auch gehen.

                                          Wie gesagt Deine Lösung https://forum.iobroker.net/post/947177 funktioniert ja auch - aber mich würde halt stören, dass ich als Marker für das array Ende einen festen Namen im Array verwenden muss. ;)

                                          Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                                          M 1 Antwort Letzte Antwort
                                          0
                                          Antworten
                                          • In einem neuen Thema antworten
                                          Anmelden zum Antworten
                                          • Älteste zuerst
                                          • Neuste zuerst
                                          • Meiste Stimmen


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          749

                                          Online

                                          32.5k

                                          Benutzer

                                          81.8k

                                          Themen

                                          1.3m

                                          Beiträge
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Anmelden

                                          • Du hast noch kein Konto? Registrieren

                                          • Anmelden oder registrieren, um zu suchen
                                          • Erster Beitrag
                                            Letzter Beitrag
                                          0
                                          • Home
                                          • Aktuell
                                          • Tags
                                          • Ungelesen 0
                                          • Kategorien
                                          • Unreplied
                                          • Beliebt
                                          • GitHub
                                          • Docu
                                          • Hilfe