Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. Rechnen in Node Red

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Rechnen in Node Red

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

      Hallo,
      mache Gehversuche mit Node Red und würde gerne was Rechnen.

      Ich verstehe aber nicht warum da nur mist bei rum kommt 🤷‍♂️

      Beste Grüße
      Daniel

      [
          {
              "id": "c05d6044.8035e",
              "type": "tab",
              "label": "Flow 1",
              "disabled": false,
              "info": ""
          },
          {
              "id": "a31cc993.a28758",
              "type": "ioBroker get",
              "z": "c05d6044.8035e",
              "name": "Außenfühler Temperature",
              "topic": "zigbee.0.00158d0002ca05ad.temperature",
              "attrname": "Temperatur",
              "payloadType": "value",
              "x": 470,
              "y": 240,
              "wires": [
                  [
                      "8daf2546.310878"
                  ]
              ]
          },
          {
              "id": "345fc725.3bd6d8",
              "type": "ioBroker get",
              "z": "c05d6044.8035e",
              "name": "Außenfühler Humidity",
              "topic": "zigbee.0.00158d0002ca05ad.humidity",
              "attrname": "Luftfeuchte",
              "payloadType": "value",
              "x": 520,
              "y": 380,
              "wires": [
                  [
                      "8daf2546.310878"
                  ]
              ]
          },
          {
              "id": "5626f9b9.f054f8",
              "type": "inject",
              "z": "c05d6044.8035e",
              "name": "",
              "props": [
                  {
                      "p": "payload"
                  },
                  {
                      "p": "topic",
                      "vt": "str"
                  }
              ],
              "repeat": "",
              "crontab": "",
              "once": false,
              "onceDelay": 0.1,
              "topic": "",
              "payload": "",
              "payloadType": "date",
              "x": 420,
              "y": 160,
              "wires": [
                  [
                      "345fc725.3bd6d8",
                      "a31cc993.a28758"
                  ]
              ]
          },
          {
              "id": "8daf2546.310878",
              "type": "function",
              "z": "c05d6044.8035e",
              "name": "Luftfeuchte",
              "func": "var Test = {};\nTest = Number(msg.Luftfeuchte) - Number(msg.Temperatur);\nmsg.payload = Test;\nreturn msg;",
              "outputs": 1,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "x": 810,
              "y": 340,
              "wires": [
                  [
                      "b9c676f0.b95a98"
                  ]
              ]
          },
          {
              "id": "b9c676f0.b95a98",
              "type": "debug",
              "z": "c05d6044.8035e",
              "name": "Ausgabe",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 980,
              "y": 340,
              "wires": []
          }
      ]
      

      Folgende Spukt der Debugger aus:
      2.8.2020, 11:12:40node: Ausgabe
      zigbee.0.00158d0002ca05ad.humidity : msg.payload : number
      NaN
      2.8.2020, 11:12:40node: Ausgabe
      zigbee.0.00158d0002ca05ad.temperature : msg.payload : number
      NaN

      F 1 Reply Last reply Reply Quote 0
      • F
        frankyboy73 @Has3nb3inMH last edited by

        @Has3nb3inMH
        Hi, als erstes musst du die Node in eine Reihe setzten, also hintereinander, dann werden beide Input Node durchlaufen und du bekommst eine Nachricht mit Temperatue und Feuchtigkeit. So wie du die Input Node (parallel) eingefügt hast bekommst du zwei Nachrichten zur Funktion Node, mit jeweils nur Temperatur und nur Feuchtigkeit und mit nur einem Wert kann das nicht berechnet werden. Zudem muss in der Funktion Node noch math für Mathematische Funktion rein.

        [
            {
                "id": "fd168a68.a54ce8",
                "type": "ioBroker get",
                "z": "aa77b2e2.7ea12",
                "name": "Außenfühler Temperature",
                "topic": "zigbee.0.00158d0002ca05ad.temperature",
                "attrname": "Temperatur",
                "payloadType": "value",
                "x": 470,
                "y": 360,
                "wires": [
                    [
                        "32adbecc.66add2"
                    ]
                ]
            },
            {
                "id": "32adbecc.66add2",
                "type": "ioBroker get",
                "z": "aa77b2e2.7ea12",
                "name": "Außenfühler Humidity",
                "topic": "zigbee.0.00158d0002ca05ad.humidity",
                "attrname": "Luftfeuchte",
                "payloadType": "value",
                "x": 660,
                "y": 280,
                "wires": [
                    [
                        "b243e8ca.b1efb8"
                    ]
                ]
            },
            {
                "id": "e5dc2454.e91218",
                "type": "inject",
                "z": "aa77b2e2.7ea12",
                "name": "",
                "props": [
                    {
                        "p": "payload"
                    },
                    {
                        "p": "topic",
                        "vt": "str"
                    }
                ],
                "repeat": "",
                "crontab": "",
                "once": false,
                "onceDelay": 0.1,
                "topic": "",
                "payload": "",
                "payloadType": "date",
                "x": 420,
                "y": 160,
                "wires": [
                    [
                        "fd168a68.a54ce8"
                    ]
                ]
            },
            {
                "id": "b243e8ca.b1efb8",
                "type": "function",
                "z": "aa77b2e2.7ea12",
                "name": "Luftfeuchte",
                "func": "msg.payload = math = Number(msg.Luftfeuchte) - Number(msg.Temperatur);\nreturn msg;\n",
                "outputs": 1,
                "noerr": 0,
                "initialize": "",
                "finalize": "",
                "x": 810,
                "y": 340,
                "wires": [
                    [
                        "a5cbebe5.024d48"
                    ]
                ]
            },
            {
                "id": "a5cbebe5.024d48",
                "type": "debug",
                "z": "aa77b2e2.7ea12",
                "name": "Ausgabe",
                "active": true,
                "tosidebar": true,
                "console": false,
                "tostatus": false,
                "complete": "payload",
                "targetType": "msg",
                "statusVal": "",
                "statusType": "auto",
                "x": 980,
                "y": 340,
                "wires": []
            }
        ]
        
        H 1 Reply Last reply Reply Quote 0
        • H
          Has3nb3inMH @frankyboy73 last edited by

          @frankyboy73 vielen Dank. Es hat genügt die Reihenfolge zu ändern.
          Das leben könnte so einfach sein. 😊

          F 1 Reply Last reply Reply Quote 0
          • F
            frankyboy73 @Has3nb3inMH last edited by

            @Has3nb3inMH
            Ah, ok, ich dachte man müsste immer mit "math" arbeiten. Werde es mal ohne testen. Danke für die Rückmeldung. Schön das es jetzt bei dir funktioniert.

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

            Support us

            ioBroker
            Community Adapters
            Donate

            1.1k
            Online

            31.7k
            Users

            79.7k
            Topics

            1.3m
            Posts

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