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. Wasserregulierung Aquarium

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Wasserregulierung Aquarium

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

      Hab ich ja aber das ist 100 prozentig falsch und dann bekomme ich gleich auf den deckel

      Screenshot 2024-08-17 042310.png

      [
          {
              "id": "cdee856ecf99ad2c",
              "type": "ioBroker get",
              "z": "e96d40e5c03c8e73",
              "name": "tag",
              "topic": "0_userdata.0.Kaffeemaschine.Wasser_Tag",
              "attrname": "payload",
              "payloadType": "value",
              "errOnInvalidState": "nothing",
              "x": 380,
              "y": 420,
              "wires": [
                  [
                      "1a1876d6fd414b64"
                  ]
              ]
          },
          {
              "id": "8fbb9f181c70628a",
              "type": "ioBroker get",
              "z": "e96d40e5c03c8e73",
              "name": "jahr",
              "topic": "0_userdata.0.Kaffeemaschine.Wasser_Jahr",
              "attrname": "payload",
              "payloadType": "value",
              "errOnInvalidState": "nothing",
              "x": 390,
              "y": 480,
              "wires": [
                  [
                      "1a1876d6fd414b64"
                  ]
              ]
          },
          {
              "id": "fea33a2388b19fea",
              "type": "ioBroker get",
              "z": "e96d40e5c03c8e73",
              "name": "gesamt",
              "topic": "0_userdata.0.Kaffeemaschine.Wasser_Gesamt",
              "attrname": "payload",
              "payloadType": "value",
              "errOnInvalidState": "nothing",
              "x": 380,
              "y": 550,
              "wires": [
                  [
                      "1a1876d6fd414b64"
                  ]
              ]
          },
          {
              "id": "66eeec1e6f2be7b4",
              "type": "inject",
              "z": "e96d40e5c03c8e73",
              "name": "",
              "props": [
                  {
                      "p": "durchl",
                      "v": "",
                      "vt": "str"
                  }
              ],
              "repeat": "",
              "crontab": "",
              "once": false,
              "onceDelay": 0.1,
              "topic": "",
              "x": 170,
              "y": 360,
              "wires": [
                  [
                      "0fdf123af6451d89",
                      "cdee856ecf99ad2c",
                      "8fbb9f181c70628a",
                      "fea33a2388b19fea"
                  ]
              ]
          },
          {
              "id": "071f99aa6aae94c4",
              "type": "debug",
              "z": "e96d40e5c03c8e73",
              "name": "Teste Berechnung",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "true",
              "targetType": "full",
              "statusVal": "",
              "statusType": "auto",
              "x": 830,
              "y": 360,
              "wires": []
          },
          {
              "id": "1a1876d6fd414b64",
              "type": "change",
              "z": "e96d40e5c03c8e73",
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "durchfluss",
                      "pt": "msg",
                      "to": "durchfluss * 5.1",
                      "tot": "jsonata"
                  },
                  {
                      "t": "set",
                      "p": "jahr",
                      "pt": "msg",
                      "to": "durchfluss  / 1000 + jahr",
                      "tot": "jsonata"
                  },
                  {
                      "t": "set",
                      "p": "gesamt",
                      "pt": "msg",
                      "to": "durchfluss  / 1000 + gesamt",
                      "tot": "jsonata"
                  },
                  {
                      "t": "set",
                      "p": "tag",
                      "pt": "msg",
                      "to": "durchfluss  + tag",
                      "tot": "jsonata"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 600,
              "y": 360,
              "wires": [
                  [
                      "071f99aa6aae94c4"
                  ]
              ]
          },
          {
              "id": "0fdf123af6451d89",
              "type": "ioBroker get",
              "z": "e96d40e5c03c8e73",
              "name": "durchfluss",
              "topic": "0_userdata.0.Kaffeemaschine.Counter_Kallibriert",
              "attrname": "durchfluss",
              "payloadType": "value",
              "errOnInvalidState": "nothing",
              "x": 380,
              "y": 360,
              "wires": [
                  [
                      "1a1876d6fd414b64"
                  ]
              ]
          }
      ]
      

      Array und Object habe ich ja verstanden aber ich denke mir fehlt das nötige programmier wissen.
      Wie man per json zb einen datenpunkt dann abgreift

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

        @mickym sagte in Wasserregulierung Aquarium:

        @aphofis Na Du hast doch den durchfluss auch rein bekommen. Warum machst Du es dann nicht mit den anderen genauso?

        Du holst EINEN Wert NACH dem ANDEREN in das Nachrichtenobjekt

        Aphofis 1 Reply Last reply Reply Quote 1
        • Aphofis
          Aphofis @mickym last edited by Aphofis

          @mickym
          ist es so korrekt !?
          Screenshot 2024-08-17 043046.png

          [
              {
                  "id": "071f99aa6aae94c4",
                  "type": "debug",
                  "z": "e96d40e5c03c8e73",
                  "name": "Teste Berechnung",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "true",
                  "targetType": "full",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 1050,
                  "y": 80,
                  "wires": []
              },
              {
                  "id": "cdee856ecf99ad2c",
                  "type": "ioBroker get",
                  "z": "e96d40e5c03c8e73",
                  "name": "tag",
                  "topic": "0_userdata.0.Kaffeemaschine.Wasser_Tag",
                  "attrname": "tag",
                  "payloadType": "value",
                  "errOnInvalidState": "nothing",
                  "x": 390,
                  "y": 80,
                  "wires": [
                      [
                          "8fbb9f181c70628a"
                      ]
                  ]
              },
              {
                  "id": "8fbb9f181c70628a",
                  "type": "ioBroker get",
                  "z": "e96d40e5c03c8e73",
                  "name": "jahr",
                  "topic": "0_userdata.0.Kaffeemaschine.Wasser_Jahr",
                  "attrname": "jahr",
                  "payloadType": "value",
                  "errOnInvalidState": "nothing",
                  "x": 510,
                  "y": 80,
                  "wires": [
                      [
                          "fea33a2388b19fea"
                      ]
                  ]
              },
              {
                  "id": "fea33a2388b19fea",
                  "type": "ioBroker get",
                  "z": "e96d40e5c03c8e73",
                  "name": "gesamt",
                  "topic": "0_userdata.0.Kaffeemaschine.Wasser_Gesamt",
                  "attrname": "gesamt",
                  "payloadType": "value",
                  "errOnInvalidState": "nothing",
                  "x": 650,
                  "y": 80,
                  "wires": [
                      [
                          "1a1876d6fd414b64"
                      ]
                  ]
              },
              {
                  "id": "66eeec1e6f2be7b4",
                  "type": "inject",
                  "z": "e96d40e5c03c8e73",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "daten",
                  "payloadType": "msg",
                  "x": 110,
                  "y": 80,
                  "wires": [
                      [
                          "0fdf123af6451d89"
                      ]
                  ]
              },
              {
                  "id": "1a1876d6fd414b64",
                  "type": "change",
                  "z": "e96d40e5c03c8e73",
                  "name": "",
                  "rules": [
                      {
                          "t": "set",
                          "p": "durchfluss",
                          "pt": "msg",
                          "to": "durchfluss * 5.1",
                          "tot": "jsonata"
                      },
                      {
                          "t": "set",
                          "p": "jahr",
                          "pt": "msg",
                          "to": "durchfluss  / 1000 + jahr",
                          "tot": "jsonata"
                      },
                      {
                          "t": "set",
                          "p": "gesamt",
                          "pt": "msg",
                          "to": "durchfluss  / 1000 + gesamt",
                          "tot": "jsonata"
                      },
                      {
                          "t": "set",
                          "p": "tag",
                          "pt": "msg",
                          "to": "durchfluss  + tag",
                          "tot": "jsonata"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 840,
                  "y": 80,
                  "wires": [
                      [
                          "071f99aa6aae94c4"
                      ]
                  ]
              },
              {
                  "id": "0fdf123af6451d89",
                  "type": "ioBroker get",
                  "z": "e96d40e5c03c8e73",
                  "name": "durchfluss",
                  "topic": "0_userdata.0.Kaffeemaschine.Counter_Kallibriert",
                  "attrname": "durchfluss",
                  "payloadType": "value",
                  "errOnInvalidState": "nothing",
                  "x": 250,
                  "y": 80,
                  "wires": [
                      [
                          "cdee856ecf99ad2c"
                      ]
                  ]
              }
          ]
          

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

            1f370330-1923-4376-bfda-dfb5f0a582a5-image.png

            Nein wenn Du das mit den Nachrichtenobjekten verstanden hättest, dann kann das nicht funktionieren.

            Du multiplizierst das Nachrichtenobjekt 4 mal und holst unterschiedliche Werte da rein und leitest sie dann alle wieder in die ChangeNode.

            ee974db8-4a82-4207-a2ef-d76687497f20-image.png

            1. Das erste Nachrichtenobjekt holt den Durchfluss. Jahr und Tag, Gesamt sind NICHT definiert.
              4bb6c1c9-08fb-4cc0-92bb-d577378b2c5d-image.png

            2. Das zweite Nachrichtenobjekt holt den Tag. Durchfluss, Jahr und Gesamt sind NICHT definiert.
              af5e08b0-1788-4c63-8e2f-37db6f08a065-image.png
              Hier kommt gar nichts raus

            3. usw.

            Die Nachrichten warten nicht aufeinander.

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

              @aphofis sagte in Wasserregulierung Aquarium:

              @mickym
              ist es so korrekt !?
              Screenshot 2024-08-17 043046.png

              [
                  {
                      "id": "071f99aa6aae94c4",
                      "type": "debug",
                      "z": "e96d40e5c03c8e73",
                      "name": "Teste Berechnung",
                      "active": true,
                      "tosidebar": true,
                      "console": false,
                      "tostatus": false,
                      "complete": "true",
                      "targetType": "full",
                      "statusVal": "",
                      "statusType": "auto",
                      "x": 1050,
                      "y": 80,
                      "wires": []
                  },
                  {
                      "id": "cdee856ecf99ad2c",
                      "type": "ioBroker get",
                      "z": "e96d40e5c03c8e73",
                      "name": "tag",
                      "topic": "0_userdata.0.Kaffeemaschine.Wasser_Tag",
                      "attrname": "tag",
                      "payloadType": "value",
                      "errOnInvalidState": "nothing",
                      "x": 390,
                      "y": 80,
                      "wires": [
                          [
                              "8fbb9f181c70628a"
                          ]
                      ]
                  },
                  {
                      "id": "8fbb9f181c70628a",
                      "type": "ioBroker get",
                      "z": "e96d40e5c03c8e73",
                      "name": "jahr",
                      "topic": "0_userdata.0.Kaffeemaschine.Wasser_Jahr",
                      "attrname": "jahr",
                      "payloadType": "value",
                      "errOnInvalidState": "nothing",
                      "x": 510,
                      "y": 80,
                      "wires": [
                          [
                              "fea33a2388b19fea"
                          ]
                      ]
                  },
                  {
                      "id": "fea33a2388b19fea",
                      "type": "ioBroker get",
                      "z": "e96d40e5c03c8e73",
                      "name": "gesamt",
                      "topic": "0_userdata.0.Kaffeemaschine.Wasser_Gesamt",
                      "attrname": "gesamt",
                      "payloadType": "value",
                      "errOnInvalidState": "nothing",
                      "x": 650,
                      "y": 80,
                      "wires": [
                          [
                              "1a1876d6fd414b64"
                          ]
                      ]
                  },
                  {
                      "id": "66eeec1e6f2be7b4",
                      "type": "inject",
                      "z": "e96d40e5c03c8e73",
                      "name": "",
                      "props": [
                          {
                              "p": "payload"
                          }
                      ],
                      "repeat": "",
                      "crontab": "",
                      "once": false,
                      "onceDelay": 0.1,
                      "topic": "",
                      "payload": "[\"durchfluss\", \"tag\", \"jahr\", \"gesamt\"]",
                      "payloadType": "json",
                      "x": 110,
                      "y": 80,
                      "wires": [
                          [
                              "0fdf123af6451d89"
                          ]
                      ]
                  },
                  {
                      "id": "1a1876d6fd414b64",
                      "type": "change",
                      "z": "e96d40e5c03c8e73",
                      "name": "",
                      "rules": [
                          {
                              "t": "set",
                              "p": "durchfluss",
                              "pt": "msg",
                              "to": "durchfluss * 5.1",
                              "tot": "jsonata"
                          },
                          {
                              "t": "set",
                              "p": "jahr",
                              "pt": "msg",
                              "to": "durchfluss  / 1000 + jahr",
                              "tot": "jsonata"
                          },
                          {
                              "t": "set",
                              "p": "gesamt",
                              "pt": "msg",
                              "to": "durchfluss  / 1000 + gesamt",
                              "tot": "jsonata"
                          },
                          {
                              "t": "set",
                              "p": "tag",
                              "pt": "msg",
                              "to": "durchfluss  + tag",
                              "tot": "jsonata"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 840,
                      "y": 80,
                      "wires": [
                          [
                              "071f99aa6aae94c4"
                          ]
                      ]
                  },
                  {
                      "id": "0fdf123af6451d89",
                      "type": "ioBroker get",
                      "z": "e96d40e5c03c8e73",
                      "name": "durchfluss",
                      "topic": "0_userdata.0.Kaffeemaschine.Counter_Kallibriert",
                      "attrname": "durchfluss",
                      "payloadType": "value",
                      "errOnInvalidState": "nothing",
                      "x": 250,
                      "y": 80,
                      "wires": [
                          [
                              "cdee856ecf99ad2c"
                          ]
                      ]
                  }
              ]
              

              Super!!!!!

              👍 👍 👍 👍 👍

              Der Kandidat hat 1000 Punkte. Solltest Du ja nun selbst erkennen!

              Nur woher kommt das KOMISCHE ARRAY in der payload???

              Aphofis 1 Reply Last reply Reply Quote 1
              • Aphofis
                Aphofis @mickym last edited by

                @mickym Naja ich bin in vielen dingen schnell nur Node-Red muss ich erst kennenlernen.
                und da ich Blockly einfach zu kompliziert finde und es mega finde, das ich blockly auch gleich die werte an den nodes angezeigt werden. Ich muss nur erstmal die Struktur verstehen und da man so viele variablen möglichkeiten hat ist node-red ein gigantisches werkzeug.

                Aphofis mickym 2 Replies Last reply Reply Quote 0
                • Aphofis
                  Aphofis @Aphofis last edited by

                  @aphofis
                  Ach ja payload array hab ich raus geschmissen

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

                    @aphofis sagte in Wasserregulierung Aquarium:

                    Naja ich bin in vielen dingen schnell nur Node-Red muss ich erst kennenlernen.

                    Ja dann musst Du Dich aber ein bisschen leiten lassen und erst mal die Schritte tun, die ich vorgebe und nicht selbst los probieren. Wenn Du dann sicher bist, kannst alleine loslegen.

                    So wir sind nun soweit, dass Du in Deinem Nachrichtenobjekt alle korrekten Zahlen hast. Woher kam dieses Array in der payload?

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

                      Ist es kompliziert einen wert zu runden innerhalt der rechnung fpr durchfluss !? hatte da was gefunden aber ob das richtig ist und ob ich das nehmen kann ka.

                      $round(number [, precision])
                      

                      Auf 2 nachkomma stellen wäre mir zwar lieber aber vemurlich komplex

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

                        @aphofis sagte in Wasserregulierung Aquarium:

                        Ist es kompliziert einen wert zu runden innerhalt der rechnung fpr durchfluss !? hatte da was gefunden aber ob das richtig ist und ob ich das nehmen kann ka.

                        $round(number [, precision])
                        

                        Nein das ist korrekt und ja mit Precision gibst Du ja die Anzahl der Nachkommastellen an. Du kannst also die ganze Berechnungen auf 2 Kommastellen runden indem Du die $round Funktion aussenrum machst.

                        Du bekommst doch im JSONATA Editor immer ein Beschreibung der Funktion

                        a93a55bd-e83b-4b97-8ace-2f126619b8ef-image.png

                        da steht doch, dass man mit Precision die Anzahl der Nachkommstellen bestimmt.

                        7dab7223-3cc7-4ea7-8fd9-a1f5bbca2ffa-image.png

                        somit ist dann alles auf 2 Nachkommastellen gerundet:

                        c953f963-2fd8-40ae-a9fc-edbb186971fc-image.png

                        Auf 2 nachkomma stellen wäre mir zwar lieber aber vemurlich komplex

                        Ist doch nicht komplex, oder?

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

                          Wenn Du also mit Deinen Daten im Nachrichtenobjekt zufrieden bist, dann sollten wir die Daten nun wieder in die Datenpunkte zurückschreiben, oder?

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

                            @mickym ist es so korrekt !?
                            Ja sollten sie!
                            Screenshot 2024-08-17 045237.png

                            Aphofis mickym 2 Replies Last reply Reply Quote 0
                            • Aphofis
                              Aphofis @Aphofis last edited by

                              Ich denke das sieht gut aus
                              Screenshot 2024-08-17 045354.png

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

                                @aphofis sagte in Wasserregulierung Aquarium:

                                @mickym ist es so korrekt !?
                                Ja sollten sie!
                                Screenshot 2024-08-17 045237.png

                                Ja schaut ja aus, wie in meiner Change Node - die ich vorher gepostet habe. Also bleibt mein Frage von vorher.

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

                                  @mickym alter schwede mann mann mann ich hatte die falschen datenpunkte genutzt die sind von der kaffee maschine und nicht die virtuellen moment muss noch die datenpunkte ändern

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

                                    @aphofis sagte in Wasserregulierung Aquarium:

                                    Ich denke das sieht gut aus
                                    Screenshot 2024-08-17 045354.png

                                    Ja denke ich auch, dann solltest Du nun alles wieder zurückschreiben in die Datenpunkte.

                                    Das machst Du mit iobroker-Out Nodes. Wenn Du keine Kommandos zurückschreibst (später wenn Du in Datenpunkte Deines Sonoff Adapter nimmst, musst Du in der iobroker out Node mit ACK=false schreiben = Type Command) dann schreibst Du mit Type Value, das entspricht ACK=true.

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

                                      @mickym
                                      Was soll das denn jetzt wie kommt denn diese ausgabe ich hab nix geändert

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

                                      Ich finde keinen Fehler
                                      und weißt du wenn ich einen topic definieren will gibt es neu erstellte datenpunkte nicht auch nicht wenn seite neu laden oder Popupfenster neu laden oder node-red neu starten.

                                      mickym 3 Replies Last reply Reply Quote 0
                                      • mickym
                                        mickym Most Active @Aphofis last edited by

                                        @aphofis Welche Ausgabe?

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

                                          @aphofis Ja irgendwas ist keine Zahl. Prüfe ob alle Datenpunkte, die Du einliest auch Zahlen sind.

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

                                            @aphofis sagte in Wasserregulierung Aquarium:

                                            und weißt du wenn ich einen topic definieren will gibt es neu erstellte datenpunkte nicht auch nicht wenn seite neu laden oder Popupfenster neu laden oder node-red neu starten.

                                            Was ist denn das jetzt? - Wieso willst du jetzt neu Datenpunkte erstellen? Können wir beim Thema bleiben.

                                            Den Fehler musst aber suchen. Es müssen überall Zahlen drin sein. Zur Not mit Debug Nodes überprüfen.

                                            Die Fehlermeldung ist doch eindeutig:

                                            Ungültiger JSONata Ausdruck: The right side of the "+" operator must evaluate to a number
                                            
                                            Ungültiger JSONata Ausdruck: Die rechte Seite des  "+" operator muss eine Zahl sein
                                            

                                            fb607407-6e19-40cd-a23a-4c4ed0eb4cc5-image.png

                                            Also musst Du überprüfen, ob tag, jahr oder gesamt eine Zahl sind

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            577
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            2
                                            147
                                            9323
                                            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