Inhalt einer Textdatei durch Node Red "file in" node in einer function node verarbeiten

Hallo Zusammen,

ich habe eine Frage bezüglich dem Importieren von externen Daten in Node Red. Dabei geht es in meinem Flow um einen Counter der ein Ereignis zählt und in einer Text Datei speichert. Das klappt soweit auch ganz easy, nur will ich, dass mein Counter auch nach einem System Neustart seinen “alten” Wert beibehält und nicht wieder bei 0 startet.
Deshalb habe ich mit dem file-node eine Datei angelegt die den jeweiligen Count-zustand zählt. In einer function node würde ich dann den gezählten Wert mit dem gespeicherten vergleichen, hier nun meine Frage:

wie bekomme ich den Wert aus der Textdatei (zB. die zahl 5) in meiner function node deklariert? Momentan kann ich ihn mir nur beim debuggen mit dem “file in”-node anzeigen lassen, jedoch aber nicht sinnvoll nutzen.

Ich hoffe man kann meiner Beschreibung folgen :smile:

Das sollte mit dem file-node gehen. Wie sieht denn dein msg-object aus, was aus dem file-node kommt?

Eventuell macht es aber mehr Sinn, dass du dafür eine Datenbank nutzt? Ich mache das Gleiche hier mit mysql, geht aber natürlich genauso mit sqlite - was auch wieder nru eine Datei ist.


Das ist mein momentaner Flow, diesen will ich dann mit dem file in-Node und der function zum vergleichen der Werte ergänzen.

mein msg-object, dass aus der file-node kommt ist ein string.

Lässt sich dann der Wert aus der Datenbank in einer function-node aufrufen bzw. deklarieren?

Ich glaube du suchst https://nodered.org/docs/creating-nodes/context :wink:

Du musst erst mal dafür sorgen, dass beide Werte in deinem function-node vorhanden sind, damit du sie vergleiche kannst.
Node-Red ist keine SPS, es gibt in dem Sinne keine boolschen-nodes. Du musst Vergleiche also “flow based” bauen.

Schau dir aber doch einfach mal node-blue an. Das kann boolsche Operationen und enthält auch schon für Zustände udn Variablen eine Persistenz. Je nachdem was du machen willst, ist das vielleicht der einfachere Weg.

Ja von diesem Node Blue habe ich schon gehört, jedoch findet man dazu nicht all zu viel im Internet.
Verstehe ich das richtig, dass man also mit Node Red auch keine Bytes über 8 Digitale Eingänge schaffen kann?
Habe das früher schon einmal versucht, bin dann aber auf das Problem gestoßen das, wenn mehrere Eingänge gleichzeitig eine logische 1 gesetzt haben, ich zwar den code für diesen Zustand erhalte aber eben auch die Zustände der anderen.
Ich denke mit einem Beispiel kann man mir besser folgen:
Angenommen ich habe 2 Digitale eingänge, dann würde das Binär 4 Zustände bedeuten.
00
10
01
11
Solange nur ein Eingang als logische 1 gesehen wird habe ich keine Probleme, sind nun aber beide auf 1 bekomme ich 3 Zustände.
Das ist mir soweit auch klar, nur habe ich es dann nicht geschafft in meinem Programm nur den richtigen Zustand zu erfassen.

Anbei mal der “gemurkste” Aufbau:

Node-Blue ist Teil von homegear. Dort hast du den node-red Editor mit einem selbstgeschriebenen c+±Backend. In den Function Nodes nutzt man dort PHP statt Javascript.
@sathya hat dort boolsche-Nodes implementiert und nodes können in node-blue mehr als einen Eingang haben. Dadurch bist du damit näher an der SPS.


Dein Problem mit node-red lässt sich mit Context lösen. Gedanklich muss du nur dahin kommen, dass du nicht mit Zuständen arbeitest sonder mit Ereignissen (Events). Dadurch kann es im Flow-Based Programming im Normalfall keine und-nodes geben. Das musst du dir mit Context bauen.

Ich habe jetzt in node-red 8 Eingänge die ich zu einem Byte generiere, das passt soweit auch. Nur nachdem ich node red neu gebootet habe, meldet mir das Debugfenster nur noch “undefined”, wo am Tag davor scheinbar noch alles “defined” war.

Hier mal mein Flow

[
    {
        "id": "66d576c1.f7a688",
        "type": "subflow",
        "name": "Ausgangsverschaltung",
        "info": "",
        "in": [
            {
                "x": 160,
                "y": 1960,
                "wires": [
                    {
                        "id": "c2cbbeb8.ccc248"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 720,
                "y": 60,
                "wires": [
                    {
                        "id": "ec09c5b0.f5a9b8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 100,
                "wires": [
                    {
                        "id": "26fedb88.0e03dc",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 140,
                "wires": [
                    {
                        "id": "f7c6fee2.d436f",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 180,
                "wires": [
                    {
                        "id": "e36ac130.44e2e8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 220,
                "wires": [
                    {
                        "id": "8e879640.b6e2a8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 260,
                "wires": [
                    {
                        "id": "8febb20.186425",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 300,
                "wires": [
                    {
                        "id": "5951315d.7d43f8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 340,
                "wires": [
                    {
                        "id": "dfccdb17.14d7f8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 380,
                "wires": [
                    {
                        "id": "19d3458d.c44122",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 420,
                "wires": [
                    {
                        "id": "a55928c1.eb451",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 460,
                "wires": [
                    {
                        "id": "52432b65.3ea8d4",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 500,
                "wires": [
                    {
                        "id": "89d60cc5.b97328",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 540,
                "wires": [
                    {
                        "id": "66c575f4.1dd40c",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 580,
                "wires": [
                    {
                        "id": "3cc60008.8fda",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 620,
                "wires": [
                    {
                        "id": "c00c084.f6d1bf8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 660,
                "wires": [
                    {
                        "id": "d414d795.3a29",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 700,
                "wires": [
                    {
                        "id": "dfd0a9d.797c2d8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 740,
                "wires": [
                    {
                        "id": "84773041.17da6",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 780,
                "wires": [
                    {
                        "id": "25d1437d.36162c",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 820,
                "wires": [
                    {
                        "id": "6e14f13b.cd34d",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 860,
                "wires": [
                    {
                        "id": "da87a286.3e8248",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 900,
                "wires": [
                    {
                        "id": "ee8977fb.3ba97",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 940,
                "wires": [
                    {
                        "id": "195dba39.0a9386",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 980,
                "wires": [
                    {
                        "id": "f6f90dee.c7ce9",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1020,
                "wires": [
                    {
                        "id": "34cb31bc.638cae",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1060,
                "wires": [
                    {
                        "id": "314f6ffe.a38208",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1100,
                "wires": [
                    {
                        "id": "ec387088.b84918",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1140,
                "wires": [
                    {
                        "id": "8c7283a2.1fc93",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1180,
                "wires": [
                    {
                        "id": "ccfdb346.da187",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1220,
                "wires": [
                    {
                        "id": "61ca72ff.2854a4",
                        "port": 0
                    }
                ]
            },
            {
                "x": 720,
                "y": 1260,
                "wires": [
                    {
                        "id": "ae8c53c6.a52d3",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "ec09c5b0.f5a9b8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000001 [1]",
        "func": "Wert = context.get('Anzahl') ||0;\nWert ++;\ncontext.set('Anzahl', Wert);\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "26fedb88.0e03dc",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000010 [2]",
        "func": "Wert = context.get('Anzahl') ||0;\nWert ++;\ncontext.set('Anzahl', Wert);\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "e36ac130.44e2e8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000100 [4]",
        "func": "Wert = context.get('Anzahl') ||0;\nWert ++;\ncontext.set('Anzahl', Wert);\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "f7c6fee2.d436f",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000011 [3]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "8e879640.b6e2a8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000101 [5]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "8febb20.186425",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000110 [6]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "5951315d.7d43f8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00000111 [7]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "dfccdb17.14d7f8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001000 [8]",
        "func": "Wert = context.get('Anzahl') ||0;\nWert ++;\ncontext.set('Anzahl', Wert);\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "19d3458d.c44122",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001001 [9]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "a55928c1.eb451",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001010 [10]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "52432b65.3ea8d4",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001011 [11]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "89d60cc5.b97328",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001100 [12]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 500,
        "wires": [
            []
        ]
    },
    {
        "id": "66c575f4.1dd40c",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001101 [13]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "3cc60008.8fda",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001110 [14]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "c00c084.f6d1bf8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00001111 [15]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 3)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 620,
        "wires": [
            []
        ]
    },
    {
        "id": "d414d795.3a29",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010000 [16]",
        "func": "Wert = context.get('Anzahl') ||0;\nWert ++;\ncontext.set('Anzahl', Wert);\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 660,
        "wires": [
            []
        ]
    },
    {
        "id": "dfd0a9d.797c2d8",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010001 [17]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 700,
        "wires": [
            []
        ]
    },
    {
        "id": "84773041.17da6",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010010 [18]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 740,
        "wires": [
            []
        ]
    },
    {
        "id": "25d1437d.36162c",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010011 [19]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 780,
        "wires": [
            []
        ]
    },
    {
        "id": "c2cbbeb8.ccc248",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "",
        "func": "if (msg.payload === 0)\n{\n    return [msg];\n}\nelse if (msg.payload == 1)\n{\n    return [null,msg];\n}\nelse if (msg.payload == 2)\n{\n    return [null,null,msg];\n}\nelse if(msg.payload == 3)\n{\n    return [null,null,null,msg];\n}\nelse if (msg.payload == 4)\n{\n    return [null,null,null,null,msg];\n}\nelse if (msg.payload == 5)\n{\n    return [null,null,null,null,null,msg];\n}\nelse if (msg.payload == 6)\n{\n    return [null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 7)\n{\n    return [null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 8)\n{\n    return [null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 9)\n{\n    return [null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 10)\n{\n    return [null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 11)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 12)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 13)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 14)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 15)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 16)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 17)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 18)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 19)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 20)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 21)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 22)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 23)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 24)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 25)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 26)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 27)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 28)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 29)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 30)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}\nelse if (msg.payload == 31)\n{\n    return [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,msg];\n}",
        "outputs": 255,
        "noerr": 0,
        "x": 310,
        "y": 1960,
        "wires": [
            [],
            [
                "ec09c5b0.f5a9b8"
            ],
            [
                "26fedb88.0e03dc"
            ],
            [
                "f7c6fee2.d436f"
            ],
            [
                "e36ac130.44e2e8"
            ],
            [
                "8e879640.b6e2a8"
            ],
            [
                "8febb20.186425"
            ],
            [
                "5951315d.7d43f8"
            ],
            [
                "dfccdb17.14d7f8"
            ],
            [
                "19d3458d.c44122"
            ],
            [
                "a55928c1.eb451"
            ],
            [
                "52432b65.3ea8d4"
            ],
            [
                "89d60cc5.b97328"
            ],
            [
                "66c575f4.1dd40c"
            ],
            [
                "3cc60008.8fda"
            ],
            [
                "c00c084.f6d1bf8"
            ],
            [
                "d414d795.3a29"
            ],
            [
                "dfd0a9d.797c2d8"
            ],
            [
                "84773041.17da6"
            ],
            [
                "25d1437d.36162c"
            ],
            [
                "6e14f13b.cd34d"
            ],
            [
                "da87a286.3e8248"
            ],
            [
                "ee8977fb.3ba97"
            ],
            [
                "195dba39.0a9386"
            ],
            [
                "f6f90dee.c7ce9"
            ],
            [
                "34cb31bc.638cae"
            ],
            [
                "314f6ffe.a38208"
            ],
            [
                "ec387088.b84918"
            ],
            [
                "8c7283a2.1fc93"
            ],
            [
                "ccfdb346.da187"
            ],
            [
                "61ca72ff.2854a4"
            ],
            [
                "ae8c53c6.a52d3"
            ],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "6e14f13b.cd34d",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010100 [20]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 820,
        "wires": [
            []
        ]
    },
    {
        "id": "da87a286.3e8248",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010101 [21]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 860,
        "wires": [
            []
        ]
    },
    {
        "id": "ee8977fb.3ba97",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010110 [22]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 900,
        "wires": [
            []
        ]
    },
    {
        "id": "195dba39.0a9386",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00010111 [23]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 3)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 940,
        "wires": [
            []
        ]
    },
    {
        "id": "f6f90dee.c7ce9",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011000 [24]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 1)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 980,
        "wires": [
            []
        ]
    },
    {
        "id": "34cb31bc.638cae",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011001 [25]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1020,
        "wires": [
            []
        ]
    },
    {
        "id": "314f6ffe.a38208",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011010 [26]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1060,
        "wires": [
            []
        ]
    },
    {
        "id": "ec387088.b84918",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011011 [27]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 3)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1100,
        "wires": [
            []
        ]
    },
    {
        "id": "8c7283a2.1fc93",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011100 [28]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 2)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1140,
        "wires": [
            []
        ]
    },
    {
        "id": "ccfdb346.da187",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011101 [29]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 3)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1180,
        "wires": [
            []
        ]
    },
    {
        "id": "61ca72ff.2854a4",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011110 [30]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 3)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1220,
        "wires": [
            []
        ]
    },
    {
        "id": "ae8c53c6.a52d3",
        "type": "function",
        "z": "66d576c1.f7a688",
        "name": "Zähler 00011111 [31]",
        "func": "var Z111 = context.get('Zähler111') ||0;\nvar Wert;\nif(Z111 < 4)\n{\n    Z111 ++;\n    \n    context.set('Zähler111', Z111)||1; \n    \n    Wert = context.get('Anzahl')||0;\n   \n}\n\n   \nelse\n{   // Zähler\n    Wert = context.get('Anzahl') ||0;\n    Wert ++;\n    context.set('Anzahl', Wert);\n\n    Z111 = context.set('Zähler111') ||0;\n    context.set('Zähler111', Z111);\n    \n}\n\nreturn {payload : Wert};",
        "outputs": 1,
        "noerr": 0,
        "x": 580,
        "y": 1260,
        "wires": [
            []
        ]
    },
    {
        "id": "a4c31e0.b67f8e",
        "type": "subflow",
        "name": "Eingang 7",
        "info": "",
        "in": [
            {
                "x": 60,
                "y": 220,
                "wires": [
                    {
                        "id": "5186860e.a58278"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 740,
                "y": 220,
                "wires": [
                    {
                        "id": "4f2ff86a.f61be",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "4f2ff86a.f61be",
        "type": "trigger",
        "z": "a4c31e0.b67f8e",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 600,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "57819f0e.1f1cc8",
        "type": "trigger",
        "z": "a4c31e0.b67f8e",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 390,
        "y": 220,
        "wires": [
            [
                "4f2ff86a.f61be"
            ]
        ]
    },
    {
        "id": "5186860e.a58278",
        "type": "function",
        "z": "a4c31e0.b67f8e",
        "name": "1/0_7",
        "func": "var I7 = global.get('I-Zähler7') ||0;\nif(I7 < 1)\n{\n   I7 ++;\n  global.set('I-Zähler7', I7)||1;\n}\nelse\n{\n   I7 = global.set('I-Zähler7') ||0;\n   global.set('I-Zähler7', I7);\n}\nreturn {payload : I7};",
        "outputs": 1,
        "noerr": 0,
        "x": 190,
        "y": 220,
        "wires": [
            [
                "57819f0e.1f1cc8"
            ]
        ]
    },
    {
        "id": "77e55af9.06348c",
        "type": "subflow",
        "name": "Eingang 6",
        "info": "",
        "in": [
            {
                "x": 60,
                "y": 220,
                "wires": [
                    {
                        "id": "f9c510ae.f46008"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 720,
                "y": 220,
                "wires": [
                    {
                        "id": "a1d3be35.7bcb4",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "a1d3be35.7bcb4",
        "type": "trigger",
        "z": "77e55af9.06348c",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 580,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "ad4e2a46.9e68d",
        "type": "trigger",
        "z": "77e55af9.06348c",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 370,
        "y": 220,
        "wires": [
            [
                "a1d3be35.7bcb4"
            ]
        ]
    },
    {
        "id": "f9c510ae.f46008",
        "type": "function",
        "z": "77e55af9.06348c",
        "name": "1/0_6",
        "func": "var I6 = global.get('I-Zähler6') ||0;\nif(I6 < 1)\n{\n   I6 ++;\n  global.set('I-Zähler6', I6)||1;\n}\nelse\n{\n   I6 = global.set('I-Zähler6') ||0;\n   global.set('I-Zähler6', I6);\n}\nreturn {payload : I6};",
        "outputs": 1,
        "noerr": 0,
        "x": 170,
        "y": 220,
        "wires": [
            [
                "ad4e2a46.9e68d"
            ]
        ]
    },
    {
        "id": "734ec944.8cf7f",
        "type": "subflow",
        "name": "Eingang 5",
        "info": "",
        "in": [
            {
                "x": 100,
                "y": 200,
                "wires": [
                    {
                        "id": "57288486.2b2f1c"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 800,
                "y": 200,
                "wires": [
                    {
                        "id": "468485ef.3dce64",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "468485ef.3dce64",
        "type": "trigger",
        "z": "734ec944.8cf7f",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 640,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "b302e94e.bb371",
        "type": "trigger",
        "z": "734ec944.8cf7f",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 430,
        "y": 200,
        "wires": [
            [
                "468485ef.3dce64"
            ]
        ]
    },
    {
        "id": "57288486.2b2f1c",
        "type": "function",
        "z": "734ec944.8cf7f",
        "name": "1/0_5",
        "func": "var I5 = global.get('I-Zähler5') ||0;\nif(I5 < 1)\n{\n   I5 ++;\n  global.set('I-Zähler5', I5)||1;\n}\nelse\n{\n   I5 = global.set('I-Zähler5') ||0;\n   global.set('I-Zähler5', I5);\n}\nreturn {payload : I5};",
        "outputs": 1,
        "noerr": 0,
        "x": 230,
        "y": 200,
        "wires": [
            [
                "b302e94e.bb371"
            ]
        ]
    },
    {
        "id": "3f7d09c3.de129e",
        "type": "subflow",
        "name": "Eingang 4",
        "info": "",
        "in": [
            {
                "x": 60,
                "y": 180,
                "wires": [
                    {
                        "id": "e856bcb1.609028"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 800,
                "y": 180,
                "wires": [
                    {
                        "id": "fec2d1f4.abf638",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "fec2d1f4.abf638",
        "type": "trigger",
        "z": "3f7d09c3.de129e",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 640,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "df87366e.e1406",
        "type": "trigger",
        "z": "3f7d09c3.de129e",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 430,
        "y": 180,
        "wires": [
            [
                "fec2d1f4.abf638"
            ]
        ]
    },
    {
        "id": "e856bcb1.609028",
        "type": "function",
        "z": "3f7d09c3.de129e",
        "name": "1/0_4",
        "func": "var I4 = global.get('I-Zähler4') ||0;\nif(I4 < 1)\n{\n   I4 ++;\n  global.set('I-Zähler4', I4)||1;\n}\nelse\n{\n   I4 = global.set('I-Zähler4') ||0;\n   global.set('I-Zähler4', I4);\n}\nreturn {payload : I4};",
        "outputs": 1,
        "noerr": 0,
        "x": 230,
        "y": 180,
        "wires": [
            [
                "df87366e.e1406"
            ]
        ]
    },
    {
        "id": "9d9c094c.e31e3",
        "type": "subflow",
        "name": "Eingang 3",
        "info": "",
        "in": [
            {
                "x": 140,
                "y": 240,
                "wires": [
                    {
                        "id": "be95fceb.a619c"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 780,
                "y": 240,
                "wires": [
                    {
                        "id": "f8ffeb83.5644e8",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "be95fceb.a619c",
        "type": "function",
        "z": "9d9c094c.e31e3",
        "name": "1/0_3",
        "func": "var I3 = global.get('I-Zähler3') ||0;\nif(I3 < 1)\n{\n    I3 ++;\n    global.set('I-Zähler3', I3)||1;\n}\nelse\n{\n    I3 = global.set('I-Zähler3') ||0;\n    global.set('I-Zähler3', I3);\n}\nreturn {payload : I3};",
        "outputs": 1,
        "noerr": 0,
        "x": 270,
        "y": 240,
        "wires": [
            [
                "a72d1772.e86128"
            ]
        ]
    },
    {
        "id": "f8ffeb83.5644e8",
        "type": "trigger",
        "z": "9d9c094c.e31e3",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 640,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "a72d1772.e86128",
        "type": "trigger",
        "z": "9d9c094c.e31e3",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 450,
        "y": 240,
        "wires": [
            [
                "f8ffeb83.5644e8"
            ]
        ]
    },
    {
        "id": "dc84a6ad.0fcd2",
        "type": "subflow",
        "name": "Eingang 2",
        "info": "",
        "in": [
            {
                "x": 200,
                "y": 220,
                "wires": [
                    {
                        "id": "4fa11fe2.22b308"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 900,
                "y": 220,
                "wires": [
                    {
                        "id": "bd846b0e.01ef08",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "4fa11fe2.22b308",
        "type": "function",
        "z": "dc84a6ad.0fcd2",
        "name": "1/0_2",
        "func": "var I2 = global.get('I-Zähler2') ||0;\nif(I2 < 1)\n{\n    I2 ++;\n  global.set('I-Zähler2', I2)||1;\n}\nelse\n{\n    I2 = global.set('I-Zähler2') ||0;\n    global.set('I-Zähler2', I2);\n}\nreturn {payload : I2};",
        "outputs": 1,
        "noerr": 0,
        "x": 350,
        "y": 220,
        "wires": [
            [
                "7e424e92.fcd4e8"
            ]
        ]
    },
    {
        "id": "bd846b0e.01ef08",
        "type": "trigger",
        "z": "dc84a6ad.0fcd2",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 740,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "7e424e92.fcd4e8",
        "type": "trigger",
        "z": "dc84a6ad.0fcd2",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 510,
        "y": 220,
        "wires": [
            [
                "bd846b0e.01ef08"
            ]
        ]
    },
    {
        "id": "87ae6071.a54f28",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E1",
        "pin": "7",
        "intype": "tri",
        "debounce": "1",
        "read": false,
        "x": 70,
        "y": 180,
        "wires": [
            [
                "ab0d1ec5.6bcc5"
            ]
        ]
    },
    {
        "id": "f63c555d.68c7b",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E2",
        "pin": "11",
        "intype": "tri",
        "debounce": "1",
        "read": false,
        "x": 70,
        "y": 240,
        "wires": [
            [
                "aceef5b3.e914"
            ]
        ]
    },
    {
        "id": "44d06153.0ce958",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E3",
        "pin": "12",
        "intype": "tri",
        "debounce": "1",
        "read": false,
        "x": 70,
        "y": 300,
        "wires": [
            [
                "d2798c5f.e0383"
            ]
        ]
    },
    {
        "id": "ce1ed3f3.62d84",
        "type": "debug",
        "z": "15b6f795.f89ae",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 450,
        "y": 560,
        "wires": []
    },
    {
        "id": "a0e4e7f1.575a3",
        "type": "function",
        "z": "15b6f795.f89ae",
        "name": "Logikabfrage 8 Bit",
        "func": "\n\n    A1 = global.get('I-Zähler1');\n    A2 = global.get('I-Zähler2');\n    A3 = global.get('I-Zähler3');\n    A4 = global.get('I-Zähler4');\n    A5 = global.get('I-Zähler5');\n    A6 = global.get('I-Zähler6');\n    A7 = global.get('I-Zähler7');\n    A8 = global.get('I-Zähler8');\n    var Binaer;\n    \n// Dezimale 0\nif (0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 0 === A6 && 0 === A7 && 0 === A8)\n{\n   \n    Binaer = flow.set('Zahl')||0;\n   \n}\n\n// Dezimale 1\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 0 === A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||1;\n    \n}\n\n// Dezimale 2\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 0 === A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||2;\n    \n}\n\n// Dezimale 3\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 0 === A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||3;\n    \n}\n\n// Dezimale 4\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 1 == A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||4;\n    \n}\n\n// Dezimale 5\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 1 == A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||5;\n    \n}\n\n// Dezimale 6\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 1 == A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||6;\n    \n}\n\n// Dezimale 7\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 0 === A5 && 1 == A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||7;\n    \n}\n\n// Dezimale 8\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 0 === A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||8;\n    \n}\n\n// Dezimale 9\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 0 === A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||9;\n    \n}\n\n// Dezimale 10\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 0 === A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||10;\n    \n}\n\n// Dezimale 11\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 0 === A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||11;\n    \n}\n\n// Dezimale 12\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 1 == A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||12;\n    \n}\n\n// Dezimale 13\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 1 == A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||13;\n    \n}\n\n// Dezimale 14\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 1 == A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||14;\n    \n}\n\n// Dezimale 15\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 0 === A4 && 1 == A5 && 1 == A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||15;\n    \n}\n\n// Dezimale 16\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 0 === A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||16;\n    \n}\n\n// Dezimale 17\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 0 === A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||17;\n    \n}\n\n// Dezimale 18\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 0 === A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||18;\n    \n}\n\n// Dezimale 19\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 0 === A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||19;\n    \n}\n\n// Dezimale 20\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 1 == A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||20;\n    \n}\n\n// Dezimale 21\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 1 == A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||21;\n    \n}\n\n// Dezimale 22\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 1 == A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||22;\n    \n}\n\n// Dezimale 23\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 0 === A5 && 1 == A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||23;\n    \n}\n\n// Dezimale 24\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 0 === A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||24;\n    \n}\n\n// Dezimale 25\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 0 === A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||25;\n    \n}\n\n// Dezimale 26\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 0 === A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||26;\n    \n}\n\n// Dezimale 27\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 0 === A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||27;\n    \n}\n\n// Dezimale 28\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 1 == A6 && 0 === A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||28;\n    \n}\n\n// Dezimale 29\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 1 == A6 && 0 === A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||29;\n    \n}\n\n// Dezimale 30\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 1 == A6 && 1 == A7 && 0 === A8) \n{\n    Binaer = flow.set('Zahl')||30;\n    \n}\n\n// Dezimale 31\nelse if(0 === A1 && 0 === A2 && 0 === A3 && 1 == A4 && 1 == A5 && 1 == A6 && 1 == A7 && 1 == A8) \n{\n    Binaer = flow.set('Zahl')||31;\n    \n}\n\n\nelse \n{\n    'Fehler';\n}\nmsg.payload = Binaer;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 530,
        "y": 400,
        "wires": [
            [
                "9f58f261.a9b608",
                "ce1ed3f3.62d84"
            ]
        ]
    },
    {
        "id": "aceef5b3.e914",
        "type": "subflow:dc84a6ad.0fcd2",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 210,
        "y": 240,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "d2798c5f.e0383",
        "type": "subflow:9d9c094c.e31e3",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 210,
        "y": 300,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "fdbd42a1.337c18",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E4",
        "pin": "13",
        "intype": "tri",
        "debounce": "25",
        "read": false,
        "x": 70,
        "y": 360,
        "wires": [
            [
                "b84ea2eb.8a7fb8"
            ]
        ]
    },
    {
        "id": "8358f0e0.2b8da8",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E5",
        "pin": "15",
        "intype": "tri",
        "debounce": "25",
        "read": false,
        "x": 70,
        "y": 420,
        "wires": [
            [
                "41ea4ae6.8398b4"
            ]
        ]
    },
    {
        "id": "cc362c19.f8bf58",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E6",
        "pin": "16",
        "intype": "tri",
        "debounce": "25",
        "read": false,
        "x": 70,
        "y": 480,
        "wires": [
            [
                "63d60ed5.bb192"
            ]
        ]
    },
    {
        "id": "36d0fa9d.6c4cae",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E7",
        "pin": "18",
        "intype": "tri",
        "debounce": "1",
        "read": false,
        "x": 70,
        "y": 540,
        "wires": [
            [
                "91eb54ed.b6588"
            ]
        ]
    },
    {
        "id": "48a5b09e.04855",
        "type": "rpi-gpio in",
        "z": "15b6f795.f89ae",
        "name": "E8",
        "pin": "22",
        "intype": "tri",
        "debounce": "25",
        "read": false,
        "x": 70,
        "y": 600,
        "wires": [
            [
                "7c1f74c8.ba8aac"
            ]
        ]
    },
    {
        "id": "b84ea2eb.8a7fb8",
        "type": "subflow:3f7d09c3.de129e",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 220,
        "y": 360,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "41ea4ae6.8398b4",
        "type": "subflow:734ec944.8cf7f",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 220,
        "y": 420,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "63d60ed5.bb192",
        "type": "subflow:77e55af9.06348c",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 220,
        "y": 480,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "91eb54ed.b6588",
        "type": "subflow:a4c31e0.b67f8e",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 220,
        "y": 540,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "9f58f261.a9b608",
        "type": "subflow:66d576c1.f7a688",
        "z": "15b6f795.f89ae",
        "name": "",
        "x": 870,
        "y": 400,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "98ea3997.779d18",
        "type": "trigger",
        "z": "15b6f795.f89ae",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 420,
        "y": 80,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "f73ec4c0.b76fa",
        "type": "trigger",
        "z": "15b6f795.f89ae",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 250,
        "y": 80,
        "wires": [
            [
                "98ea3997.779d18"
            ]
        ]
    },
    {
        "id": "ab0d1ec5.6bcc5",
        "type": "function",
        "z": "15b6f795.f89ae",
        "name": "1/0_1",
        "func": "var I1 = global.get('I-Zähler1') ||0;\nif(I1 < 1)\n{\n   I1 ++;\n  global.set('I-Zähler1', I1)||1;\n}\nelse\n{\n   I1 = global.set('I-Zähler1') ||0;\n   global.set('I-Zähler1', I1);\n}\nreturn {payload : I1};",
        "outputs": 1,
        "noerr": 0,
        "x": 190,
        "y": 120,
        "wires": [
            [
                "f73ec4c0.b76fa"
            ]
        ]
    },
    {
        "id": "cff49b97.1d8c98",
        "type": "trigger",
        "z": "15b6f795.f89ae",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "500",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 600,
        "y": 740,
        "wires": [
            [
                "a0e4e7f1.575a3"
            ]
        ]
    },
    {
        "id": "aa532c0f.9ceba8",
        "type": "trigger",
        "z": "15b6f795.f89ae",
        "op1": "0",
        "op2": "1",
        "op1type": "str",
        "op2type": "str",
        "duration": "50",
        "extend": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "name": "",
        "x": 390,
        "y": 740,
        "wires": [
            [
                "cff49b97.1d8c98"
            ]
        ]
    },
    {
        "id": "7c1f74c8.ba8aac",
        "type": "function",
        "z": "15b6f795.f89ae",
        "name": "1/0_8",
        "func": "var I8 = global.get('I-Zähler8') ||0;\nif(I8 < 1)\n{\n   I8 ++;\n  global.set('I-Zähler8', I8)||1;\n}\nelse\n{\n   I8 = global.set('I-Zähler8') ||0;\n   global.set('I-Zähler8', I8);\n}\nreturn {payload : I8};",
        "outputs": 1,
        "noerr": 0,
        "x": 190,
        "y": 740,
        "wires": [
            [
                "aa532c0f.9ceba8"
            ]
        ]
    }
]

habe soeben mein anfängliches Problem gelöst bekommen, ich speichere den Inhalt meiner Variablen in einer Json Datei, welche sie dann bei einem Neustart von node red wieder deklariert.

anbei der dazugehörige Flow

[{"id":"f2b73350.f5cb3","type":"inject","z":"915b2c11.879e48","name":"Daily backup","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 2 * * *","once":false,"x":360,"y":220,"wires":[["78721b00.592adc"]]},{"id":"78721b00.592adc","type":"function","z":"915b2c11.879e48","name":"Prep data","func":"// global variables separated by semicolon to be saved\nvar globallist = \"count;count1;Anzahl3\";\nvar mylist = globallist.split(\";\");\n\nvar outputs = [];\n\nfor (i=0; i<mylist.length; i++) {\n    outputs.push({ key : mylist[i], type: typeof global.get(mylist[i]), value: global.get(mylist[i])});\n}\n      \n      \nmsg.payload = outputs;\nreturn msg;\n\n//msg.payload=typeof global.get(\"torrent_keywords\");\n","outputs":1,"noerr":0,"x":533,"y":223,"wires":[["192d451e.92e8b3"]]},{"id":"2f02f987.76ebae","type":"comment","z":"915b2c11.879e48","name":"Save global variables","info":"","x":352,"y":175,"wires":[]},{"id":"395be6f2.64f452","type":"comment","z":"915b2c11.879e48","name":"Restore global variables","info":"","x":360,"y":266,"wires":[]},{"id":"d40f7973.0a80e","type":"inject","z":"915b2c11.879e48","name":"Startup","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":321,"y":313,"wires":[["f6206b4b.34f6e"]]},{"id":"812e3295.347c5","type":"file","z":"915b2c11.879e48","name":"","filename":"/home/pi/global.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":989.0000152587891,"y":233.99998664855957,"wires":[]},{"id":"f6206b4b.34f6e","type":"file in","z":"915b2c11.879e48","name":"","filename":"/home/pi/global.json","format":"utf8","x":540,"y":313,"wires":[["aa728c36.07df8"]]},{"id":"27ca846d.663c14","type":"function","z":"915b2c11.879e48","name":"Restore","func":"var output = [];\n\nfor (var i=0; i<msg.payload.length; i++) {\n    switch (msg.payload[i].type) {\n        case 'undefined': \n            // the global variable probably had no value, nothing needs to be restored\n            output.push(msg.payload[i].key + \" is undefined.\");\n            break;\n        case 'number':\n            if (msg.payload[i].value===\"NaN\") {\n                // there is no valid value to be restored, skip this variable\n                output.push(msg.payload[i].key + \" is NaN.\");\n            } else {\n                if (msg.payload[i].value.toString().indexOf(\".\")>-1) {\n                    // the value appears to be a float\n                    global.set(msg.payload[i].key,parseFloat(msg.payload[i].value));\n                    output.push(msg.payload[i].key + \" is restored to \" + msg.payload[i].value);\n                } else {\n                    global.set(msg.payload[i].key,parseInt(msg.payload[i].value));\n                    output.push(msg.payload[i].key + \" is restored to \" + msg.payload[i].value);\n                }\n            }\n            break;\n        case 'string':\n            global.set(msg.payload[i].key,msg.payload[i].value);\n            output.push(msg.payload[i].key + \" is restored to \" + msg.payload[i].value);\n            break;\n        case 'boolean':\n            global.set(msg.payload[i].key,msg.payload[i].value===\"true\");\n            output.push(msg.payload[i].key + \" is restored to \" + msg.payload[i].value);\n            break;\n    }\n}\n\nmsg.payload = output;\nreturn msg;","outputs":1,"noerr":0,"x":331,"y":388,"wires":[["20876b0b.df451c","e99de29e.8b7478","8589c549.0e6988"]]},{"id":"192d451e.92e8b3","type":"json","z":"915b2c11.879e48","name":"","x":762,"y":232,"wires":[["812e3295.347c5"]]},{"id":"aa728c36.07df8","type":"json","z":"915b2c11.879e48","name":"","x":746,"y":313,"wires":[["27ca846d.663c14"]]},{"id":"20876b0b.df451c","type":"function","z":"915b2c11.879e48","name":"count  restore","func":"msg.topic = \"count\";\nmsg.payload = global.get(\"count\");\nreturn msg;","outputs":1,"noerr":0,"x":549,"y":389,"wires":[["995bf6e0.606048"]]},{"id":"995bf6e0.606048","type":"link out","z":"915b2c11.879e48","name":"count","links":["447373f9.b0aa9c"],"x":778,"y":388,"wires":[]},{"id":"f3f28ae4.006e08","type":"function","z":"915b2c11.879e48","name":"count","func":"value = global.get('count') ||0;\nvalue++;\nglobal.set('count', value);\nreturn {payload : value};","outputs":1,"noerr":0,"x":470,"y":640,"wires":[["a1b850be.437248"]]},{"id":"e8ad39a0.67b4b","type":"inject","z":"915b2c11.879e48","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":300,"y":640,"wires":[["f3f28ae4.006e08"]]},{"id":"a1b850be.437248","type":"debug","z":"915b2c11.879e48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":640,"wires":[]},{"id":"e99de29e.8b7478","type":"function","z":"915b2c11.879e48","name":"count 1 restore","func":"msg.topic = \"count1\";\nmsg.payload = global.get(\"count1\");\nreturn msg;","outputs":1,"noerr":0,"x":560,"y":440,"wires":[[]]},{"id":"a5a47983.7f523","type":"function","z":"915b2c11.879e48","name":"count1","func":"value = global.get('count1') ||0;\nvalue++;\nglobal.set('count1', value);\nreturn {payload : value};\n","outputs":1,"noerr":0,"x":590,"y":700,"wires":[[]]},{"id":"447373f9.b0aa9c","type":"link in","z":"915b2c11.879e48","name":"count","links":["995bf6e0.606048"],"x":375,"y":560,"wires":[["f3f28ae4.006e08"]]},{"id":"8589c549.0e6988","type":"function","z":"915b2c11.879e48","name":"Anzahl3 restore","func":"msg.topic = \"Anzahl3\";\nmsg.payload = global.get(\"Anzahl3\");\nreturn msg;","outputs":1,"noerr":0,"x":560,"y":480,"wires":[["1bd481df.38c3be"]]},{"id":"1bd481df.38c3be","type":"link out","z":"915b2c11.879e48","name":"Anzahl3","links":[],"x":775,"y":480,"wires":[]}]
1 Like

Hallo

der letzte Beitrag scheint ja das Problem zu lösen (das ich auch schon habe). Leider ist es aber nicht möglich, den Code in Node-Red zu importieren, da bestimmte Zeichen vertauscht sind; z.B. gibt es drei verschiedene Zeichen für das Anführungszeichen: “ ” " (diese drei sind falsch).
In dem vorletzten Beitrag hat es noch ausgereicht, diese Zeichen gegen die korrekten Anführungszeichen auszutauschen.
Aber bei den entscheidenden Beitrag reicht das nicht, und der Import schlägt immer noch fehl.

Ich hoffe sehr, mir kann jemand helfen, obwohl dieser Beitrag schon über 2 Jahre alt ist (z.B. den Code als Text-Datei schicken).

Liebe Grüße
Äd

Schau mal on es jetzt geht, habe @YT23100’s code in ``` gepackt, damit es ein codeblock ist und es keine typografischen Anführungszeichen mehr gibt :+1:

Prima, vielen lieben Dank, pmmayer.
Der Import hat damit sofort funktioniert. Klasse. :slight_smile:

Ganz fertig bin ich noch nicht, denn ich bekomme in der Node-RED Console folgende Fehler angezeigt:
[error][file in:2e76f15d.0552be]Error: ENOENT: no such file of directory, open ‘/home/pi/global.json’
[error][file in:1ec2866.4b17e7a]Error: ENOENT: no such file of directory, open ‘/home/pi/global.json’
[error][funcion:Restore]TypeError: Connot read property ‘length’ of undifined
[error][funcion:Restore]TypeError: Connot read property ‘length’ of undifined

Die Datei global.json habe ich dann als leere Datei im pi-Home-Verzeichnis angelgt; da kommt nun
Unexpected end of JSON input.

Ich muss da wohl irgenedeinde geeignete Datei für die Initialisierung anlegen, vermute ich.
EDIT: Das “Problem” erledigt sich von selbst, sobald “Daily backup” erst einmal aktiviert wurde. Dann wird die Datei korrekt angelegt und es tritt dann beim Zurücklesen kein Fehler mehr auf.

Noch nicht fertig, aber weitger :slight_smile:

Nochmals, herzlichen Dank,
Lieben Gruß
Äd