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. Node Red Werte addieren

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    Node Red Werte addieren

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

      @mickym brokerJPG.JPG

      S 1 Reply Last reply Reply Quote 0
      • S
        siporax @siporax last edited by

        @siporax so müsste es dann passen oder?

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

          @siporax Nein das ist kein Typ Folder, sondern Du willst doch Zahlen da rein schreiben.

          f48c9daa-dcc3-4b49-912c-5c1afe708f21-image.png

          S 1 Reply Last reply Reply Quote 1
          • S
            siporax @mickym last edited by

            @mickym so habe ich erstellt im Broker
            Welches glied ist das im Node red denke Io Broker out
            aber da komme ich nicht auf meinen Datenpunkt wenn das Glied so stimmt
            Im Broker schreibt eine Null schon mal ,denke fast am Ziel.

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

              @siporax Ich hab Dir doch das unten gepostet ein iobroker-out Node.

              https://forum.iobroker.net/post/1007059

              S 1 Reply Last reply Reply Quote 0
              • S
                siporax @mickym last edited by

                broker3.JPG
                War auch richtig kann aber mein Datenpunkt nicht auswählen in Node Red.
                Oder ist noch ein Fehler da drin?

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

                  @siporax Nein das ist ein Fehler im Adapter - der liest die Datenpunkte nur beim Adapterstart ein.

                  Ich kopiere den Pfad einfach aus der ersten Spalte über dieser Schaltfläche in die Zwischenablage und füge es dann als topic ein.

                  801c8225-b784-4e0c-9877-ed31cd1ed583-image.png

                  S 1 Reply Last reply Reply Quote 1
                  • S
                    siporax @mickym last edited by

                    @mickym verstehe ich nicht.Ich habe das example State nicht erstellt

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

                      @siporax Geh doch mit der Maus einfach in die erste Spalte

                      1afcb6d4-41be-4f63-802a-971bd7efc62a-image.png

                      dann taucht diese Schaltfläche auf. Mit dem Draufklicken kopierst Du das in die Zwischenablage und das kopierst Du in das Topic. Die Auswahl über die 3 Punkte

                      330111e3-2ee1-47fb-a688-2d062d5c3fa6-image.png

                      funktioniert nur, wenn der Datenpunkt bereits beim Start des Adapters existiert hat.

                      S DancerVlt69 2 Replies Last reply Reply Quote 1
                      • S
                        siporax @mickym last edited by

                        @mickym Danke für deine Gedult es geht nun,super Erklärt.

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

                          Der Thread ist zwar inzwischen schon etwas älter, aber da ich beim Suchen nach anderen Infos auf ihn aufmerksam geworden bin und auch gerade in den Vorbereitungen für diverse Auswertungen von Daten bin, kam mir das Thema gelegen und ich habe versucht, die hier geposteten Ansätze mal nachzubauen.

                          Noch angemerkt, meine Kenntnisse in Sachen ioB, NodeRed und JS sind noch recht begrenzt.

                          Grundgedanke: alle 3 Phasen sollen (permanent/mit Intervall) auf Veränderungen abgefragt werden, und aus den Werten, so denn vorhanden, die Summer ermittelt werden und in einen Datenpunkt (ioB/MQTT) geschrieben werden. Soweit so gut. Hab da aber auch jeden Fall schon konkretere Vorstellungen als @siporax in welche Richtung es gehen soll.

                          Bei der Variante mit der functionNode hole ich mir die Daten mit der ioB-in-Node, mit Join verbinden und in der functionNode berechnen. Nur das Berechnen funktioniert bei mir erst dann vollständig, wenn mindestens alle 3 Datenpunkte einmal aktualisiert wurden.

                          Gleiches scheint bei der Variante 2x changeNode von @mickym zu sein.

                          Was mache ich falsch oder was übersehe ich?

                          Bei der dritten Variante, Datenpunkte nach injectNode abfragen, funktioniert soweit alles, aber es ist ja angedacht, dass die Werte bei Veränderung 'abgeholt' und berechnet werden. In dem Fall habe ich mir mit einer ioB-in-Node und anschließen einer changeNode ohne Regeln weitergeholfen. Sicher nicht die beste Lösung, aber was machen wenn man zu doof oder zu doof ist, nodeRed und/oder JS zu verstehen... 😉

                          Eins ist aber dennoch interessant an der Sache: bei allen 3 Varianten wird der Wert für L2 IMMER sofort abgeholt! Warum auch immer.

                          Btw. Der Vollständigkeit halber, da @Jacke Blockly erwähnte: habe Gleiches, also Daten holen nach Änderung/en, ausrechnen, an/in MQTT/ioB-Datenpunkt schreiben, in kaum 30 Min. zusammen 'geschustert' und nach weiteren knapp 30 Min sah das Ganze auch halbwegs übersichtlich aus und hat sogar noch 'Tendenz-Info' bekommen. Auch hier, erst mal nur mit meinem aktuellen, doch noch recht beschränktem Wissen.

                          Da ich noch keine Daten für die 3 Phasen erfassen kann hab ich mich bei Temeratursensoren bedien... 's geht, ja erst mal um's Gurndsätzliche.

                          Hier mal Screenshots von Node-Red und Blockly
                          2825cbf5-d8d7-4193-82d5-895f63b41c63-image.png

                          3bef52c6-991d-4924-98e3-d411fa2c916b-image.png

                          Und der Code...

                          [
                              {
                                  "id": "fb47b7d546e2b4ec",
                                  "type": "tab",
                                  "label": "Flow 9",
                                  "disabled": false,
                                  "info": "",
                                  "env": []
                              },
                              {
                                  "id": "1238a9470f81ac99",
                                  "type": "function",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "function 6",
                                  "func": "var L1, L2, L3 = 0;\nif (msg.topic === \"alias/0/Grid/GridHome/L1\") context.set(\"L1\", msg.payload[\"alias/0/Grid/GridHome/L1\"]);\nif (msg.topic === \"alias/0/Grid/GridHome/L2\") context.set(\"L2\", msg.payload[\"alias/0/Grid/GridHome/L2\"]);\nif (msg.topic === \"alias/0/Grid/GridHome/L3\") context.set(\"L3\", msg.payload[\"alias/0/Grid/GridHome/L3\"]);\n\nL1 = context.get(\"L1\" || 0);\nL2 = context.get(\"L2\" || 0);\nL3 = context.get(\"L3\" || 0); \n\nmsg.payload = (L1 + L2 + L3);\n// msg.payload = (L1 + L2 + L3);\n\nreturn msg;",
                                  "outputs": 1,
                                  "timeout": 0,
                                  "noerr": 0,
                                  "initialize": "",
                                  "finalize": "",
                                  "libs": [],
                                  "x": 560,
                                  "y": 100,
                                  "wires": [
                                      [
                                          "3b3f83cc2b2c710e",
                                          "d419b93fcd0c50bb",
                                          "beed7e1d8aeba85c"
                                      ]
                                  ]
                              },
                              {
                                  "id": "2d63044d06f5f168",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "debug 9.6.2",
                                  "active": false,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 170,
                                  "y": 100,
                                  "wires": []
                              },
                              {
                                  "id": "399d9b7ab5e6c96a",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "debug 9.6.3",
                                  "active": false,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 170,
                                  "y": 340,
                                  "wires": []
                              },
                              {
                                  "id": "37bea2fc3821ecf1",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "debug 9.6.3",
                                  "active": false,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 170,
                                  "y": 220,
                                  "wires": []
                              },
                              {
                                  "id": "c4ed9bb19bd931a4",
                                  "type": "join",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "mode": "custom",
                                  "build": "object",
                                  "property": "payload",
                                  "propertyType": "msg",
                                  "key": "topic",
                                  "joiner": "\\n",
                                  "joinerType": "str",
                                  "accumulate": true,
                                  "timeout": "",
                                  "count": "1",
                                  "reduceRight": false,
                                  "reduceExp": "",
                                  "reduceInit": "",
                                  "reduceInitType": "",
                                  "reduceFixup": "",
                                  "x": 390,
                                  "y": 100,
                                  "wires": [
                                      [
                                          "9e12902d4bf4665e",
                                          "1238a9470f81ac99"
                                      ]
                                  ]
                              },
                              {
                                  "id": "9e12902d4bf4665e",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "debug 9.6.4",
                                  "active": false,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 430,
                                  "y": 160,
                                  "wires": []
                              },
                              {
                                  "id": "1d99d6cc13089cd2",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L1",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 40,
                                  "wires": [
                                      [
                                          "c4ed9bb19bd931a4",
                                          "2d63044d06f5f168"
                                      ]
                                  ]
                              },
                              {
                                  "id": "3b3f83cc2b2c710e",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "debug 9.6.5",
                                  "active": true,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 750,
                                  "y": 160,
                                  "wires": []
                              },
                              {
                                  "id": "5dcac88d0577f3fe",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L2",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 160,
                                  "wires": [
                                      [
                                          "c4ed9bb19bd931a4",
                                          "37bea2fc3821ecf1"
                                      ]
                                  ]
                              },
                              {
                                  "id": "5a5366652ecdade5",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L3",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 280,
                                  "wires": [
                                      [
                                          "c4ed9bb19bd931a4",
                                          "399d9b7ab5e6c96a"
                                      ]
                                  ]
                              },
                              {
                                  "id": "a872a7ba51fd3484",
                                  "type": "inject",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "props": [
                                      {
                                          "p": "trigger",
                                          "v": "true",
                                          "vt": "bool"
                                      }
                                  ],
                                  "repeat": "",
                                  "crontab": "",
                                  "once": false,
                                  "onceDelay": 0.1,
                                  "topic": "",
                                  "x": 390,
                                  "y": 640,
                                  "wires": [
                                      [
                                          "256da960d23f9755"
                                      ]
                                  ]
                              },
                              {
                                  "id": "256da960d23f9755",
                                  "type": "ioBroker get",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "L1",
                                  "topic": "alias.0.Grid.GridHome.L1",
                                  "attrname": "L1",
                                  "payloadType": "value",
                                  "errOnInvalidState": "nothing",
                                  "x": 530,
                                  "y": 680,
                                  "wires": [
                                      [
                                          "a4730fef776c6647"
                                      ]
                                  ]
                              },
                              {
                                  "id": "a4730fef776c6647",
                                  "type": "ioBroker get",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "L2",
                                  "topic": "alias.0.Grid.GridHome.L2",
                                  "attrname": "L2",
                                  "payloadType": "value",
                                  "errOnInvalidState": "nothing",
                                  "x": 650,
                                  "y": 680,
                                  "wires": [
                                      [
                                          "0f84e002a70cacc1"
                                      ]
                                  ]
                              },
                              {
                                  "id": "c5166dda9c56917b",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "Summe",
                                  "active": true,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 840,
                                  "y": 680,
                                  "wires": []
                              },
                              {
                                  "id": "9685e5e1edcb1ba4",
                                  "type": "change",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "payload",
                                          "pt": "msg",
                                          "to": "$round((L1 + L2 + L3),4)",
                                          "tot": "jsonata"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 810,
                                  "y": 740,
                                  "wires": [
                                      [
                                          "c5166dda9c56917b"
                                      ]
                                  ]
                              },
                              {
                                  "id": "0f84e002a70cacc1",
                                  "type": "ioBroker get",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "L3",
                                  "topic": "alias.0.Grid.GridHome.L3",
                                  "attrname": "L3",
                                  "payloadType": "value",
                                  "errOnInvalidState": "nothing",
                                  "x": 650,
                                  "y": 740,
                                  "wires": [
                                      [
                                          "9685e5e1edcb1ba4"
                                      ]
                                  ]
                              },
                              {
                                  "id": "d9b451ed1ef8f471",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L1",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 640,
                                  "wires": [
                                      [
                                          "7eeb50a189819a75"
                                      ]
                                  ]
                              },
                              {
                                  "id": "7eeb50a189819a75",
                                  "type": "change",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "rules": [],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 370,
                                  "y": 700,
                                  "wires": [
                                      [
                                          "256da960d23f9755"
                                      ]
                                  ]
                              },
                              {
                                  "id": "5aaed265aab69983",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L2",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 700,
                                  "wires": [
                                      [
                                          "7eeb50a189819a75"
                                      ]
                                  ]
                              },
                              {
                                  "id": "63b5caefee96f50c",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L3",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 760,
                                  "wires": [
                                      [
                                          "7eeb50a189819a75"
                                      ]
                                  ]
                              },
                              {
                                  "id": "d419b93fcd0c50bb",
                                  "type": "mqtt out",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "HomeGridSummary (2)",
                                  "topic": "homegrid/phases/phases_sum2",
                                  "qos": "",
                                  "retain": "",
                                  "respTopic": "",
                                  "contentType": "",
                                  "userProps": "",
                                  "correl": "",
                                  "expiry": "",
                                  "broker": "dddaa640df8fba6b",
                                  "x": 780,
                                  "y": 100,
                                  "wires": []
                              },
                              {
                                  "id": "beed7e1d8aeba85c",
                                  "type": "ioBroker out",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "HomeGridSummary",
                                  "topic": "0_userdata.0.HomeGrid.HomeGrid_Summary",
                                  "ack": "true",
                                  "autoCreate": "false",
                                  "stateName": "",
                                  "role": "",
                                  "payloadType": "",
                                  "readonly": "",
                                  "stateUnit": "",
                                  "stateMin": "",
                                  "stateMax": "",
                                  "x": 770,
                                  "y": 40,
                                  "wires": []
                              },
                              {
                                  "id": "07ae2369fe461fbe",
                                  "type": "change",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "topic: L1",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "topic",
                                          "pt": "msg",
                                          "to": "L1",
                                          "tot": "str"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 360,
                                  "y": 420,
                                  "wires": [
                                      [
                                          "a244a31c5bcbea91"
                                      ]
                                  ]
                              },
                              {
                                  "id": "bf7144a4e29d4279",
                                  "type": "change",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "topic: L2",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "topic",
                                          "pt": "msg",
                                          "to": "L2",
                                          "tot": "str"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 360,
                                  "y": 480,
                                  "wires": [
                                      [
                                          "a244a31c5bcbea91"
                                      ]
                                  ]
                              },
                              {
                                  "id": "64441cb4c466b694",
                                  "type": "change",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "topic: L3",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "topic",
                                          "pt": "msg",
                                          "to": "L3",
                                          "tot": "str"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 360,
                                  "y": 540,
                                  "wires": [
                                      [
                                          "a244a31c5bcbea91"
                                      ]
                                  ]
                              },
                              {
                                  "id": "a244a31c5bcbea91",
                                  "type": "join",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "mode": "custom",
                                  "build": "object",
                                  "property": "payload",
                                  "propertyType": "msg",
                                  "key": "topic",
                                  "joiner": "\\n",
                                  "joinerType": "str",
                                  "accumulate": true,
                                  "timeout": "",
                                  "count": "3",
                                  "reduceRight": false,
                                  "reduceExp": "",
                                  "reduceInit": "",
                                  "reduceInitType": "",
                                  "reduceFixup": "",
                                  "x": 550,
                                  "y": 480,
                                  "wires": [
                                      [
                                          "add94d9ab1b506bd"
                                      ]
                                  ]
                              },
                              {
                                  "id": "3ceea4dfeb31a8e4",
                                  "type": "debug",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "active": true,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "true",
                                  "targetType": "full",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 750,
                                  "y": 540,
                                  "wires": []
                              },
                              {
                                  "id": "add94d9ab1b506bd",
                                  "type": "change",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "payload",
                                          "pt": "msg",
                                          "to": "payload.L1 + payload.L2 + payload.L3",
                                          "tot": "jsonata"
                                      },
                                      {
                                          "t": "set",
                                          "p": "topic",
                                          "pt": "msg",
                                          "to": "Summe von L1,L2,L3",
                                          "tot": "str"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 730,
                                  "y": 480,
                                  "wires": [
                                      [
                                          "3ceea4dfeb31a8e4"
                                      ]
                                  ]
                              },
                              {
                                  "id": "af27203b1ea10edc",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L1",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 420,
                                  "wires": [
                                      [
                                          "07ae2369fe461fbe"
                                      ]
                                  ]
                              },
                              {
                                  "id": "f9752f905b3825cb",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L2",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 480,
                                  "wires": [
                                      [
                                          "bf7144a4e29d4279"
                                      ]
                                  ]
                              },
                              {
                                  "id": "c7ba8809df9440d9",
                                  "type": "ioBroker in",
                                  "z": "fb47b7d546e2b4ec",
                                  "name": "",
                                  "attrname": "payload",
                                  "topic": "alias.0.Grid.GridHome.L3",
                                  "payloadType": "value",
                                  "onlyack": "",
                                  "func": "all",
                                  "gap": "",
                                  "fireOnStart": "false",
                                  "outFormat": "MQTT",
                                  "x": 130,
                                  "y": 540,
                                  "wires": [
                                      [
                                          "64441cb4c466b694"
                                      ]
                                  ]
                              },
                              {
                                  "id": "dddaa640df8fba6b",
                                  "type": "mqtt-broker",
                                  "name": "HomeGridSummary",
                                  "broker": "localhost",
                                  "port": "1884",
                                  "clientid": "",
                                  "autoConnect": true,
                                  "usetls": false,
                                  "protocolVersion": "4",
                                  "keepalive": "60",
                                  "cleansession": true,
                                  "autoUnsubscribe": true,
                                  "birthTopic": "",
                                  "birthQos": "0",
                                  "birthRetain": "false",
                                  "birthPayload": "",
                                  "birthMsg": {},
                                  "closeTopic": "",
                                  "closeQos": "0",
                                  "closeRetain": "false",
                                  "closePayload": "",
                                  "closeMsg": {},
                                  "willTopic": "",
                                  "willQos": "0",
                                  "willRetain": "false",
                                  "willPayload": "",
                                  "willMsg": {},
                                  "userProps": "",
                                  "sessionExpiry": ""
                              }
                          ]
                          

                          für Blockly

                          var Phase_L1, phases_summary, Phase_L2, tendency, summary_old, Phase_L3;
                          
                          // Beschreibe diese Funktion …
                          async function get_data() {
                            Phase_L1 = getState('alias.0.Grid.GridHome.L1').val;
                            Phase_L2 = getState('alias.0.Grid.GridHome.L2').val;
                            Phase_L3 = getState('alias.0.Grid.GridHome.L3').val;
                            if (getState('mqtt.2.homegrid.phases.phases_sum').val) {
                              summary_old = getState('mqtt.2.homegrid.phases.phases_sum').val;
                            }
                          }
                          
                          // Beschreibe diese Funktion …
                          async function debug_show_data() {
                            // weglassen/deaktivieren fall nicht gebraucht
                            console.log((['Die Summe über alle 3 Phasen beträgt: ',phases_summary,' | Tendenz ',tendency].join('')));
                          }
                          
                          // Beschreibe diese Funktion …
                          async function calculate_summary() {
                            phases_summary = Math.round(((Phase_L1 + Phase_L2 + Phase_L3) / 3) * 1000) / 1000;
                          }
                          
                          // Beschreibe diese Funktion …
                          async function send_data() {
                            sendTo('mqtt.2', 'sendMessage2Client', { topic: 'homegrid/phases/phases_L1', message: Phase_L1, retain: true }, (res) => { if (res && res.error) { console.error(res.error); } });sendTo('mqtt.2', 'sendMessage2Client', { topic: 'homegrid/phases/phases_L2', message: Phase_L2, retain: true }, (res) => { if (res && res.error) { console.error(res.error); } });sendTo('mqtt.2', 'sendMessage2Client', { topic: 'homegrid/phases/phases_L3', message: Phase_L3, retain: true }, (res) => { if (res && res.error) { console.error(res.error); } });sendTo('mqtt.2', 'sendMessage2Client', { topic: 'homegrid/phases/phases_sum', message: phases_summary, retain: true }, (res) => { if (res && res.error) { console.error(res.error); } });sendTo('mqtt.2', 'sendMessage2Client', { topic: 'homegrid/phases/tendency', message: tendency, retain: true }, (res) => { if (res && res.error) { console.error(res.error); } });}
                          
                          // Beschreibe diese Funktion …
                          async function calculate_tendency() {
                            if (Math.round(phases_summary * 100) / 100 == Math.round(summary_old * 100) / 100) {
                              tendency = '⏺' + ' gleichbleibend';
                            } else if (phases_summary < summary_old) {
                              tendency = '🔽' + ' fallend';
                            } else if (phases_summary > summary_old) {
                              tendency = '🔼' + ' steigend';
                            } else {
                              tendency = '❓' + ' unbekannt';
                            }
                            summary_old = phases_summary;
                          }
                          
                          
                          on({ id: [].concat(['alias.0.Grid.GridHome.L1']).concat(['alias.0.Grid.GridHome.L2']).concat(['alias.0.Grid.GridHome.L3']), change: 'ne' }, async (obj) => {
                            await get_data();
                            await calculate_summary();
                            await calculate_tendency();
                            await debug_show_data();
                            await send_data();
                          });
                          
                          

                          Ooops, ist dann doch ganz schön lang geworden... Sorry.

                          Falls jemand findet/sieht, was ich 'vergurkt' habe... tät mich über Hinweise freuen. Danke im Voraus

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

                            Und was ist nun Deine Frage? Die letzte Version sollte doch immer funktionieren auch ohne dass Du die Inject Node betätigst.

                            Bei der Variante mit der functionNode hole ich mir die Daten mit der ioB-in-Node, mit Join verbinden und in der functionNode berechnen. Nur das Berechnen funktioniert bei mir erst dann vollständig, wenn mindestens alle 3 Datenpunkte einmal aktualisiert wurden.

                            Gleiches scheint bei der Variante 2x changeNode von @mickym zu sein.

                            Dann musst halt die iobroker IN Node so konfigurieren, dass sie zu Beginn - wenn der Flow startet die Werte ausliest.

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

                              Die Frage steht im Post @mickym : was mache ich falsch oder habe ich übersehen, dass die ersten beiden Varianten nicht so funktionieren, wie sie eigentlich sollen/sollten.

                              ioB-In-Node 'richtig' konfigurieren: jo, aber wie, denn in allen 3 Varianten ist die selbe Node, nur mit unterschiedlicher Datenpunktabfrage. Alle 9 sind per copy & paste 'entstanden' aber jeweils nur die für L2 wird sofort abgefragt/eingelesen, die für L1 und L3 erst, wenn sich Daten ändern.

                              Und ja, die dritte Variante funktioniert so wie sie ist, nur das kann ja nicht die 'korrekte' Lösung sein, nur weil sie (zufällig) funktioniert. Denke ich zumindest mal. Wie erwähnt, meine Kenntnisse in Sachen ioB, Blockly, JS und Node-Red stecken noch in den Kinderschuhen. Da ist man, zumindest ich, doch recht Dankbar, wenn man den einen oder anderen Tipp bekommt, oder zumindest mit der Nase draufgestoßen wird, wo das Problem liegt. Ganze Lösungen müssen es ja nicht sein, will schließlich noch was lernen, auch debugging will erst mal gelernt sein...

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

                                @dancervlt69 Nochmal die join node funktioniert - nur ist es richtig, dass erst mit allen 3 verschiedenen Werten initialisiert werden muss - weil sonst ja das Ergebnis Unsinn ist. Wenn man darauf nicht warten will konfiguriert man die iobroker-In NOde so, dass sie zu Beginn die Werte auslesen.

                                Dazu müssen die iobroker-In Nodes sofort die Werte nachdem der Flow gestartet wird auslesen, wenn man nicht warten will.

                                f52717ee-17b4-4ea9-996f-0d476c5283ca-image.png

                                Anschließend - wenn die JOIN Node mit allen unterschiedlichen Werten initialisiert wurde, kann man die JOIN Node so konfigurieren, dass jedes weitere Update eine Nachricht erzeugt.

                                07b96247-4a45-4d1b-8450-31b37e8e9cf2-image.png

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

                                  Bei meinem Projekt muss ich auch die Einzelwerte (L1,L2,L3) zu einer Summe errechnen.
                                  Meine Werte werden vom CerboGX verarbeitet und dann an den ioBroker per MQTT gesendet.
                                  b62aa8b5-80fd-427a-a68f-cf5dedad4bf5-image.png
                                  Im "change" habe ich dann noch den Path angepasst
                                  29b147a1-2c1a-478b-8d79-71da0104e99a-image.png
                                  So sieht es dann bei mir aus.
                                  6109085c-724f-45a0-aaa6-e3f0293bc37e-image.png
                                  Danke für die Informationen @mickym

                                  Gruß
                                  Jürgen

                                  K 1 Reply Last reply Reply Quote 0
                                  • K
                                    kla960 @derAuge last edited by

                                    Ich nutze join wie hier beschrieben zum addieren von Leistungswerten. Jetzt ist darunter ein BKW, welches natürlich nach Sonnenuntergang keine Werte mehr liefert. Somit erfolgt auch keine Addition der anderen Werte mehr. Debug liefert dann folgende Meldung:

                                    "Ungültiger JSONata Ausdruck: The right side of the "+" operator must evaluate to a number"

                                    Mir fällt gerade keine Lösung ein hier bei fehlenden Werten eine 0 einzusetzen. Jemand eine Idee?

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

                                      @kla960 du filterst einfach mit einer switch node. lasse nur Nachrichten durch vom Typ number bzw. alternativ halt wie du geschrieben hast, wenn keine Zahl über eine change node auf 0 setzen. Anstelle mit einer Change Node zu addieren, kann man das ganze auch mit einer weiteren JOIN Node nochmals addieren.
                                      Also entweder zu Beginn an der Triggerquelle filtern:
                                      fe4f71b0-d936-4fd0-ab6e-0734cc5a0fff-image.png
                                      oder wenn man bereits ein Objekt hat, das wieder auseinanderreisen und mit einer JOIN Node aufaddieren.

                                      886f2795-0ca2-40cc-921f-6a1d85c2d5c5-image.png

                                      5b217520-2b6a-4fcc-9d29-f446c9709fad-image.png

                                      [
                                         {
                                             "id": "c529cc59f4628936",
                                             "type": "inject",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "",
                                             "props": [
                                                 {
                                                     "p": "payload"
                                                 }
                                             ],
                                             "repeat": "",
                                             "crontab": "",
                                             "once": false,
                                             "onceDelay": 0.1,
                                             "topic": "",
                                             "payload": "{\"L1\":20,\"L2\":null,\"L3\":40}",
                                             "payloadType": "json",
                                             "x": 270,
                                             "y": 7140,
                                             "wires": [
                                                 [
                                                     "8cca54bb3a90b513",
                                                     "e62f9f2cf4527653",
                                                     "6076f122486577cc"
                                                 ]
                                             ]
                                         },
                                         {
                                             "id": "8cca54bb3a90b513",
                                             "type": "debug",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "Objekt",
                                             "active": true,
                                             "tosidebar": true,
                                             "console": false,
                                             "tostatus": false,
                                             "complete": "payload",
                                             "targetType": "msg",
                                             "statusVal": "",
                                             "statusType": "auto",
                                             "x": 450,
                                             "y": 7080,
                                             "wires": []
                                         },
                                         {
                                             "id": "e62f9f2cf4527653",
                                             "type": "change",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "erzeugt Fehler",
                                             "rules": [
                                                 {
                                                     "t": "set",
                                                     "p": "payload",
                                                     "pt": "msg",
                                                     "to": "payload.L1 + payload.L2 + payload.L3",
                                                     "tot": "jsonata"
                                                 }
                                             ],
                                             "action": "",
                                             "property": "",
                                             "from": "",
                                             "to": "",
                                             "reg": false,
                                             "x": 480,
                                             "y": 7140,
                                             "wires": [
                                                 []
                                             ]
                                         },
                                         {
                                             "id": "6076f122486577cc",
                                             "type": "split",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "",
                                             "splt": "\\n",
                                             "spltType": "str",
                                             "arraySplt": 1,
                                             "arraySpltType": "len",
                                             "stream": false,
                                             "addname": "",
                                             "x": 450,
                                             "y": 7200,
                                             "wires": [
                                                 [
                                                     "b1eba9d170a5804b",
                                                     "6bfd9422469622ee"
                                                 ]
                                             ]
                                         },
                                         {
                                             "id": "b1eba9d170a5804b",
                                             "type": "debug",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "Einzelwerte",
                                             "active": false,
                                             "tosidebar": true,
                                             "console": false,
                                             "tostatus": false,
                                             "complete": "payload",
                                             "targetType": "msg",
                                             "statusVal": "",
                                             "statusType": "auto",
                                             "x": 610,
                                             "y": 7240,
                                             "wires": []
                                         },
                                         {
                                             "id": "6bfd9422469622ee",
                                             "type": "change",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "",
                                             "rules": [
                                                 {
                                                     "t": "set",
                                                     "p": "payload",
                                                     "pt": "msg",
                                                     "to": "$type(payload) = \"number\" ? payload : 0\t",
                                                     "tot": "jsonata"
                                                 }
                                             ],
                                             "action": "",
                                             "property": "",
                                             "from": "",
                                             "to": "",
                                             "reg": false,
                                             "x": 630,
                                             "y": 7200,
                                             "wires": [
                                                 [
                                                     "5952436440189cef",
                                                     "af7d6bdc891fb2f5"
                                                 ]
                                             ]
                                         },
                                         {
                                             "id": "5952436440189cef",
                                             "type": "debug",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "Typprüfung und ggf. 0",
                                             "active": false,
                                             "tosidebar": true,
                                             "console": false,
                                             "tostatus": false,
                                             "complete": "payload",
                                             "targetType": "msg",
                                             "statusVal": "",
                                             "statusType": "auto",
                                             "x": 860,
                                             "y": 7240,
                                             "wires": []
                                         },
                                         {
                                             "id": "af7d6bdc891fb2f5",
                                             "type": "join",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "",
                                             "mode": "reduce",
                                             "build": "object",
                                             "property": "payload",
                                             "propertyType": "msg",
                                             "key": "topic",
                                             "joiner": "\\n",
                                             "joinerType": "str",
                                             "accumulate": true,
                                             "timeout": "",
                                             "count": "",
                                             "reduceRight": false,
                                             "reduceExp": "$A + payload",
                                             "reduceInit": "0",
                                             "reduceInitType": "num",
                                             "reduceFixup": "",
                                             "x": 810,
                                             "y": 7200,
                                             "wires": [
                                                 [
                                                     "772ca07b52740a13"
                                                 ]
                                             ]
                                         },
                                         {
                                             "id": "772ca07b52740a13",
                                             "type": "debug",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "Summe",
                                             "active": true,
                                             "tosidebar": true,
                                             "console": false,
                                             "tostatus": false,
                                             "complete": "payload",
                                             "targetType": "msg",
                                             "statusVal": "",
                                             "statusType": "auto",
                                             "x": 960,
                                             "y": 7200,
                                             "wires": []
                                         }
                                      ]
                                      

                                      Man kann das Ganze Array direkt filtern und Aufsummieren:

                                      [
                                         {
                                             "id": "acf33f19fdae3223",
                                             "type": "change",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "",
                                             "rules": [
                                                 {
                                                     "t": "set",
                                                     "p": "payload",
                                                     "pt": "msg",
                                                     "to": "$sum($filter(payload.*,function($v){$type($v)=\"number\"}))",
                                                     "tot": "jsonata"
                                                 }
                                             ],
                                             "action": "",
                                             "property": "",
                                             "from": "",
                                             "to": "",
                                             "reg": false,
                                             "x": 510,
                                             "y": 7320,
                                             "wires": [
                                                 [
                                                     "f5158d3973628fb1"
                                                 ]
                                             ]
                                         },
                                         {
                                             "id": "f5158d3973628fb1",
                                             "type": "debug",
                                             "z": "517cd16e4d7e6ae4",
                                             "name": "Summe über JSONATA",
                                             "active": true,
                                             "tosidebar": true,
                                             "console": false,
                                             "tostatus": false,
                                             "complete": "payload",
                                             "targetType": "msg",
                                             "statusVal": "",
                                             "statusType": "auto",
                                             "x": 750,
                                             "y": 7320,
                                             "wires": []
                                         }
                                      ]
                                      

                                      1e85dfb0-91ac-44ff-9e54-7aadd499c5c4-image.png

                                      $sum($filter(payload.*,function($v){$type($v)="number"}))
                                      

                                      oder noch einfacher:

                                      $sum(payload.*[($type($)="number")])
                                      

                                      17cf0504-253b-4138-bc5b-2a42151cb9cc-image.png

                                      K 1 Reply Last reply Reply Quote 0
                                      • K
                                        kla960 @mickym last edited by

                                        @mickym danke für die ausführliche Hilfestellung. Da die letzte Möglichkeit sehr vielversprechend aussah, habe ich diese probiert. Leider findet auch hier über Nacht keine Summierung statt. Meine Dashboard Anzeige bleibt dann bei dem letzen Wert stehen. Irgendwie hängt es damit zusammen, dass wenn der iobroker parser keine Daten mehr liefert, auch kein msg.payload.b bei join ankommt.

                                        Ich muss das mal weiter aufdröseln.

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

                                          @kla960 ja dann mussr du wohl deinen flow posten.

                                          K 1 Reply Last reply Reply Quote 0
                                          • K
                                            kla960 @mickym last edited by

                                            @mickym Zumindest den relevanten Teil 😉

                                            Habe mir das jetzt nochmal angesehen. Wenn keine Daten vom BKW kommen, kommt

                                            msg.payload = NaN

                                            Versuche es heute dann mal mit

                                            msg.payload = msg.payload ? msg.payload : 0;
                                            return msg;
                                            

                                            zu korrigieren. Dann sehen wir weiter.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            600
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            9
                                            62
                                            24050
                                            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