Anfänger Fragen/ Probleme

Versuche mich gerade erst noch als Neueinsteiger an Node-Red und habe hier und da noch so meine Probleme bzw. Fragen.

Aktuell verstehe ich nicht so recht wieso er mal eine Zeit lang die Werte auslesen kann aus Dateien und nach dem x Neuladen/Neustart dann plötzlich keine Werte in den Slidern mehr anzeigen werden. Werte sind aber noch vorhanden, auch startet er die Funktion, wenn die Bedienungen erfüllt sind.

Zweites Problem ist, bei allen Werten außer der Null (0) speichert er den korrekten Wert. Bei Null speichert er den Namen des entsprechenden Sliders (z.B. frostSollInput)?

Bestimmt ganz simple aber irgendwie stehe ich gerade auf dem Schlauch.

Hey,

kannst du den Flow einmal exportieren, dann schau ich mir das mal an.

DIe Nodes markieren, dann rechts oben auf die drei Striche und auf Export, “Ausgewählte Nodes” und “JSON” auswählen und dann hier einfügen.

Ich hoffe du meintest so und schon mal ein dickes Danke :slight_smile:

flows (1).json (22.6 KB)

@devshack
Ich habe nur die 2 Nodes geändert,
und das initialisieren am Timestamp eingeschaltet

[
    {
        "id": "3aaa1940c497732c",
        "type": "file",
        "z": "d1c583b1ec3b0e75",
        "name": "",
        "filename": "pekaway/heater_frost_soll",
        "filenameType": "str",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 1300,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "be783c2b59709d66",
        "type": "file in",
        "z": "d1c583b1ec3b0e75",
        "name": "frostSollInput",
        "filename": "pekaway/heater_frost_soll",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 520,
        "y": 320,
        "wires": [
            [
                "b22a3a762e8c5a20",
                "f46946888115acb1"
            ]
        ]
    },
    {
        "id": "7bce5644a0d919f8",
        "type": "comment",
        "z": "d1c583b1ec3b0e75",
        "name": "Frostmodus Temperatur & Laufzeit Sollwert",
        "info": "",
        "x": 410,
        "y": 280,
        "wires": []
    },
    {
        "id": "625225848342e363",
        "type": "inject",
        "z": "d1c583b1ec3b0e75",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 360,
        "y": 320,
        "wires": [
            [
                "be783c2b59709d66"
            ]
        ]
    },
    {
        "id": "b22a3a762e8c5a20",
        "type": "function",
        "z": "d1c583b1ec3b0e75",
        "name": "set type",
        "func": "var str = Number(msg.payload);\nglobal.set(\"frostSoll\", str);\nmsg.payload = str;\nreturn msg;\n\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 680,
        "y": 320,
        "wires": [
            [
                "bf7841e24a9737a9",
                "768ce90d96e276bc"
            ]
        ]
    },
    {
        "id": "bf7841e24a9737a9",
        "type": "ui_slider",
        "z": "d1c583b1ec3b0e75",
        "name": "frostSollInput",
        "label": "Temperatur Sollwert:",
        "tooltip": "Als Temperatursensor gilt Ruuvi und/oder Planar Sensor",
        "group": "6c33cacc9635fd6e",
        "order": 5,
        "width": 6,
        "height": 1,
        "passthru": true,
        "outs": "end",
        "topic": "",
        "topicType": "str",
        "min": "-10",
        "max": "35",
        "step": 1,
        "className": "",
        "x": 860,
        "y": 320,
        "wires": [
            [
                "fd790d092c1085fa",
                "568634d81a52723f",
                "cc3d2c874efb6777"
            ]
        ]
    },
    {
        "id": "5c3da94a8db50912",
        "type": "ui_slider",
        "z": "d1c583b1ec3b0e75",
        "name": "frostTempInput",
        "label": "Gewünschte Temperatur:",
        "tooltip": "Bitte wählen Sie die gewünschte Temperatur aus.",
        "group": "eb9d04448cbaca04",
        "order": 6,
        "width": 6,
        "height": 1,
        "passthru": true,
        "outs": "end",
        "topic": "topic",
        "topicType": "msg",
        "min": "5",
        "max": "35",
        "step": 1,
        "className": "",
        "x": 890,
        "y": 360,
        "wires": [
            [
                "47c8f7551398a229"
            ]
        ]
    },
    {
        "id": "7fca4d2ca709a131",
        "type": "file",
        "z": "d1c583b1ec3b0e75",
        "name": "",
        "filename": "pekaway/heater_frost_temp",
        "filenameType": "str",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 1290,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "47c8f7551398a229",
        "type": "function",
        "z": "d1c583b1ec3b0e75",
        "name": "set value",
        "func": "if (msg.payload == \"\")\n{\n    msg.payload = \"frostTempInput\"\n}\nglobal.set(\"frostTemp\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1070,
        "y": 360,
        "wires": [
            [
                "7fca4d2ca709a131"
            ]
        ]
    },
    {
        "id": "f0c2974e46d2145e",
        "type": "file in",
        "z": "d1c583b1ec3b0e75",
        "name": "frostTempInput",
        "filename": "pekaway/heater_frost_temp",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 530,
        "y": 360,
        "wires": [
            [
                "e6b5b786bd205b7e"
            ]
        ]
    },
    {
        "id": "fd08c179f2745fbe",
        "type": "inject",
        "z": "d1c583b1ec3b0e75",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 360,
        "y": 360,
        "wires": [
            [
                "f0c2974e46d2145e"
            ]
        ]
    },
    {
        "id": "e6b5b786bd205b7e",
        "type": "function",
        "z": "d1c583b1ec3b0e75",
        "name": "set type",
        "func": "global.set(\"frostTemp\", msg.payload)",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 710,
        "y": 360,
        "wires": [
            [
                "5c3da94a8db50912"
            ]
        ]
    },
    {
        "id": "fd790d092c1085fa",
        "type": "debug",
        "z": "d1c583b1ec3b0e75",
        "name": "debug 229",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1050,
        "y": 260,
        "wires": []
    },
    {
        "id": "cc3d2c874efb6777",
        "type": "function",
        "z": "d1c583b1ec3b0e75",
        "name": "set value",
        "func": "if (msg.payload == \"\")\n{\n    msg.payload = \"frostSollInput\"\n}\nglobal.set(\"frostSoll\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1080,
        "y": 180,
        "wires": [
            [
                "713700692b448440"
            ]
        ]
    },
    {
        "id": "568634d81a52723f",
        "type": "function",
        "z": "d1c583b1ec3b0e75",
        "name": "set value",
        "func": "\nglobal.set(\"frostSoll\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1040,
        "y": 320,
        "wires": [
            [
                "64faafc0630550d1",
                "3aaa1940c497732c"
            ]
        ]
    },
    {
        "id": "64faafc0630550d1",
        "type": "debug",
        "z": "d1c583b1ec3b0e75",
        "name": "debug 231",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1250,
        "y": 260,
        "wires": []
    },
    {
        "id": "f46946888115acb1",
        "type": "debug",
        "z": "d1c583b1ec3b0e75",
        "name": "debug 232",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 690,
        "y": 260,
        "wires": []
    },
    {
        "id": "768ce90d96e276bc",
        "type": "debug",
        "z": "d1c583b1ec3b0e75",
        "name": "debug 233",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 870,
        "y": 260,
        "wires": []
    },
    {
        "id": "713700692b448440",
        "type": "debug",
        "z": "d1c583b1ec3b0e75",
        "name": "debug 234",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1250,
        "y": 180,
        "wires": []
    },
    {
        "id": "6c33cacc9635fd6e",
        "type": "ui_group",
        "name": "Frostschutz",
        "tab": "9f489dc766d06865",
        "order": 6,
        "disp": true,
        "width": "6",
        "collapse": true,
        "className": ""
    },
    {
        "id": "eb9d04448cbaca04",
        "type": "ui_group",
        "name": "Test",
        "tab": "3a3784166e4077aa",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "9f489dc766d06865",
        "type": "ui_tab",
        "name": "Heizung",
        "icon": "mi-whatshot",
        "order": 8,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "3a3784166e4077aa",
        "type": "ui_tab",
        "name": "Test",
        "icon": "dashboard",
        "order": 14,
        "disabled": false,
        "hidden": false
    }
]

1 Like

Okay, am Anfang das set den String in eine Zahl wandeln. Beim zweiten habe ich mir mit dem if im Fall der Null ein Eigentor geschossen. So langsam versteht man das System. Auf jeden Fall dir ein dickes Danke, für deine Hilfe :slight_smile: