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. Function Node welche zwei Werte vergleicht

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    Function Node welche zwei Werte vergleicht

    This topic has been deleted. Only users with topic management privileges can see it.
    • mickym
      mickym Most Active @milanissimo last edited by mickym

      @milanissimo Ich finde es zwar Käse solche Dinge mit function Nodes zu machen - zudem Du - mit Verlaub - noch Änfänger bzw. Javscript zu sein scheinst.

      Im Prinzip - auch wenn ich den Gebrauch von function Nodes als Unsinn empfinde würde es funktionieren,
      wenn Du der payload auch tatsächlich ein Boolean zuweisen würdest.

      msg.payload === false;
      

      das ist keine Zuweisung - sondern man benutzt das als Vergleich

      ändere es mal in

      msg.payload =false;
      

      Mit dieser Änderung alleine, würde Dein Code schon funktionieren - auch wenn es vielleicht nicht die schönste Lösung ist.

      var heizdif = flow.get('heizdif'); 
      var wwdif = flow.get('wwdif');
      msg.heizdif = heizdif;
      msg.wwdif = wwdif;
      if (msg.heizdif > 20 && msg.wwdif > 5) {
      msg.payload = true;
      }
      else {
      msg.payload = false;
      }
      return msg;
      

      =====================================================================================

      Auch solche Dinge sind doch Unsinn:

      msg.heizdif = heizdif;
      msg.wwdif = wwdif;
      if (msg.heizdif > 20 && msg.wwdif > 5) {
      

      Du brauchst doch den Inhalt der Variablen nicht zu Bestandteilen des Nachrichtenobjektes machen, wenn Dich eh nur die payload später interessiert. Dann kannst auch direkt vergleichen:

      
      if (heizdif > 20 && wwdif > 5) {
      

      Schau Dir mal diese Basics in Javascript an: https://www.w3schools.com/js/js_operators.asp

      Das sind Zuweisungs-Operatoren:

      e80e7d19-2a10-49a2-813b-6184fb881c9f-image.png

      und das sind Vergleichs-Operatoren:

      46efe0cb-f7f0-476f-bdff-a5e9e662250c-image.png

      Diese Zeile

      msg.payload === false;
      

      ist somit immer false, wenn die payload nicht false ist. Damit machst Du aber auch nichts.

      Ist das gleiche, wie wenn Du in Deinen Code

      false;
      

      schreiben würdest.

      Ich werde auch nicht verstehen, warum Du Code schreiben willst, wenn Du NodeRed benutzt.

      =====================================================================================

      Zum Schluss will ich Dir trotzdem noch zeigen, wie man das Ganze mit Deiner Logik auch ohne function Node und ohne Code zu schreiben umsetzen kann:

      e1d5fb9c-eca2-4a30-87d1-7fce447b8fa4-image.png

      [
         {
             "id": "b065417068e26386",
             "type": "change",
             "z": "0d30e281996aaebd",
             "name": "",
             "rules": [
                 {
                     "t": "move",
                     "p": "payload",
                     "pt": "msg",
                     "to": "wwdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "wwdif",
                     "pt": "flow",
                     "to": "wwdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "heizdif",
                     "pt": "msg",
                     "to": "heizdif",
                     "tot": "flow"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 870,
             "y": 560,
             "wires": [
                 [
                     "42abd2fecf659b8d"
                 ]
             ]
         },
         {
             "id": "44a30c20f9a153e6",
             "type": "change",
             "z": "0d30e281996aaebd",
             "name": "",
             "rules": [
                 {
                     "t": "move",
                     "p": "payload",
                     "pt": "msg",
                     "to": "heizdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "heizdif",
                     "pt": "flow",
                     "to": "heizdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "wwdif",
                     "pt": "msg",
                     "to": "wwdif",
                     "tot": "flow"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 870,
             "y": 500,
             "wires": [
                 [
                     "42abd2fecf659b8d"
                 ]
             ]
         },
         {
             "id": "f0c2e0d3753c0549",
             "type": "inject",
             "z": "0d30e281996aaebd",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "6",
             "payloadType": "num",
             "x": 630,
             "y": 560,
             "wires": [
                 [
                     "b065417068e26386"
                 ]
             ]
         },
         {
             "id": "9822534383101b8a",
             "type": "debug",
             "z": "0d30e281996aaebd",
             "name": "",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": false,
             "complete": "false",
             "statusVal": "",
             "statusType": "auto",
             "x": 1430,
             "y": 520,
             "wires": []
         },
         {
             "id": "6c40bb7ab28ef804",
             "type": "inject",
             "z": "0d30e281996aaebd",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "30",
             "payloadType": "num",
             "x": 630,
             "y": 500,
             "wires": [
                 [
                     "44a30c20f9a153e6"
                 ]
             ]
         },
         {
             "id": "a93efb39ddd6888c",
             "type": "trigger",
             "z": "0d30e281996aaebd",
             "name": "",
             "op1": "on",
             "op2": "off",
             "op1type": "str",
             "op2type": "str",
             "duration": "10",
             "extend": false,
             "overrideDelay": false,
             "units": "min",
             "reset": "",
             "bytopic": "all",
             "topic": "topic",
             "outputs": 1,
             "x": 1240,
             "y": 520,
             "wires": [
                 [
                     "9822534383101b8a"
                 ]
             ]
         },
         {
             "id": "42abd2fecf659b8d",
             "type": "switch",
             "z": "0d30e281996aaebd",
             "name": "",
             "property": "heizdif > 20 and wwdif > 5",
             "propertyType": "jsonata",
             "rules": [
                 {
                     "t": "true"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 1,
             "x": 1070,
             "y": 520,
             "wires": [
                 [
                     "a93efb39ddd6888c"
                 ]
             ]
         }
      ]
      

      Nun kann man ja der Meinung sein, dass JSONATA - ja auch schon Code schreiben ist.

      heizdif > 20 and wwdif > 5
      

      So einer UND Verknüpfung kann man natürlich auch mit 2 Switch Nodes (als Bedingung) hintereinander schalten. Sprich das Nachrichtenobjekt muss beide Nodes hintereinander passieren, um die Trigger Node zu erreichen.

      0cf6ec62-4241-4857-8887-bd8f3d1bdca4-image.png

      Bei einer ODER Verknüpfung würde man 2 Switch Nodes parallel schalten. Hier könnte dann die Nachricht entweder den EINEN oder ANDEREN Weg nehmen.

      b3c1b713-898b-4ff1-936f-e67d2e2fc660-image.png

      So würde das dann quasi ganz ohne Code aussehen:

      002399a8-ac02-4049-b7a0-6c74dc077dd2-image.png

      [
         {
             "id": "b065417068e26386",
             "type": "change",
             "z": "289f539dcc33814e",
             "name": "",
             "rules": [
                 {
                     "t": "move",
                     "p": "payload",
                     "pt": "msg",
                     "to": "wwdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "wwdif",
                     "pt": "flow",
                     "to": "wwdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "heizdif",
                     "pt": "msg",
                     "to": "heizdif",
                     "tot": "flow"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 410,
             "y": 4240,
             "wires": [
                 [
                     "966a3831e87a8c2c"
                 ]
             ]
         },
         {
             "id": "44a30c20f9a153e6",
             "type": "change",
             "z": "289f539dcc33814e",
             "name": "",
             "rules": [
                 {
                     "t": "move",
                     "p": "payload",
                     "pt": "msg",
                     "to": "heizdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "heizdif",
                     "pt": "flow",
                     "to": "heizdif",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "wwdif",
                     "pt": "msg",
                     "to": "wwdif",
                     "tot": "flow"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 410,
             "y": 4180,
             "wires": [
                 [
                     "966a3831e87a8c2c"
                 ]
             ]
         },
         {
             "id": "f0c2e0d3753c0549",
             "type": "inject",
             "z": "289f539dcc33814e",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "6",
             "payloadType": "num",
             "x": 170,
             "y": 4240,
             "wires": [
                 [
                     "b065417068e26386"
                 ]
             ]
         },
         {
             "id": "6c40bb7ab28ef804",
             "type": "inject",
             "z": "289f539dcc33814e",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "30",
             "payloadType": "num",
             "x": 170,
             "y": 4180,
             "wires": [
                 [
                     "44a30c20f9a153e6"
                 ]
             ]
         },
         {
             "id": "9822534383101b8a",
             "type": "debug",
             "z": "289f539dcc33814e",
             "name": "",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": false,
             "complete": "false",
             "statusVal": "",
             "statusType": "auto",
             "x": 1170,
             "y": 4220,
             "wires": []
         },
         {
             "id": "a93efb39ddd6888c",
             "type": "trigger",
             "z": "289f539dcc33814e",
             "name": "",
             "op1": "on",
             "op2": "off",
             "op1type": "str",
             "op2type": "str",
             "duration": "10",
             "extend": false,
             "overrideDelay": false,
             "units": "min",
             "reset": "",
             "bytopic": "all",
             "topic": "topic",
             "outputs": 1,
             "x": 980,
             "y": 4220,
             "wires": [
                 [
                     "9822534383101b8a"
                 ]
             ]
         },
         {
             "id": "42abd2fecf659b8d",
             "type": "switch",
             "z": "289f539dcc33814e",
             "name": "wwdif > 5",
             "property": "wwdif",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "gt",
                     "v": "5",
                     "vt": "num"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 1,
             "x": 800,
             "y": 4220,
             "wires": [
                 [
                     "a93efb39ddd6888c"
                 ]
             ]
         },
         {
             "id": "966a3831e87a8c2c",
             "type": "switch",
             "z": "289f539dcc33814e",
             "name": "heizdif > 20",
             "property": "heizdif",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "gt",
                     "v": "20",
                     "vt": "num"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 1,
             "x": 630,
             "y": 4220,
             "wires": [
                 [
                     "42abd2fecf659b8d"
                 ]
             ]
         }
      ]
      

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

        Wieder mal schade. Man gibt sich Mühe - was zu erklären und dann gibts nicht mal eine Rückmeldung. - Eigentlich sollte man solche User auf Ignore setzen.

        1 Reply Last reply Reply Quote 2
        • C
          csh-de last edited by

          Dann sage ich DANKE, hatte eine Fragestellung zum Batterieladen mit PV Überschuss bzw. wenn Batterie unter 11Volt fällt zwangsladen auf zumindest 12V.

          Ist nicht perfekt aber es geht, für Verbesserungen bin ich dankbar.

          klappt gut:

          [
              {
                  "id": "72c67f517a573034",
                  "type": "tab",
                  "label": "Batterieladen Steckdose",
                  "disabled": false,
                  "info": "",
                  "env": []
              },
              {
                  "id": "2d01dc6403d94a3a",
                  "type": "change",
                  "z": "72c67f517a573034",
                  "name": "",
                  "rules": [
                      {
                          "t": "move",
                          "p": "payload",
                          "pt": "msg",
                          "to": "wwdif",
                          "tot": "msg"
                      },
                      {
                          "t": "set",
                          "p": "wwdif",
                          "pt": "flow",
                          "to": "wwdif",
                          "tot": "msg"
                      },
                      {
                          "t": "set",
                          "p": "heizdif",
                          "pt": "msg",
                          "to": "heizdif",
                          "tot": "flow"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 290,
                  "y": 400,
                  "wires": [
                      [
                          "0ad5b4d399c61de6",
                          "1d719c85322bf761",
                          "dcbc48c6da9cc23f",
                          "ef33073bdbaf2f1a"
                      ]
                  ]
              },
              {
                  "id": "97c097951912333f",
                  "type": "change",
                  "z": "72c67f517a573034",
                  "name": "",
                  "rules": [
                      {
                          "t": "move",
                          "p": "payload",
                          "pt": "msg",
                          "to": "heizdif",
                          "tot": "msg"
                      },
                      {
                          "t": "set",
                          "p": "heizdif",
                          "pt": "flow",
                          "to": "heizdif",
                          "tot": "msg"
                      },
                      {
                          "t": "set",
                          "p": "wwdif",
                          "pt": "msg",
                          "to": "wwdif",
                          "tot": "flow"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 290,
                  "y": 340,
                  "wires": [
                      [
                          "0ad5b4d399c61de6",
                          "dcbc48c6da9cc23f",
                          "ef33073bdbaf2f1a"
                      ]
                  ]
              },
              {
                  "id": "b9f39f2b57132328",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "14.3",
                  "payloadType": "num",
                  "x": 110,
                  "y": 440,
                  "wires": [
                      [
                          "2d01dc6403d94a3a"
                      ]
                  ]
              },
              {
                  "id": "0a913206124826cb",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "4444",
                  "payloadType": "num",
                  "x": 110,
                  "y": 340,
                  "wires": [
                      [
                          "97c097951912333f"
                      ]
                  ]
              },
              {
                  "id": "949129cc76b54963",
                  "type": "debug",
                  "z": "72c67f517a573034",
                  "name": "debug",
                  "active": false,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "payload",
                  "targetType": "msg",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 1210,
                  "y": 440,
                  "wires": []
              },
              {
                  "id": "03546add79dfe5e0",
                  "type": "trigger",
                  "z": "72c67f517a573034",
                  "name": "an",
                  "op1": "on",
                  "op2": "on",
                  "op1type": "str",
                  "op2type": "str",
                  "duration": "1",
                  "extend": false,
                  "overrideDelay": false,
                  "units": "s",
                  "reset": "",
                  "bytopic": "topic",
                  "topic": "playload",
                  "outputs": 1,
                  "x": 950,
                  "y": 340,
                  "wires": [
                      [
                          "949129cc76b54963",
                          "4e5501b96de32957"
                      ]
                  ]
              },
              {
                  "id": "385c7e664c0eedeb",
                  "type": "switch",
                  "z": "72c67f517a573034",
                  "name": "Batterie unter 14,8Volt",
                  "property": "wwdif",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "lte",
                          "v": "14.8",
                          "vt": "num"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 1,
                  "x": 740,
                  "y": 340,
                  "wires": [
                      [
                          "03546add79dfe5e0"
                      ]
                  ]
              },
              {
                  "id": "0ad5b4d399c61de6",
                  "type": "switch",
                  "z": "72c67f517a573034",
                  "name": "über 800Watt",
                  "property": "heizdif",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "gt",
                          "v": "800",
                          "vt": "num"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 1,
                  "x": 520,
                  "y": 340,
                  "wires": [
                      [
                          "385c7e664c0eedeb"
                      ]
                  ]
              },
              {
                  "id": "882c6cfb98dac2c8",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "14.9",
                  "payloadType": "num",
                  "x": 110,
                  "y": 400,
                  "wires": [
                      [
                          "2d01dc6403d94a3a"
                      ]
                  ]
              },
              {
                  "id": "7e14fa1a362fa1a8",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "444",
                  "payloadType": "num",
                  "x": 110,
                  "y": 300,
                  "wires": [
                      [
                          "97c097951912333f"
                      ]
                  ]
              },
              {
                  "id": "dcbc48c6da9cc23f",
                  "type": "switch",
                  "z": "72c67f517a573034",
                  "name": "Batterie über 14,8Volt",
                  "property": "wwdif",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "gte",
                          "v": "14.8",
                          "vt": "num"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 1,
                  "x": 740,
                  "y": 460,
                  "wires": [
                      [
                          "b20b2758e7e2a66c"
                      ]
                  ]
              },
              {
                  "id": "1d719c85322bf761",
                  "type": "switch",
                  "z": "72c67f517a573034",
                  "name": "unter 800Watt",
                  "property": "heizdif",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "lt",
                          "v": "800",
                          "vt": "num"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 1,
                  "x": 520,
                  "y": 400,
                  "wires": [
                      [
                          "0c3e2ef811f1afbd"
                      ]
                  ]
              },
              {
                  "id": "b20b2758e7e2a66c",
                  "type": "trigger",
                  "z": "72c67f517a573034",
                  "name": "aus",
                  "op1": "off",
                  "op2": "off",
                  "op1type": "str",
                  "op2type": "str",
                  "duration": "1",
                  "extend": false,
                  "overrideDelay": false,
                  "units": "s",
                  "reset": "",
                  "bytopic": "all",
                  "topic": "topic",
                  "outputs": 1,
                  "x": 950,
                  "y": 400,
                  "wires": [
                      [
                          "949129cc76b54963",
                          "4e5501b96de32957"
                      ]
                  ]
              },
              {
                  "id": "0c3e2ef811f1afbd",
                  "type": "switch",
                  "z": "72c67f517a573034",
                  "name": "Batterie über 12Volt",
                  "property": "wwdif",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "gte",
                          "v": "12",
                          "vt": "num"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 1,
                  "x": 730,
                  "y": 400,
                  "wires": [
                      [
                          "b20b2758e7e2a66c"
                      ]
                  ]
              },
              {
                  "id": "242de0a519521809",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "11.8",
                  "payloadType": "num",
                  "x": 110,
                  "y": 520,
                  "wires": [
                      [
                          "2d01dc6403d94a3a"
                      ]
                  ]
              },
              {
                  "id": "ef33073bdbaf2f1a",
                  "type": "switch",
                  "z": "72c67f517a573034",
                  "name": "Batterie unter 10Volt",
                  "property": "wwdif",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "lte",
                          "v": "10",
                          "vt": "num"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 1,
                  "x": 740,
                  "y": 520,
                  "wires": [
                      [
                          "03546add79dfe5e0"
                      ]
                  ]
              },
              {
                  "id": "9b0d01c762ab6bbf",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "10",
                  "payloadType": "num",
                  "x": 110,
                  "y": 560,
                  "wires": [
                      [
                          "2d01dc6403d94a3a"
                      ]
                  ]
              },
              {
                  "id": "017a8065f8fc42da",
                  "type": "inject",
                  "z": "72c67f517a573034",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "12.1",
                  "payloadType": "num",
                  "x": 110,
                  "y": 480,
                  "wires": [
                      [
                          "2d01dc6403d94a3a"
                      ]
                  ]
              },
              {
                  "id": "4e5501b96de32957",
                  "type": "mqtt out",
                  "z": "72c67f517a573034",
                  "name": "",
                  "topic": "cmnd/Nous_Steckdose_1/POWER",
                  "qos": "0",
                  "retain": "",
                  "respTopic": "",
                  "contentType": "",
                  "userProps": "",
                  "correl": "",
                  "expiry": "",
                  "broker": "e9940ef89fc0f548",
                  "x": 1220,
                  "y": 340,
                  "wires": []
              },
              {
                  "id": "e9940ef89fc0f548",
                  "type": "mqtt-broker",
                  "name": "",
                  "broker": "192.168.178.153",
                  "port": "1883",
                  "clientid": "",
                  "autoConnect": true,
                  "usetls": false,
                  "protocolVersion": "4",
                  "keepalive": "60",
                  "cleansession": true,
                  "birthTopic": "",
                  "birthQos": "0",
                  "birthPayload": "",
                  "birthMsg": {},
                  "closeTopic": "",
                  "closeQos": "0",
                  "closePayload": "",
                  "closeMsg": {},
                  "willTopic": "",
                  "willQos": "0",
                  "willPayload": "",
                  "willMsg": {},
                  "userProps": "",
                  "sessionExpiry": ""
              }
          ]
          
          1 Reply Last reply Reply Quote 0
          • 1
            1984chris last edited by

            Hallo
            Hätte dazu eine Frage:
            Wie kann ich den Trigger wenn er läuft wieder zurücksetzen wenn heizdif" größer als 20 und der Flow wwdif größer als 5 ist?

            Danke im Voraus

            LG Christoph

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

              @1984chris Steht doch in der Node - entweder eine bestimmte payload oder msg.reset an die trigger Node senden.

              1 Reply Last reply Reply Quote 0
              • 1
                1984chris last edited by

                Danke für die schnelle Antwort.
                wie funktioniert das wenn ich z.b heizdif größer 20 oder wwdif größer 5 den reset senden soll?

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

                  @1984chris sagte in Function Node welche zwei Werte vergleicht:

                  Danke für die schnelle Antwort.
                  wie funktioniert das wenn ich z.b heizdif größer 20 oder wwdif größer 5 den reset senden soll?

                  Na wenn Du programmierst, dann machst Du doch eh aus der payload true oder false

                  if (msg.heizdif > 20 && msg.wwdif > 5) {
                  msg.payload = true;
                  }
                  else {
                  msg.payload = false;
                  }
                  return msg;
                  

                  dann resettest Du die trigger Node in dem Du halt bei payload=false den trigger zurücksetzt.

                  6cc1ba58-71cc-4d0f-839f-cf45c27482d0-image.png

                  1 Reply Last reply Reply Quote 0
                  • 1
                    1984chris last edited by

                    Entschuldigung meinte ein Delay (Verzögerung von ca 5 sek) zurücksetzen.
                    Will mir gerade einen Flow zusammenstöpseln für eine Wärmepumpe beim pool wenn ich PV Überschuss habe.

                    mickym 1 Reply Last reply Reply Quote 0
                    • 1
                      1984chris last edited by

                      Das wäre mein Flow klappt aber nicht ganz
                      kannst du mir da weiterhelfen?

                      [
                          {
                              "id": "b7365eb2cd9f043a",
                              "type": "tab",
                              "label": "Flow 1",
                              "disabled": false,
                              "info": "",
                              "env": []
                          },
                          {
                              "id": "676fdaa5ab37f82c",
                              "type": "junction",
                              "z": "b7365eb2cd9f043a",
                              "x": 440,
                              "y": 240,
                              "wires": [
                                  []
                              ]
                          },
                          {
                              "id": "106c2bd2ab4d7271",
                              "type": "change",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "rules": [
                                  {
                                      "t": "move",
                                      "p": "payload",
                                      "pt": "msg",
                                      "to": "SOC",
                                      "tot": "msg"
                                  },
                                  {
                                      "t": "set",
                                      "p": "SOC",
                                      "pt": "flow",
                                      "to": "SOC",
                                      "tot": "msg"
                                  },
                                  {
                                      "t": "set",
                                      "p": "Einspeisung",
                                      "pt": "msg",
                                      "to": "Einspeisung",
                                      "tot": "flow"
                                  },
                                  {
                                      "t": "set",
                                      "p": "AutoEin",
                                      "pt": "msg",
                                      "to": "AutoEin",
                                      "tot": "flow"
                                  }
                              ],
                              "action": "",
                              "property": "",
                              "from": "",
                              "to": "",
                              "reg": false,
                              "x": 350,
                              "y": 340,
                              "wires": [
                                  [
                                      "6f43630b1e5bffa6",
                                      "69721ab08dff22a4"
                                  ]
                              ]
                          },
                          {
                              "id": "fad797de2d4263e2",
                              "type": "change",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "rules": [
                                  {
                                      "t": "move",
                                      "p": "payload",
                                      "pt": "msg",
                                      "to": "Einspeisung",
                                      "tot": "msg"
                                  },
                                  {
                                      "t": "set",
                                      "p": "Einspeisung",
                                      "pt": "flow",
                                      "to": "Einspeisung",
                                      "tot": "msg"
                                  },
                                  {
                                      "t": "set",
                                      "p": "SOC",
                                      "pt": "msg",
                                      "to": "SOC",
                                      "tot": "flow"
                                  },
                                  {
                                      "t": "set",
                                      "p": "AutoEin",
                                      "pt": "msg",
                                      "to": "AutoEin",
                                      "tot": "flow"
                                  }
                              ],
                              "action": "",
                              "property": "",
                              "from": "",
                              "to": "",
                              "reg": false,
                              "x": 350,
                              "y": 240,
                              "wires": [
                                  [
                                      "6f43630b1e5bffa6",
                                      "a19ce5e257844c73"
                                  ]
                              ]
                          },
                          {
                              "id": "89741e6a3495365a",
                              "type": "inject",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "props": [
                                  {
                                      "p": "payload"
                                  }
                              ],
                              "repeat": "",
                              "crontab": "",
                              "once": false,
                              "onceDelay": 0.1,
                              "topic": "",
                              "payload": "81",
                              "payloadType": "num",
                              "x": 130,
                              "y": 340,
                              "wires": [
                                  [
                                      "106c2bd2ab4d7271"
                                  ]
                              ]
                          },
                          {
                              "id": "70f02e1808782e01",
                              "type": "inject",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "props": [
                                  {
                                      "p": "payload"
                                  }
                              ],
                              "repeat": "",
                              "crontab": "",
                              "once": false,
                              "onceDelay": 0.1,
                              "topic": "",
                              "payload": "2600",
                              "payloadType": "num",
                              "x": 130,
                              "y": 220,
                              "wires": [
                                  [
                                      "fad797de2d4263e2"
                                  ]
                              ]
                          },
                          {
                              "id": "41cdc59d895451f9",
                              "type": "switch",
                              "z": "b7365eb2cd9f043a",
                              "name": "SOC > 80%",
                              "property": "SOC",
                              "propertyType": "msg",
                              "rules": [
                                  {
                                      "t": "gt",
                                      "v": "80",
                                      "vt": "num"
                                  }
                              ],
                              "checkall": "true",
                              "repair": false,
                              "outputs": 1,
                              "x": 970,
                              "y": 220,
                              "wires": [
                                  [
                                      "ddb53c0fd9b14566"
                                  ]
                              ]
                          },
                          {
                              "id": "6f43630b1e5bffa6",
                              "type": "switch",
                              "z": "b7365eb2cd9f043a",
                              "name": "Einspeiseleistung > 2500W",
                              "property": "Einspeisung",
                              "propertyType": "msg",
                              "rules": [
                                  {
                                      "t": "gt",
                                      "v": "2500",
                                      "vt": "num"
                                  }
                              ],
                              "checkall": "true",
                              "repair": false,
                              "outputs": 1,
                              "x": 740,
                              "y": 220,
                              "wires": [
                                  [
                                      "41cdc59d895451f9"
                                  ]
                              ]
                          },
                          {
                              "id": "15c823b03fb41d53",
                              "type": "inject",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "props": [
                                  {
                                      "p": "payload"
                                  }
                              ],
                              "repeat": "",
                              "crontab": "",
                              "once": false,
                              "onceDelay": 0.1,
                              "topic": "",
                              "payload": "79",
                              "payloadType": "num",
                              "x": 130,
                              "y": 380,
                              "wires": [
                                  [
                                      "106c2bd2ab4d7271"
                                  ]
                              ]
                          },
                          {
                              "id": "30202f2f9c2edc68",
                              "type": "inject",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "props": [
                                  {
                                      "p": "payload"
                                  }
                              ],
                              "repeat": "",
                              "crontab": "",
                              "once": false,
                              "onceDelay": 0.1,
                              "topic": "",
                              "payload": "2300",
                              "payloadType": "num",
                              "x": 130,
                              "y": 260,
                              "wires": [
                                  [
                                      "fad797de2d4263e2"
                                  ]
                              ]
                          },
                          {
                              "id": "590c95b73bcb4f31",
                              "type": "delay",
                              "z": "b7365eb2cd9f043a",
                              "name": "5 sek ",
                              "pauseType": "delayv",
                              "timeout": "5",
                              "timeoutUnits": "seconds",
                              "rate": "1",
                              "nbRateUnits": "1",
                              "rateUnits": "second",
                              "randomFirst": "1",
                              "randomLast": "5",
                              "randomUnits": "seconds",
                              "drop": false,
                              "allowrate": false,
                              "outputs": 1,
                              "x": 1110,
                              "y": 360,
                              "wires": [
                                  [
                                      "d74366116650e8db"
                                  ]
                              ]
                          },
                          {
                              "id": "7fcd987717f18e60",
                              "type": "change",
                              "z": "b7365eb2cd9f043a",
                              "name": "Reset Verzögerung wenn PV überschuss wieder größer als Abschaltung",
                              "rules": [
                                  {
                                      "t": "set",
                                      "p": "reset",
                                      "pt": "msg",
                                      "to": "",
                                      "tot": "str"
                                  }
                              ],
                              "action": "",
                              "property": "",
                              "from": "",
                              "to": "",
                              "reg": false,
                              "x": 840,
                              "y": 500,
                              "wires": [
                                  [
                                      "590c95b73bcb4f31"
                                  ]
                              ]
                          },
                          {
                              "id": "e48419cce5a53fc5",
                              "type": "change",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "rules": [
                                  {
                                      "t": "move",
                                      "p": "payload",
                                      "pt": "msg",
                                      "to": "AutoEin",
                                      "tot": "msg"
                                  },
                                  {
                                      "t": "set",
                                      "p": "AutoEin",
                                      "pt": "flow",
                                      "to": "AutoEin",
                                      "tot": "msg"
                                  },
                                  {
                                      "t": "set",
                                      "p": "SOC",
                                      "pt": "msg",
                                      "to": "SOC",
                                      "tot": "flow"
                                  },
                                  {
                                      "t": "set",
                                      "p": "Einspeisung",
                                      "pt": "msg",
                                      "to": "Einspeisung",
                                      "tot": "flow"
                                  }
                              ],
                              "action": "",
                              "property": "",
                              "from": "",
                              "to": "",
                              "reg": false,
                              "x": 350,
                              "y": 160,
                              "wires": [
                                  [
                                      "6f43630b1e5bffa6",
                                      "c2e0449225b14c6d"
                                  ]
                              ]
                          },
                          {
                              "id": "ddb53c0fd9b14566",
                              "type": "switch",
                              "z": "b7365eb2cd9f043a",
                              "name": "Auto Ein/Aus",
                              "property": "AutoEin",
                              "propertyType": "msg",
                              "rules": [
                                  {
                                      "t": "cont",
                                      "v": "AutoEin",
                                      "vt": "str"
                                  }
                              ],
                              "checkall": "true",
                              "repair": false,
                              "outputs": 1,
                              "x": 1170,
                              "y": 220,
                              "wires": [
                                  [
                                      "beffdf77c0512e49",
                                      "7fcd987717f18e60"
                                  ]
                              ]
                          },
                          {
                              "id": "a19ce5e257844c73",
                              "type": "switch",
                              "z": "b7365eb2cd9f043a",
                              "name": "Einspeisung <2500",
                              "property": "Einspeisung",
                              "propertyType": "msg",
                              "rules": [
                                  {
                                      "t": "lt",
                                      "v": "2500",
                                      "vt": "str"
                                  }
                              ],
                              "checkall": "true",
                              "repair": false,
                              "outputs": 1,
                              "x": 710,
                              "y": 320,
                              "wires": [
                                  [
                                      "590c95b73bcb4f31"
                                  ]
                              ]
                          },
                          {
                              "id": "69721ab08dff22a4",
                              "type": "switch",
                              "z": "b7365eb2cd9f043a",
                              "name": "SOC <80",
                              "property": "SOC",
                              "propertyType": "msg",
                              "rules": [
                                  {
                                      "t": "lte",
                                      "v": "80",
                                      "vt": "str"
                                  }
                              ],
                              "checkall": "true",
                              "repair": false,
                              "outputs": 1,
                              "x": 680,
                              "y": 360,
                              "wires": [
                                  [
                                      "590c95b73bcb4f31"
                                  ]
                              ]
                          },
                          {
                              "id": "c2e0449225b14c6d",
                              "type": "switch",
                              "z": "b7365eb2cd9f043a",
                              "name": "Auto Ein/Aus",
                              "property": "AutoEin",
                              "propertyType": "msg",
                              "rules": [
                                  {
                                      "t": "cont",
                                      "v": "AutoAus",
                                      "vt": "str"
                                  }
                              ],
                              "checkall": "true",
                              "repair": false,
                              "outputs": 1,
                              "x": 690,
                              "y": 280,
                              "wires": [
                                  [
                                      "590c95b73bcb4f31"
                                  ]
                              ]
                          },
                          {
                              "id": "9798baeaeaa55b49",
                              "type": "inject",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "props": [
                                  {
                                      "p": "payload"
                                  },
                                  {
                                      "p": "topic",
                                      "vt": "str"
                                  }
                              ],
                              "repeat": "",
                              "crontab": "",
                              "once": false,
                              "onceDelay": 0.1,
                              "topic": "AutoEin",
                              "payload": "AutoEin",
                              "payloadType": "str",
                              "x": 120,
                              "y": 140,
                              "wires": [
                                  [
                                      "e48419cce5a53fc5"
                                  ]
                              ]
                          },
                          {
                              "id": "14201be83d6b7071",
                              "type": "inject",
                              "z": "b7365eb2cd9f043a",
                              "name": "",
                              "props": [
                                  {
                                      "p": "payload"
                                  },
                                  {
                                      "p": "topic",
                                      "vt": "str"
                                  }
                              ],
                              "repeat": "",
                              "crontab": "",
                              "once": false,
                              "onceDelay": 0.1,
                              "topic": "",
                              "payload": "AutoAus",
                              "payloadType": "str",
                              "x": 100,
                              "y": 180,
                              "wires": [
                                  [
                                      "e48419cce5a53fc5"
                                  ]
                              ]
                          },
                          {
                              "id": "f712bce41f284baa",
                              "type": "comment",
                              "z": "b7365eb2cd9f043a",
                              "name": "Wenn AutoEin Einspeisung >2500W + SOC Batterie >80%  WP ein /  Wenn AutoEin Aus Einpeisung <2500W + SOC Batterie <80%  WP Aus",
                              "info": "",
                              "x": 940,
                              "y": 60,
                              "wires": []
                          },
                          {
                              "id": "8a3f49466eef2629",
                              "type": "debug",
                              "z": "b7365eb2cd9f043a",
                              "name": "debug 15",
                              "active": true,
                              "tosidebar": true,
                              "console": false,
                              "tostatus": false,
                              "complete": "payload",
                              "targetType": "msg",
                              "statusVal": "",
                              "statusType": "auto",
                              "x": 1600,
                              "y": 140,
                              "wires": []
                          },
                          {
                              "id": "415e408af464ee3f",
                              "type": "delay",
                              "z": "b7365eb2cd9f043a",
                              "name": "5 sek ",
                              "pauseType": "delayv",
                              "timeout": "5",
                              "timeoutUnits": "seconds",
                              "rate": "1",
                              "nbRateUnits": "1",
                              "rateUnits": "second",
                              "randomFirst": "1",
                              "randomLast": "5",
                              "randomUnits": "seconds",
                              "drop": false,
                              "allowrate": false,
                              "outputs": 1,
                              "x": 1570,
                              "y": 400,
                              "wires": [
                                  [
                                      "8a3f49466eef2629"
                                  ]
                              ]
                          },
                          {
                              "id": "d74366116650e8db",
                              "type": "trigger",
                              "z": "b7365eb2cd9f043a",
                              "name": "Schalter Aus",
                              "op1": "Pumpe Aus 0",
                              "op2": "",
                              "op1type": "str",
                              "op2type": "nul",
                              "duration": "1",
                              "extend": false,
                              "overrideDelay": false,
                              "units": "s",
                              "reset": "",
                              "bytopic": "all",
                              "topic": "topic",
                              "outputs": 1,
                              "x": 1370,
                              "y": 320,
                              "wires": [
                                  [
                                      "415e408af464ee3f"
                                  ]
                              ]
                          },
                          {
                              "id": "beffdf77c0512e49",
                              "type": "trigger",
                              "z": "b7365eb2cd9f043a",
                              "name": "Schalter Ein",
                              "op1": "Pumpe Ein 1",
                              "op2": "",
                              "op1type": "str",
                              "op2type": "nul",
                              "duration": "250",
                              "extend": false,
                              "overrideDelay": false,
                              "units": "ms",
                              "reset": "",
                              "bytopic": "all",
                              "topic": "topic",
                              "outputs": 1,
                              "x": 1410,
                              "y": 220,
                              "wires": [
                                  [
                                      "8a3f49466eef2629"
                                  ]
                              ]
                          },
                          {
                              "id": "6bbe0fa685697ec3",
                              "type": "comment",
                              "z": "b7365eb2cd9f043a",
                              "name": "Wenn  Einspeisung >2500W + SOC Batterie >80% dann reser Verzögerung aber wie?",
                              "info": "",
                              "x": 880,
                              "y": 560,
                              "wires": []
                          }
                      ]
                      
                      mickym 1 Reply Last reply Reply Quote 0
                      • mickym
                        mickym Most Active @1984chris last edited by mickym

                        @1984chris Nun ehrlich gesagt funktioniert das doch grundsätzlich:

                        14e2c836-2845-44c9-8b74-2d455ca1e159-image.png

                        Was problematisch ist, dass Du für die verschiedenen Nachrichteneigenschaften x- Nachrichten hast. Damit hast Du ggf. viele Probleme. Ich würde mit den Inject nodes alles erst mal in den Kontext zu speichern und diesen dann auszulesen. Dann wird das ganze viel übersichtlicher. Also das triggern des Flows von dem Kontext erst mal zu trennen.

                        Ich versuch das mal bissi zu vereinfachen, wobei ich Deine 2 Delays auch nicht ganz verstehe.

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

                          @1984chris Mal eine blöde Frage - was sollen die Trigger Nodes überhaupt und warum nutzt du wenn nicht nur trigger Nodes?

                          So ich bin mir zwar nicht sicher, was der Sinn ist - ggf. willst Du ja nur kurzfristige Unterbrechungen vermeiden.

                          Schau mal, ob das so tut:

                          7b5580b3-d45f-44cd-bbb8-789fd4627711-image.png

                          [{"id":"a86c1f1e4b75e441","type":"inject","z":"b7365eb2cd9f043a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"81","payloadType":"num","x":170,"y":920,"wires":[["494bb9361ae7bea3"]]},{"id":"f18c81168d9f50a0","type":"inject","z":"b7365eb2cd9f043a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2600","payloadType":"num","x":170,"y":820,"wires":[["6fa8637750ac1054"]]},{"id":"a3d2d88cd6708218","type":"inject","z":"b7365eb2cd9f043a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"79","payloadType":"num","x":170,"y":960,"wires":[["494bb9361ae7bea3"]]},{"id":"f3d26ec9c8d67465","type":"inject","z":"b7365eb2cd9f043a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2300","payloadType":"num","x":170,"y":860,"wires":[["6fa8637750ac1054"]]},{"id":"84b2fa38187ff34f","type":"inject","z":"b7365eb2cd9f043a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"AutoEin","payload":"AutoEin","payloadType":"str","x":160,"y":720,"wires":[["5e6eefda3fb81cfd"]]},{"id":"eba9ab8e96ae87e8","type":"inject","z":"b7365eb2cd9f043a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"AutoAus","payloadType":"str","x":180,"y":760,"wires":[["5e6eefda3fb81cfd"]]},{"id":"5e6eefda3fb81cfd","type":"change","z":"b7365eb2cd9f043a","name":"","rules":[{"t":"set","p":"AutoEin","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":740,"wires":[["c9bdbf8b0e1b8b42"]]},{"id":"6fa8637750ac1054","type":"change","z":"b7365eb2cd9f043a","name":"","rules":[{"t":"set","p":"Einspeisung","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":840,"wires":[["c9bdbf8b0e1b8b42"]]},{"id":"494bb9361ae7bea3","type":"change","z":"b7365eb2cd9f043a","name":"","rules":[{"t":"set","p":"SOC","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":940,"wires":[["c9bdbf8b0e1b8b42"]]},{"id":"c9bdbf8b0e1b8b42","type":"change","z":"b7365eb2cd9f043a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t   \"AutoEin\":$exists($flowContext(\"AutoEin\")),\t   \"Einspeisung\":$exists($flowContext(\"Einspeisung\")),\t   \"SOC\":$exists($flowContext(\"SOC\"))\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":840,"wires":[["9367f9f7.8f5708"]]},{"id":"2975f91defeba563","type":"debug","z":"b7365eb2cd9f043a","name":"Alle Parameter gesetzt?","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1070,"y":760,"wires":[]},{"id":"9367f9f7.8f5708","type":"switch","z":"b7365eb2cd9f043a","name":"AND?","property":"$reduce(payload.*,function($i, $j){$i and $j})","propertyType":"jsonata","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":830,"y":840,"wires":[["2975f91defeba563","c6ee18440c5ede12"]],"info":"# All properties of an object must be true.\n\nAll properties of an object must be true.\n\n`{\n    \"Office\": true,\n    \"Bedroom\": true,\n    \"Living Room Balcony\": true,\n    \"Living Room Right Window\": true,\n    \"Living Room Left Window\": true\n}`\n\nis true,\n\n`{\n    \"Office\": true,\n    \"Bedroom\": false,\n    \"Living Room Balcony\": true,\n    \"Living Room Right Window\": true,\n    \"Living Room Left Window\": true\n}`\n\nis false.\n\n# Alle Eigenschaften eines Objektes müssen wahr sein\n\nAlle Eigenschaften eines Objektes müssen wahr sein.\n\n`{\n    \"Büro Balkon\": true,\n    \"Schlafzimmer Balkon\": true,\n    \"Wohnzimmer Balkon\": true,\n    \"Wohnzimmer rechtes Fenster\": true,\n    \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt true,\n\n`{\n    \"Büro Balkon\": true,\n    \"Schlafzimmer Balkon\": true,\n    \"Wohnzimmer Balkon\": true,\n    \"Wohnzimmer rechtes Fenster\": false,\n    \"Wohnzimmer linkes Fenster\": true\n}`\n\nergibt false."},{"id":"45a1bb09159cf684","type":"switch","z":"b7365eb2cd9f043a","name":"SOC > 80%","property":"SOC","propertyType":"flow","rules":[{"t":"gt","v":"80","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1470,"y":820,"wires":[["55afcaa9b715c923","e6bff6b181617360"],["a24a10d67adf7325"]]},{"id":"5192b4bc40dd7659","type":"switch","z":"b7365eb2cd9f043a","name":"Einspeiseleistung > 2500W","property":"Einspeisung","propertyType":"flow","rules":[{"t":"gt","v":"2500","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1220,"y":820,"wires":[["45a1bb09159cf684"],["0f2c3c5c8743b77e"]]},{"id":"f558e9a1afff1836","type":"debug","z":"b7365eb2cd9f043a","name":"Ergebnis","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2480,"y":800,"wires":[]},{"id":"c6ee18440c5ede12","type":"switch","z":"b7365eb2cd9f043a","name":"Auto Ein/Aus","property":"AutoEin","propertyType":"flow","rules":[{"t":"cont","v":"AutoEin","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":990,"y":840,"wires":[["5192b4bc40dd7659"],["473eacb13a6cb11c"]]},{"id":"5d671131260cc2d4","type":"change","z":"b7365eb2cd9f043a","name":"Schalter Aus","rules":[{"t":"set","p":"payload","pt":"msg","to":"Pumpe Aus 0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2090,"y":900,"wires":[["ddf39dae01705e59"]]},{"id":"856ab41216e0c0af","type":"delay","z":"b7365eb2cd9f043a","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1900,"y":900,"wires":[["5d671131260cc2d4"]]},{"id":"55afcaa9b715c923","type":"change","z":"b7365eb2cd9f043a","name":"Schalter Ein","rules":[{"t":"set","p":"payload","pt":"msg","to":"Pumpe Ein 1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1690,"y":800,"wires":[["ddf39dae01705e59"]]},{"id":"e6bff6b181617360","type":"change","z":"b7365eb2cd9f043a","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1700,"y":840,"wires":[["856ab41216e0c0af"]]},{"id":"19225af3a1bf8b1a","type":"rbe","z":"b7365eb2cd9f043a","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":2310,"y":800,"wires":[["f558e9a1afff1836"]]},{"id":"a24a10d67adf7325","type":"junction","z":"b7365eb2cd9f043a","x":1620,"y":900,"wires":[["856ab41216e0c0af"]]},{"id":"0f2c3c5c8743b77e","type":"junction","z":"b7365eb2cd9f043a","x":1380,"y":900,"wires":[["a24a10d67adf7325"]]},{"id":"473eacb13a6cb11c","type":"junction","z":"b7365eb2cd9f043a","x":1100,"y":900,"wires":[["0f2c3c5c8743b77e"]]},{"id":"ddf39dae01705e59","type":"junction","z":"b7365eb2cd9f043a","x":2200,"y":800,"wires":[["19225af3a1bf8b1a"]]}]
                          

                          1 1 Reply Last reply Reply Quote 0
                          • 1
                            1984chris @mickym last edited by

                            @mickym
                            Hallo
                            Ich habe mit node red noch nichts zu tun gehabt, bis jetzt und kann auch nichts programieren deshalb habe ich mir gedacht alles mit einzelnen nodes zu machen.
                            Habe das Beispiel für mich umbauen wollen weil ich eine Poolwärmepumpe habe und diese z.b nur einschalten soll wenn PV Überschuss >2500W SOC Batterie>80% und der Schalter AutoEin Ein ist. Die Verzögerung ist z.b wenn Wolken drüberziehen und der PV Überschuss <2500W ist, wenn innerhalb 15 min (die 5 sekunden sind nur zum testen) wieder >2500W ein reset erfolgt.
                            Deine Variante funktioniert.Danke
                            Wie gesagt habe leider keine Programierkenntnisse (JSON).
                            Kannst du mir einen Tipp geben wie ich mich in das Thema einarbeiten kann?

                            LG Christoph

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

                              @1984chris Na ich habe auch sogut wie keinen Code geschrieben - das Einzige war, dass ich sicher gestellt habe, dass alle Daten im Kontext gespeichert sind.
                              Bei Objekten im Debug Fenster kannst Du immer den Pfad kopieren und ich habe nur JSONATA verwendet, um sicher zustellen, dass Du alles im Kontext vorhanden ist.

                              Die JSONATA Doku insgesamt - mit dem tollen Übungsfenster gibts hier: https://docs.jsonata.org/overview

                              Falls Du Dich da einarbeitest helfe ich Dir gerne - habe da auch mit jemand schon Übungen gemacht. Dann musst Dir halt Zeit nehmen.

                              Du siehst ja ich habe es auch ohne Programmieren gemacht und ich kann DICH nur ermutigen NICHT zu programmieren, sondern weiterhin einzelne Nodes zu nutzen. Nur so nutzt Du die Möglichkeiten von NodeRed. Also alles richtig gemacht.

                              Im Februar 2023 habe ich mit einem Forumsteilnehmer ein paar JSONATA Übungen gemacht. Die kannst Du ja mal versuchen nachzuvollziehen: https://forum.iobroker.net/post/943407

                              Ansonsten kann ich Dir die Tutorials von Steve empfehlen - ganz allgemein - die Grundlagen beherrschst Du schon: https://stevesnoderedguide.com/

                              1 1 Reply Last reply Reply Quote 0
                              • 1
                                1984chris @mickym last edited by

                                @mickym
                                für was war der Filter?
                                hab den jetzt entfernt sonst hat der shelly kurz Ein und gleich wieder ausgeschaltet.
                                die zweite Verzögerung ist das als erstes die Poolpumpe ausgeht und dann die Wärmepumpe.
                                Ist das so ok?

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

                                  @1984chris Der Filter verhindert eigentlich, dass gleiche Nachrichten mehrfach geschickt werden. Deswegen glaube ich nicht, dass der Filter für das Ein- und Ausschalten verantwortlich war. Da musst Du woanders suchen, woher das kommt. Klar kannst du die Delay Nodes in Serie schalten und den Reset gleichzeitig an beide Delays schicken.

                                  Generell empfiehlt sich eigentlich neben einer Verzögerung nicht bei absoluten Werten zu schalten und eine gewisse Hysterese einzubauen.

                                  1 Reply Last reply Reply Quote 0
                                  • 1
                                    1984chris last edited by

                                    Hallo

                                    was meinst du mit Kontext gespeichert? hab google schon bemüht aber nicht gefunden.

                                    LG CHristoph

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

                                      @1984chris Na Du hast doch alles aus den Inject Nodes in Variablen gespeichert (in globale). Es gibt Variablen die haben Gültigkeit in einer Function Node, in einem Flow, oder global in allen Flows.

                                      Sehen kannst Du diese Variablen alle im Kontextfenster.

                                      1c849485-0a3e-4978-8aef-c67ab1131628-image.png

                                      Und warum Du nichts gefunden hast, verstehe ich nicht. Dem Kontext wurde in der Originaldokumentation sogar ein eigenen Kapitel gewidmet: https://nodered.org/docs/user-guide/context

                                      Diese Seite enthält sogar ein Video dazu - allerdings in Englisch.

                                      1 1 Reply Last reply Reply Quote 0
                                      • 1
                                        1984chris @mickym last edited by

                                        @mickym
                                        habe jsonata kontext speichern eigegeben......

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

                                          @1984chris sagte in Function Node welche zwei Werte vergleicht:

                                          @mickym
                                          habe jsonata kontext speichern eigegeben......

                                          In der offiziellen JSONATA Doku findest Du nichts zum Kontext, da JSONATA unter NodeRed ein paar NodeRed spezifische Funktionen hat. Die findest du wenn Du in einer ChangeNode - den JSONATA Editor öffnest.

                                          6d492562-6c56-4150-9603-f65c484fbfc5-image.png

                                          1 1 Reply Last reply Reply Quote 0
                                          • 1
                                            1984chris @mickym last edited by

                                            @mickym
                                            für was speichert man die Werte im Kontext?
                                            die Und -funktion verstehe ich auch nicht....

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            503
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            5
                                            207
                                            17982
                                            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