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. Gelöst: Wert in dynamische Struktur im ioBroker ablegen

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Gelöst: Wert in dynamische Struktur im ioBroker ablegen

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

      @mickym
      Ich habe das mal so gemacht:
      Bildschirmfoto 2025-02-06 um 22.06.32.png

      [
          {
              "id": "99d066d4bbe5dca9",
              "type": "inject",
              "z": "5c488c180ba51f18",
              "name": "",
              "props": [
                  {
                      "p": "payload"
                  }
              ],
              "repeat": "",
              "crontab": "",
              "once": false,
              "onceDelay": 0.1,
              "topic": "",
              "payload": "20.2",
              "payloadType": "num",
              "x": 350,
              "y": 700,
              "wires": [
                  [
                      "994a1a0b6d25cef4"
                  ]
              ]
          },
          {
              "id": "82d5f1b2aa875c35",
              "type": "mqtt in",
              "z": "5c488c180ba51f18",
              "name": "ZuluftTemp",
              "topic": "vitocal/ZuluftTemp",
              "qos": "0",
              "datatype": "auto-detect",
              "broker": "bf311140.13d2b8",
              "nl": false,
              "rap": true,
              "rh": 0,
              "inputs": 0,
              "x": 420,
              "y": 620,
              "wires": [
                  [
                      "994a1a0b6d25cef4"
                  ]
              ]
          },
          {
              "id": "994a1a0b6d25cef4",
              "type": "change",
              "z": "5c488c180ba51f18",
              "name": "Zuluft",
              "rules": [
                  {
                      "t": "set",
                      "p": "topic",
                      "pt": "msg",
                      "to": "zuluft",
                      "tot": "str"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 530,
              "y": 700,
              "wires": [
                  [
                      "4a49f7b7cb1d35d2"
                  ]
              ]
          },
          {
              "id": "de7a183e542f367e",
              "type": "ioBroker get object",
              "z": "5c488c180ba51f18",
              "name": "Test.Test-JSON",
              "topic": "0_userdata.0.Test.Test-JSON",
              "attrname": "array",
              "x": 620,
              "y": 580,
              "wires": [
                  []
              ]
          },
          {
              "id": "4a49f7b7cb1d35d2",
              "type": "change",
              "z": "5c488c180ba51f18",
              "name": "Vorhandenes Array",
              "rules": [
                  {
                      "t": "set",
                      "p": "array",
                      "pt": "msg",
                      "to": "array",
                      "tot": "flow"
                  },
                  {
                      "t": "set",
                      "p": "array",
                      "pt": "msg",
                      "to": "array ? array : []",
                      "tot": "jsonata"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 730,
              "y": 660,
              "wires": [
                  [
                      "1bf56806da8b2399",
                      "40df7a89751f5b92"
                  ]
              ]
          },
          {
              "id": "40df7a89751f5b92",
              "type": "change",
              "z": "5c488c180ba51f18",
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "payload",
                      "pt": "msg",
                      "to": "$append(array, payload)",
                      "tot": "jsonata"
                  },
                  {
                      "t": "set",
                      "p": "array",
                      "pt": "flow",
                      "to": "payload",
                      "tot": "msg"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 830,
              "y": 740,
              "wires": [
                  [
                      "cb026a3b7a51d987",
                      "8d9b65f4efb22698"
                  ]
              ]
          },
          {
              "id": "cb026a3b7a51d987",
              "type": "debug",
              "z": "5c488c180ba51f18",
              "name": "debug 179",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "false",
              "statusVal": "",
              "statusType": "auto",
              "x": 890,
              "y": 800,
              "wires": []
          },
          {
              "id": "8d9b65f4efb22698",
              "type": "ioBroker out",
              "z": "5c488c180ba51f18",
              "name": "Test.Test-JSON",
              "topic": "0_userdata.0.Test.Test-JSON",
              "ack": "true",
              "autoCreate": "false",
              "stateName": "",
              "role": "",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "",
              "stateMin": "",
              "stateMax": "",
              "x": 1000,
              "y": 660,
              "wires": []
          },
          {
              "id": "1bf56806da8b2399",
              "type": "debug",
              "z": "5c488c180ba51f18",
              "name": "debug 178",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "false",
              "statusVal": "",
              "statusType": "auto",
              "x": 950,
              "y": 540,
              "wires": []
          },
          {
              "id": "bf311140.13d2b8",
              "type": "mqtt-broker",
              "name": "Mosquito-Server",
              "broker": "192.168.178.10",
              "port": "1883",
              "clientid": "",
              "autoConnect": true,
              "usetls": false,
              "compatmode": false,
              "protocolVersion": "4",
              "keepalive": "60",
              "cleansession": true,
              "autoUnsubscribe": true,
              "birthTopic": "",
              "birthQos": "0",
              "birthPayload": "",
              "birthMsg": {},
              "closeTopic": "",
              "closeQos": "0",
              "closePayload": "",
              "closeMsg": {},
              "willTopic": "",
              "willQos": "0",
              "willPayload": "",
              "willMsg": {},
              "userProps": "",
              "sessionExpiry": ""
          }
      ]
      

      Die Werte kommen auch richtig im Datenpunkt an.

      Jetzt noch eine letzte Frage für Heute 😇

      Der Flow soll einen Monat laufen. Wenn nun ein Neustart vom ioBroker erfolgt, muss der Flow am letzten Datensatz wieder aufsetzen. Muss der daher nicht den letzten Stand aus dem Speicherdatenpunkt wieder einlesen?

      Edit:
      Ich habe im Flow eine ioBroker-getObject. Die ist wahrscheinlich falsch. Richtig?

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

        @martybr sagte in Wert in dynamische Struktur im ioBroker ablegen:

        Der Flow soll einen Monat laufen. Wenn nun ein Neustart vom ioBroker erfolgt, muss der Flow am letzten Datensatz wieder aufsetzen. Muss der daher nicht den letzten Stand aus dem Speicherdatenpunkt wieder einlesen?

        Nein Du willst kein Objekt, sondern entweder über iobroker- in oder get. Dann brauchst Du aber hinten nicht in eine flow Variable speichern - sondern die Flowvariable direkt über die iobroker-In füllen.

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

          @mickym
          Ich habe es noch nicht so ganz verstanden. Ich habe es nun so gebaut, wie ich es verstanden habe. Exemplarisch für zwei Flows / Arrays:

          Bildschirmfoto 2025-02-07 um 07.52.00.png

          [
              {
                  "id": "5bbdcd58332d0b96",
                  "type": "ioBroker in",
                  "z": "5c488c180ba51f18",
                  "name": "Bezug täglich",
                  "attrname": "payload",
                  "topic": "0_userdata.0.Zaehler.Strombezug.Verbrauch.täglich",
                  "payloadType": "value",
                  "onlyack": "",
                  "func": "all",
                  "gap": "",
                  "fireOnStart": "true",
                  "outFormat": "MQTT",
                  "x": 110,
                  "y": 40,
                  "wires": [
                      [
                          "53d6131492b2abed"
                      ]
                  ]
              },
              {
                  "id": "4bb406f8dd2161dd",
                  "type": "ioBroker in",
                  "z": "5c488c180ba51f18",
                  "name": "Einspeisung täglich",
                  "attrname": "payload",
                  "topic": "0_userdata.0.Zaehler.Stromeinspeisung.Verbrauch.täglich",
                  "payloadType": "value",
                  "onlyack": "",
                  "func": "all",
                  "gap": "",
                  "fireOnStart": "true",
                  "outFormat": "MQTT",
                  "x": 130,
                  "y": 120,
                  "wires": [
                      [
                          "c4e24a8d35d070ae"
                      ]
                  ]
              },
              {
                  "id": "c4e24a8d35d070ae",
                  "type": "change",
                  "z": "5c488c180ba51f18",
                  "name": "Einspeisung",
                  "rules": [
                      {
                          "t": "set",
                          "p": "topic",
                          "pt": "msg",
                          "to": "einspeisung",
                          "tot": "str"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 330,
                  "y": 120,
                  "wires": [
                      [
                          "278bac26e6737147"
                      ]
                  ]
              },
              {
                  "id": "53d6131492b2abed",
                  "type": "change",
                  "z": "5c488c180ba51f18",
                  "name": "Bezug",
                  "rules": [
                      {
                          "t": "set",
                          "p": "topic",
                          "pt": "msg",
                          "to": "bezug",
                          "tot": "str"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 270,
                  "y": 40,
                  "wires": [
                      [
                          "c617a78f8ddaca22"
                      ]
                  ]
              },
              {
                  "id": "c617a78f8ddaca22",
                  "type": "change",
                  "z": "5c488c180ba51f18",
                  "name": "Vorhandenes Array",
                  "rules": [
                      {
                          "t": "set",
                          "p": "array-bezug",
                          "pt": "msg",
                          "to": "array-bezug",
                          "tot": "flow"
                      },
                      {
                          "t": "set",
                          "p": "array-bezug",
                          "pt": "msg",
                          "to": "array-bezug ? array-bezug : []",
                          "tot": "jsonata"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 450,
                  "y": 40,
                  "wires": [
                      [
                          "ff519a511afeb6f1"
                      ]
                  ]
              },
              {
                  "id": "ff519a511afeb6f1",
                  "type": "change",
                  "z": "5c488c180ba51f18",
                  "name": "",
                  "rules": [
                      {
                          "t": "set",
                          "p": "payload",
                          "pt": "msg",
                          "to": "$append(array-bezug, payload)",
                          "tot": "jsonata"
                      },
                      {
                          "t": "set",
                          "p": "array-bezug",
                          "pt": "flow",
                          "to": "payload",
                          "tot": "msg"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 670,
                  "y": 40,
                  "wires": [
                      [
                          "3274ac485bf96d56"
                      ]
                  ]
              },
              {
                  "id": "3274ac485bf96d56",
                  "type": "ioBroker out",
                  "z": "5c488c180ba51f18",
                  "name": "Test.Bezug-JSON",
                  "topic": "0_userdata.0.Test.Bezug-JSON",
                  "ack": "true",
                  "autoCreate": "true",
                  "stateName": "",
                  "role": "",
                  "payloadType": "",
                  "readonly": "false",
                  "stateUnit": "",
                  "stateMin": "",
                  "stateMax": "",
                  "x": 890,
                  "y": 40,
                  "wires": []
              },
              {
                  "id": "278bac26e6737147",
                  "type": "change",
                  "z": "5c488c180ba51f18",
                  "name": "Vorhandenes Array",
                  "rules": [
                      {
                          "t": "set",
                          "p": "array-einspeisung",
                          "pt": "msg",
                          "to": "array-einspeisung",
                          "tot": "flow"
                      },
                      {
                          "t": "set",
                          "p": "array-einspeisung",
                          "pt": "msg",
                          "to": "array-einspeisung ? array-einspeisung : []",
                          "tot": "jsonata"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 530,
                  "y": 120,
                  "wires": [
                      [
                          "27eb027a108b6b2a"
                      ]
                  ]
              },
              {
                  "id": "27eb027a108b6b2a",
                  "type": "change",
                  "z": "5c488c180ba51f18",
                  "name": "",
                  "rules": [
                      {
                          "t": "set",
                          "p": "payload",
                          "pt": "msg",
                          "to": "$append(array-einspeisung, payload)",
                          "tot": "jsonata"
                      },
                      {
                          "t": "set",
                          "p": "array-einspeisung",
                          "pt": "flow",
                          "to": "payload",
                          "tot": "msg"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 750,
                  "y": 120,
                  "wires": [
                      [
                          "8c3a9cbe90f64091"
                      ]
                  ]
              },
              {
                  "id": "8c3a9cbe90f64091",
                  "type": "ioBroker out",
                  "z": "5c488c180ba51f18",
                  "name": "Test.Einspeisung-JSON",
                  "topic": "0_userdata.0.Test.Einspeisung-JSON",
                  "ack": "true",
                  "autoCreate": "true",
                  "stateName": "",
                  "role": "",
                  "payloadType": "",
                  "readonly": "false",
                  "stateUnit": "",
                  "stateMin": "",
                  "stateMax": "",
                  "x": 990,
                  "y": 120,
                  "wires": []
              }
          ]
          

          Die Daten aktualisieren sich täglich. Wenn das in Ordnung ist, dann gehe ich an die Zeitsteuerung.

          1 Reply Last reply Reply Quote 0
          • M
            MartyBr last edited by

            @mickym
            Ich habe hier noch ein Problem, die Zahl der Tage im Monat in eine globale Variable zu schreiben. Statt der 28 Tage aus der Funktion liefert mir der Change Node nur payload == 5

            Bildschirmfoto 2025-02-07 um 08.23.20.png

            [
                {
                    "id": "f6ed836d74798c7f",
                    "type": "inject",
                    "z": "3ebdbbcf49e0ac40",
                    "name": "",
                    "props": [
                        {
                            "p": "payload"
                        },
                        {
                            "p": "topic",
                            "vt": "str"
                        }
                    ],
                    "repeat": "",
                    "crontab": "",
                    "once": false,
                    "onceDelay": 0.1,
                    "topic": "",
                    "payload": "",
                    "payloadType": "date",
                    "x": 100,
                    "y": 400,
                    "wires": [
                        [
                            "a3434007e702fcdc"
                        ]
                    ]
                },
                {
                    "id": "7a09df47bef16411",
                    "type": "function",
                    "z": "3ebdbbcf49e0ac40",
                    "name": "function 1",
                    "func": "// Eingabe: msg.payload sollte ein Datum im Format 'YYYY-MM-DD' sein\nlet inputDate = new Date(msg.payload);\n\n// Hole den Monat und das Jahr\nlet month = inputDate.getMonth(); // 0-11\nlet year = inputDate.getFullYear();\n\n// Berechne die Anzahl der Tage im Monat\nlet daysInMonth = new Date(year, month + 1, 0).getDate();\n\n// Setze das Ergebnis in msg.payload\nmsg.payload = daysInMonth;\n\nreturn msg;",
                    "outputs": 1,
                    "timeout": 0,
                    "noerr": 0,
                    "initialize": "",
                    "finalize": "",
                    "libs": [],
                    "x": 480,
                    "y": 400,
                    "wires": [
                        [
                            "599b66169127c12d",
                            "185c42081279a5e0"
                        ]
                    ]
                },
                {
                    "id": "a3434007e702fcdc",
                    "type": "change",
                    "z": "3ebdbbcf49e0ac40",
                    "name": "",
                    "rules": [
                        {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "$moment().locale('de').format('YYYY.MM.DD')",
                            "tot": "jsonata"
                        }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 290,
                    "y": 400,
                    "wires": [
                        [
                            "7a09df47bef16411"
                        ]
                    ]
                },
                {
                    "id": "d8d647f4ae028cb8",
                    "type": "debug",
                    "z": "3ebdbbcf49e0ac40",
                    "name": "debug 182",
                    "active": true,
                    "tosidebar": true,
                    "console": false,
                    "tostatus": false,
                    "complete": "false",
                    "statusVal": "",
                    "statusType": "auto",
                    "x": 670,
                    "y": 320,
                    "wires": []
                },
                {
                    "id": "599b66169127c12d",
                    "type": "change",
                    "z": "3ebdbbcf49e0ac40",
                    "name": "Monatstage",
                    "rules": [
                        {
                            "t": "move",
                            "p": "payload",
                            "pt": "msg",
                            "to": "monatstage",
                            "tot": "global"
                        }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 650,
                    "y": 400,
                    "wires": [
                        [
                            "d8d647f4ae028cb8"
                        ]
                    ]
                },
                {
                    "id": "185c42081279a5e0",
                    "type": "debug",
                    "z": "3ebdbbcf49e0ac40",
                    "name": "debug 183",
                    "active": true,
                    "tosidebar": true,
                    "console": false,
                    "tostatus": false,
                    "complete": "false",
                    "statusVal": "",
                    "statusType": "auto",
                    "x": 590,
                    "y": 480,
                    "wires": []
                }
            ]
            
            M mickym 2 Replies Last reply Reply Quote 0
            • M
              MartyBr @MartyBr last edited by

              @mickym
              Ich glaube, dass ich das Problem gelöst habe:

              Bildschirmfoto 2025-02-07 um 09.46.38.png

              [
                  {
                      "id": "f6ed836d74798c7f",
                      "type": "inject",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "",
                      "props": [
                          {
                              "p": "payload"
                          },
                          {
                              "p": "topic",
                              "vt": "str"
                          }
                      ],
                      "repeat": "",
                      "crontab": "",
                      "once": false,
                      "onceDelay": 0.1,
                      "topic": "",
                      "payload": "",
                      "payloadType": "date",
                      "x": 100,
                      "y": 400,
                      "wires": [
                          [
                              "a3434007e702fcdc"
                          ]
                      ]
                  },
                  {
                      "id": "7a09df47bef16411",
                      "type": "function",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "function 1",
                      "func": "// Eingabe: msg.payload sollte ein Datum im Format 'YYYY-MM-DD' sein\nlet inputDate = new Date(msg.payload);\n\n// Hole den Monat und das Jahr\nlet month = inputDate.getMonth(); // 0-11\nlet year = inputDate.getFullYear();\n\n// Berechne die Anzahl der Tage im Monat\nlet daysInMonth = new Date(year, month + 1, 0).getDate();\n\n// Setze das Ergebnis in msg.payload\nmsg.payload = daysInMonth;\n\nreturn msg;",
                      "outputs": 1,
                      "timeout": 0,
                      "noerr": 0,
                      "initialize": "",
                      "finalize": "",
                      "libs": [],
                      "x": 480,
                      "y": 400,
                      "wires": [
                          [
                              "599b66169127c12d"
                          ]
                      ]
                  },
                  {
                      "id": "a3434007e702fcdc",
                      "type": "change",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "",
                      "rules": [
                          {
                              "t": "set",
                              "p": "payload",
                              "pt": "msg",
                              "to": "$moment().locale('de').format('YYYY.MM.DD')",
                              "tot": "jsonata"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 290,
                      "y": 400,
                      "wires": [
                          [
                              "7a09df47bef16411"
                          ]
                      ]
                  },
                  {
                      "id": "d8d647f4ae028cb8",
                      "type": "debug",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "debug 182",
                      "active": true,
                      "tosidebar": true,
                      "console": false,
                      "tostatus": false,
                      "complete": "false",
                      "statusVal": "",
                      "statusType": "auto",
                      "x": 650,
                      "y": 340,
                      "wires": []
                  },
                  {
                      "id": "599b66169127c12d",
                      "type": "change",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "Monatstage",
                      "rules": [
                          {
                              "t": "set",
                              "p": "payload",
                              "pt": "msg",
                              "to": "payload",
                              "tot": "msg"
                          },
                          {
                              "t": "set",
                              "p": "payload",
                              "pt": "msg",
                              "to": "monatstage",
                              "tot": "global"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 650,
                      "y": 400,
                      "wires": [
                          [
                              "d8d647f4ae028cb8"
                          ]
                      ]
                  },
                  {
                      "id": "185c42081279a5e0",
                      "type": "debug",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "debug 183",
                      "active": true,
                      "tosidebar": true,
                      "console": false,
                      "tostatus": false,
                      "complete": "false",
                      "statusVal": "",
                      "statusType": "auto",
                      "x": 450,
                      "y": 460,
                      "wires": []
                  },
                  {
                      "id": "5f695a4b2b007db0",
                      "type": "change",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "Monatstage",
                      "rules": [
                          {
                              "t": "set",
                              "p": "payload",
                              "pt": "msg",
                              "to": "monatstage",
                              "tot": "global"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 270,
                      "y": 460,
                      "wires": [
                          [
                              "185c42081279a5e0"
                          ]
                      ]
                  },
                  {
                      "id": "0191af1c60e06008",
                      "type": "inject",
                      "z": "3ebdbbcf49e0ac40",
                      "name": "",
                      "props": [
                          {
                              "p": "payload"
                          },
                          {
                              "p": "topic",
                              "vt": "str"
                          }
                      ],
                      "repeat": "",
                      "crontab": "",
                      "once": false,
                      "onceDelay": 0.1,
                      "topic": "",
                      "payload": "",
                      "payloadType": "date",
                      "x": 100,
                      "y": 460,
                      "wires": [
                          [
                              "5f695a4b2b007db0"
                          ]
                      ]
                  }
              ]
              

              Kannst du bitte mal darüber schauen?

              M 1 Reply Last reply Reply Quote 0
              • M
                MartyBr @MartyBr last edited by

                @mickym
                Ich habe hier noch einen Fehler im Flow. Ich habe nun die dynamische Datumsablage hinzugefügt und den iobroker out entsprechend geändert. Der Datenpunkt wird auch angelegt, aber als "number" und nicht als Array (mit [Wert1, Wert2,...].

                Bildschirmfoto 2025-02-07 um 10.55.01.png

                [
                    {
                        "id": "ae673cf6cd8433a0",
                        "type": "subflow",
                        "name": "Datum in Topic",
                        "info": "",
                        "category": "",
                        "in": [
                            {
                                "x": 60,
                                "y": 80,
                                "wires": [
                                    {
                                        "id": "2e1ea06b2e94bf1a"
                                    }
                                ]
                            }
                        ],
                        "out": [
                            {
                                "x": 820,
                                "y": 80,
                                "wires": [
                                    {
                                        "id": "fc37f5f9d2b0297b",
                                        "port": 0
                                    }
                                ]
                            }
                        ],
                        "env": [
                            {
                                "name": "basePath",
                                "type": "str",
                                "value": "Test1.Test2"
                            }
                        ],
                        "meta": {},
                        "color": "#DDAA99"
                    },
                    {
                        "id": "2e1ea06b2e94bf1a",
                        "type": "change",
                        "z": "ae673cf6cd8433a0",
                        "name": "",
                        "rules": [
                            {
                                "t": "set",
                                "p": "datum",
                                "pt": "msg",
                                "to": "$moment().locale('de').format('YYYY.MMMM')",
                                "tot": "jsonata"
                            }
                        ],
                        "action": "",
                        "property": "",
                        "from": "",
                        "to": "",
                        "reg": false,
                        "x": 230,
                        "y": 80,
                        "wires": [
                            [
                                "0e8de9437c3c420a"
                            ]
                        ]
                    },
                    {
                        "id": "0e8de9437c3c420a",
                        "type": "change",
                        "z": "ae673cf6cd8433a0",
                        "name": "März zu Maerz",
                        "rules": [
                            {
                                "t": "change",
                                "p": "datum",
                                "pt": "msg",
                                "from": "März",
                                "fromt": "str",
                                "to": "Maerz",
                                "tot": "str"
                            }
                        ],
                        "action": "",
                        "property": "",
                        "from": "",
                        "to": "",
                        "reg": false,
                        "x": 440,
                        "y": 80,
                        "wires": [
                            [
                                "fc37f5f9d2b0297b"
                            ]
                        ]
                    },
                    {
                        "id": "fc37f5f9d2b0297b",
                        "type": "change",
                        "z": "ae673cf6cd8433a0",
                        "name": "",
                        "rules": [
                            {
                                "t": "set",
                                "p": "topic",
                                "pt": "msg",
                                "to": "\"0_userdata.0.\"  & $env(\"basePath\") & \".\" & datum & \".\" & topic",
                                "tot": "jsonata"
                            }
                        ],
                        "action": "",
                        "property": "",
                        "from": "",
                        "to": "",
                        "reg": false,
                        "x": 660,
                        "y": 80,
                        "wires": [
                            []
                        ]
                    },
                    {
                        "id": "1d93ae2f970605e5",
                        "type": "debug",
                        "z": "5c488c180ba51f18",
                        "name": "debug 184",
                        "active": true,
                        "tosidebar": true,
                        "console": false,
                        "tostatus": false,
                        "complete": "false",
                        "statusVal": "",
                        "statusType": "auto",
                        "x": 1050,
                        "y": 180,
                        "wires": []
                    },
                    {
                        "id": "e700e5e9b292c820",
                        "type": "ioBroker out",
                        "z": "5c488c180ba51f18",
                        "name": "",
                        "topic": "",
                        "ack": "true",
                        "autoCreate": "true",
                        "stateName": "",
                        "role": "",
                        "payloadType": "",
                        "readonly": "false",
                        "stateUnit": "",
                        "stateMin": "",
                        "stateMax": "",
                        "x": 1060,
                        "y": 120,
                        "wires": []
                    },
                    {
                        "id": "5e8ce599dad4fa74",
                        "type": "subflow:ae673cf6cd8433a0",
                        "z": "5c488c180ba51f18",
                        "name": "",
                        "env": [
                            {
                                "name": "basePath",
                                "value": "Test1.Test5.MonatsTabellen",
                                "type": "str"
                            }
                        ],
                        "x": 860,
                        "y": 40,
                        "wires": [
                            [
                                "e700e5e9b292c820",
                                "1d93ae2f970605e5"
                            ]
                        ]
                    },
                    {
                        "id": "ff519a511afeb6f1",
                        "type": "change",
                        "z": "5c488c180ba51f18",
                        "name": "",
                        "rules": [
                            {
                                "t": "set",
                                "p": "payload",
                                "pt": "msg",
                                "to": "$append(array-bezug, payload)",
                                "tot": "jsonata"
                            },
                            {
                                "t": "set",
                                "p": "array-bezug",
                                "pt": "flow",
                                "to": "payload",
                                "tot": "msg"
                            }
                        ],
                        "action": "",
                        "property": "",
                        "from": "",
                        "to": "",
                        "reg": false,
                        "x": 670,
                        "y": 40,
                        "wires": [
                            [
                                "5e8ce599dad4fa74"
                            ]
                        ]
                    },
                    {
                        "id": "c617a78f8ddaca22",
                        "type": "change",
                        "z": "5c488c180ba51f18",
                        "name": "Vorhandenes Array",
                        "rules": [
                            {
                                "t": "set",
                                "p": "array-bezug",
                                "pt": "msg",
                                "to": "array-bezug",
                                "tot": "flow"
                            },
                            {
                                "t": "set",
                                "p": "array-bezug",
                                "pt": "msg",
                                "to": "array-bezug ? array-bezug : []",
                                "tot": "jsonata"
                            }
                        ],
                        "action": "",
                        "property": "",
                        "from": "",
                        "to": "",
                        "reg": false,
                        "x": 450,
                        "y": 40,
                        "wires": [
                            [
                                "ff519a511afeb6f1"
                            ]
                        ]
                    },
                    {
                        "id": "53d6131492b2abed",
                        "type": "change",
                        "z": "5c488c180ba51f18",
                        "name": "Bezug",
                        "rules": [
                            {
                                "t": "set",
                                "p": "topic",
                                "pt": "msg",
                                "to": "Strombezug",
                                "tot": "str"
                            }
                        ],
                        "action": "",
                        "property": "",
                        "from": "",
                        "to": "",
                        "reg": false,
                        "x": 270,
                        "y": 40,
                        "wires": [
                            [
                                "c617a78f8ddaca22"
                            ]
                        ]
                    },
                    {
                        "id": "5bbdcd58332d0b96",
                        "type": "ioBroker in",
                        "z": "5c488c180ba51f18",
                        "name": "Bezug täglich",
                        "attrname": "payload",
                        "topic": "0_userdata.0.Zaehler.Strombezug.Verbrauch.täglich",
                        "payloadType": "value",
                        "onlyack": "",
                        "func": "all",
                        "gap": "",
                        "fireOnStart": "true",
                        "outFormat": "MQTT",
                        "x": 110,
                        "y": 40,
                        "wires": [
                            [
                                "53d6131492b2abed"
                            ]
                        ]
                    }
                ]
                
                mickym 1 Reply Last reply Reply Quote 0
                • mickym
                  mickym Most Active @MartyBr last edited by mickym

                  @martybr Also - ich habe nun gerade Deinen Flow importiert. Wäre übrigens auch gut, wenn Du mir eine Inject Node zur Simulation dran machen würdest, da ich ja in der Regel nicht deine Datenpunkte habe.

                  fd30903d-89c5-4082-aaa2-12ba226df6d9-image.png

                  Dann machst Du einen gravierenden Fehler, wenn Du in JSONATA meinst, du kannst "array-bezug" schreiben. Dann versucht JSONATA von einer Nachrichteneigenschaft "array" den Betrag der Nachrichteneigenschaft "bezug" zu subtrahieren, was natürlich beides nicht definiert bzw. exisitiert.
                  Ich habe also in Deinem ganzen Flow - "array-bezug" durch "array_bezug" ersetzt.

                  Dann haben wir doch besprochen, dass der iobroker KEINE Objekte bearbeiten kann. Also müssen wir bevor wir einen Datenpunkt beschreiben, diesen erst in einen String umwandeln.

                  Also lösche Deinen Datenpunkt nochmals und setze eine JSON Node vor die iobroker-Out Node, so wie besprochen.

                  28ba5b0e-3db0-4a42-bb5c-d0b67738c51e-image.png

                  Und zuletzt - speicherst Du zwar direkt in die Flow variable - aber Du wolltest doch persistent machen und Du liest ja nirgend Dein Array aus dem iobroker wieder ein?

                  Also hören wir doch mal auf, das Ergebnis - also das neue Array direkt abzuspeichern:

                  90ff446d-e8aa-4850-a3c9-a4e42669b7cf-image.png

                  So nun muss man also wieder was aus dem Datenpunkt einlesen, den man in iobroker geschrieben hat. das ist aber kompliziert, da der Datenpunkt ja dynamisch sich dauernd ändert. Ich überlege mir mal was.

                  Inzwischen kannst Du Dir ja den modifizierten Flow - als Basis schon mal abspeichern - dann auf der Basis machen wir weiter.

                  [
                     {
                         "id": "ae673cf6cd8433a0",
                         "type": "subflow",
                         "name": "Datum in Topic",
                         "info": "",
                         "category": "",
                         "in": [
                             {
                                 "x": 60,
                                 "y": 80,
                                 "wires": [
                                     {
                                         "id": "2e1ea06b2e94bf1a"
                                     }
                                 ]
                             }
                         ],
                         "out": [
                             {
                                 "x": 820,
                                 "y": 80,
                                 "wires": [
                                     {
                                         "id": "fc37f5f9d2b0297b",
                                         "port": 0
                                     }
                                 ]
                             }
                         ],
                         "env": [
                             {
                                 "name": "basePath",
                                 "type": "str",
                                 "value": "Test1.Test2"
                             }
                         ],
                         "meta": {},
                         "color": "#DDAA99"
                     },
                     {
                         "id": "2e1ea06b2e94bf1a",
                         "type": "change",
                         "z": "ae673cf6cd8433a0",
                         "name": "",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "datum",
                                 "pt": "msg",
                                 "to": "$moment().locale('de').format('YYYY.MMMM')",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 230,
                         "y": 80,
                         "wires": [
                             [
                                 "0e8de9437c3c420a"
                             ]
                         ]
                     },
                     {
                         "id": "0e8de9437c3c420a",
                         "type": "change",
                         "z": "ae673cf6cd8433a0",
                         "name": "März zu Maerz",
                         "rules": [
                             {
                                 "t": "change",
                                 "p": "datum",
                                 "pt": "msg",
                                 "from": "März",
                                 "fromt": "str",
                                 "to": "Maerz",
                                 "tot": "str"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 440,
                         "y": 80,
                         "wires": [
                             [
                                 "fc37f5f9d2b0297b"
                             ]
                         ]
                     },
                     {
                         "id": "fc37f5f9d2b0297b",
                         "type": "change",
                         "z": "ae673cf6cd8433a0",
                         "name": "",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "topic",
                                 "pt": "msg",
                                 "to": "\"0_userdata.0.\"  & $env(\"basePath\") & \".\" & datum & \".\" & topic",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 660,
                         "y": 80,
                         "wires": [
                             []
                         ]
                     },
                     {
                         "id": "5073270521431406",
                         "type": "debug",
                         "z": "5dbdd0fd840b4eee",
                         "name": "debug 184",
                         "active": true,
                         "tosidebar": true,
                         "console": false,
                         "tostatus": false,
                         "complete": "false",
                         "statusVal": "",
                         "statusType": "auto",
                         "x": 1170,
                         "y": 300,
                         "wires": []
                     },
                     {
                         "id": "10bd7990f72c7776",
                         "type": "ioBroker out",
                         "z": "5dbdd0fd840b4eee",
                         "name": "",
                         "topic": "",
                         "ack": "true",
                         "autoCreate": "true",
                         "stateName": "",
                         "role": "",
                         "payloadType": "",
                         "readonly": "false",
                         "stateUnit": "",
                         "stateMin": "",
                         "stateMax": "",
                         "x": 1340,
                         "y": 220,
                         "wires": []
                     },
                     {
                         "id": "147888cb9d8dbd57",
                         "type": "subflow:ae673cf6cd8433a0",
                         "z": "5dbdd0fd840b4eee",
                         "name": "",
                         "env": [
                             {
                                 "name": "basePath",
                                 "value": "Test1.Test5.MonatsTabellen",
                                 "type": "str"
                             }
                         ],
                         "x": 1000,
                         "y": 160,
                         "wires": [
                             [
                                 "5073270521431406",
                                 "c097566fbf70cacc"
                             ]
                         ]
                     },
                     {
                         "id": "9226f70990baa228",
                         "type": "change",
                         "z": "5dbdd0fd840b4eee",
                         "name": "",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "$append(array_bezug, payload)",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 790,
                         "y": 160,
                         "wires": [
                             [
                                 "147888cb9d8dbd57"
                             ]
                         ]
                     },
                     {
                         "id": "102ed68150c3074f",
                         "type": "change",
                         "z": "5dbdd0fd840b4eee",
                         "name": "Vorhandenes Array",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "array_bezug",
                                 "pt": "msg",
                                 "to": "array_bezug",
                                 "tot": "flow"
                             },
                             {
                                 "t": "set",
                                 "p": "array_bezug",
                                 "pt": "msg",
                                 "to": "array_bezug ? array_bezug : []",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 570,
                         "y": 160,
                         "wires": [
                             [
                                 "9226f70990baa228"
                             ]
                         ]
                     },
                     {
                         "id": "fbcf46d8f94203aa",
                         "type": "change",
                         "z": "5dbdd0fd840b4eee",
                         "name": "Bezug",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "topic",
                                 "pt": "msg",
                                 "to": "Strombezug",
                                 "tot": "str"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 350,
                         "y": 120,
                         "wires": [
                             [
                                 "102ed68150c3074f"
                             ]
                         ]
                     },
                     {
                         "id": "a435b3ce1f53ba74",
                         "type": "ioBroker in",
                         "z": "5dbdd0fd840b4eee",
                         "d": true,
                         "name": "Bezug täglich",
                         "attrname": "payload",
                         "topic": "0_userdata.0.Zaehler.Strombezug.Verbrauch.täglich",
                         "payloadType": "value",
                         "onlyack": "",
                         "func": "all",
                         "gap": "",
                         "fireOnStart": "true",
                         "outFormat": "MQTT",
                         "x": 110,
                         "y": 160,
                         "wires": [
                             [
                                 "fbcf46d8f94203aa"
                             ]
                         ]
                     },
                     {
                         "id": "779ae42084de3e0c",
                         "type": "inject",
                         "z": "5dbdd0fd840b4eee",
                         "name": "",
                         "props": [
                             {
                                 "p": "payload"
                             },
                             {
                                 "p": "topic",
                                 "vt": "str"
                             }
                         ],
                         "repeat": "",
                         "crontab": "",
                         "once": false,
                         "onceDelay": 0.1,
                         "topic": "Bezug täglich",
                         "payload": "20.1",
                         "payloadType": "num",
                         "x": 110,
                         "y": 120,
                         "wires": [
                             [
                                 "fbcf46d8f94203aa"
                             ]
                         ]
                     },
                     {
                         "id": "c097566fbf70cacc",
                         "type": "json",
                         "z": "5dbdd0fd840b4eee",
                         "name": "",
                         "property": "payload",
                         "action": "",
                         "pretty": false,
                         "x": 1170,
                         "y": 220,
                         "wires": [
                             [
                                 "10bd7990f72c7776"
                             ]
                         ]
                     }
                  ]
                  

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

                  Ich denke, ich muss den ganzen Flow etwas umstellen, damit es auch einigermaßen effizient wird. Also vergiß Deinen/Meinen bisherigen Flow.

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

                    @mickym
                    Konntest du dir den Flow zur Monatslänge (von 9:48 Uhr) mal anschauen? Ich habe da eine globale Variable "Monatstage" definiert.

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

                      @martybr Warum das nun wieder - ich habe den Flow nun fertig und wenn der Monat wechselt wird automatisch ein neuer Datenpunkt durch Deinen Subflow angelegt und auch eingelesen.

                      Nein Sorry - Du hast Recht, wenn sich das Topic ändert, dann muss die Flowvariable noch gelöscht werden. Habe ich vergessen.

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

                        @mickym
                        Vielleicht irre ich mich auch. Ich habe von einem lieben Bekannten ein JavaScript, welches über die Werte iteriert. Hier werden die Zahl der Tage im Monat benötigt. Ich versuche hier mit deiner Hilfe Node-Red zu verstehen, da mich Javascript nicht angesprochen hat. Da gibt es mit async etc. genügend Fallstricke.
                        Daher kommen manche meiner Fragen, die für die bestimmt selbstverständlich sind. Ich fange ja gerade erst mit Node-Red an. Das Buch das ich mir gekauft habe war nicht so toll.
                        Einges habe ich schon in Node-Red umsetzen können:
                        Meine Bewegungsmelder mit Zeitsteuerung und Sperre bei manuellem Auslösen und mit deiner Hilfe die Speicherung von Strombezug und Einspeisung.
                        Ich konnte mit den Flows das ganze und weitere Anwendungen umsetzen, z.B. Wasserverbrauch, Gartenwasser, Solareinspeisung. Dadurch habe ich das Potential von Node-Red erkannt. Nun habe ich Zeit und versuche mich tiefer einzuarbeiten 😇

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

                          @martybr Ja ich schau mir das gleich an -

                          Aber zu deinem Flow mit den dynamischen Monatsarrays habe ich eine andere Lösung, da brauchst du die Zahl nicht. Sprich wenn sich das topic ändert, dann wird die bisherige flow Variable gelöscht und eine neue erstellt. Schau Dir erst mal den neuen Flow an:

                          57807547-2b59-4a63-9397-78760c0864a3-image.png

                          [
                             {
                                 "id": "ae673cf6cd8433a0",
                                 "type": "subflow",
                                 "name": "Datum in Topic",
                                 "info": "",
                                 "category": "",
                                 "in": [
                                     {
                                         "x": 60,
                                         "y": 80,
                                         "wires": [
                                             {
                                                 "id": "2e1ea06b2e94bf1a"
                                             }
                                         ]
                                     }
                                 ],
                                 "out": [
                                     {
                                         "x": 820,
                                         "y": 80,
                                         "wires": [
                                             {
                                                 "id": "fc37f5f9d2b0297b",
                                                 "port": 0
                                             }
                                         ]
                                     }
                                 ],
                                 "env": [
                                     {
                                         "name": "basePath",
                                         "type": "str",
                                         "value": "Test1.Test2"
                                     }
                                 ],
                                 "meta": {},
                                 "color": "#DDAA99"
                             },
                             {
                                 "id": "2e1ea06b2e94bf1a",
                                 "type": "change",
                                 "z": "ae673cf6cd8433a0",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "datum",
                                         "pt": "msg",
                                         "to": "$moment().locale('de').format('YYYY.MMMM')",
                                         "tot": "jsonata"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 230,
                                 "y": 80,
                                 "wires": [
                                     [
                                         "0e8de9437c3c420a"
                                     ]
                                 ]
                             },
                             {
                                 "id": "0e8de9437c3c420a",
                                 "type": "change",
                                 "z": "ae673cf6cd8433a0",
                                 "name": "März zu Maerz",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "datum",
                                         "pt": "msg",
                                         "from": "März",
                                         "fromt": "str",
                                         "to": "Maerz",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 440,
                                 "y": 80,
                                 "wires": [
                                     [
                                         "fc37f5f9d2b0297b"
                                     ]
                                 ]
                             },
                             {
                                 "id": "fc37f5f9d2b0297b",
                                 "type": "change",
                                 "z": "ae673cf6cd8433a0",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "topic",
                                         "pt": "msg",
                                         "to": "\"0_userdata.0.\"  & $env(\"basePath\") & \".\" & datum & \".\" & topic",
                                         "tot": "jsonata"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 660,
                                 "y": 80,
                                 "wires": [
                                     []
                                 ]
                             },
                             {
                                 "id": "10bd7990f72c7776",
                                 "type": "ioBroker out",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "topic": "",
                                 "ack": "true",
                                 "autoCreate": "true",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "false",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 2560,
                                 "y": 160,
                                 "wires": []
                             },
                             {
                                 "id": "fbcf46d8f94203aa",
                                 "type": "change",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "Bezug",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "topic",
                                         "pt": "msg",
                                         "to": "Strombezug",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 350,
                                 "y": 120,
                                 "wires": [
                                     [
                                         "147888cb9d8dbd57"
                                     ]
                                 ]
                             },
                             {
                                 "id": "a435b3ce1f53ba74",
                                 "type": "ioBroker in",
                                 "z": "5dbdd0fd840b4eee",
                                 "d": true,
                                 "name": "Bezug täglich",
                                 "attrname": "payload",
                                 "topic": "0_userdata.0.Zaehler.Strombezug.Verbrauch.täglich",
                                 "payloadType": "value",
                                 "onlyack": "",
                                 "func": "all",
                                 "gap": "",
                                 "fireOnStart": "true",
                                 "outFormat": "MQTT",
                                 "x": 170,
                                 "y": 160,
                                 "wires": [
                                     [
                                         "fbcf46d8f94203aa"
                                     ]
                                 ]
                             },
                             {
                                 "id": "779ae42084de3e0c",
                                 "type": "inject",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "props": [
                                     {
                                         "p": "payload"
                                     },
                                     {
                                         "p": "topic",
                                         "vt": "str"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "Bezug täglich",
                                 "payload": "19.1",
                                 "payloadType": "num",
                                 "x": 170,
                                 "y": 120,
                                 "wires": [
                                     [
                                         "fbcf46d8f94203aa"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c097566fbf70cacc",
                                 "type": "json",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 2390,
                                 "y": 160,
                                 "wires": [
                                     [
                                         "10bd7990f72c7776"
                                     ]
                                 ]
                             },
                             {
                                 "id": "6ece1ca957375987",
                                 "type": "switch",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "topic geändert?",
                                 "property": "topic",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "neq",
                                         "v": "",
                                         "vt": "prev"
                                     },
                                     {
                                         "t": "eq",
                                         "v": "",
                                         "vt": "prev"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 2,
                                 "x": 720,
                                 "y": 120,
                                 "wires": [
                                     [
                                         "eaac747b9c1b37da"
                                     ],
                                     [
                                         "102ed68150c3074f"
                                     ]
                                 ]
                             },
                             {
                                 "id": "147888cb9d8dbd57",
                                 "type": "subflow:ae673cf6cd8433a0",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "env": [
                                     {
                                         "name": "basePath",
                                         "value": "Test1.Test5.MonatsTabellen",
                                         "type": "str"
                                     }
                                 ],
                                 "x": 520,
                                 "y": 120,
                                 "wires": [
                                     [
                                         "6ece1ca957375987"
                                     ]
                                 ]
                             },
                             {
                                 "id": "82c856dec8c7af8d",
                                 "type": "ioBroker get",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "errOnInvalidState": "false",
                                 "x": 1260,
                                 "y": 80,
                                 "wires": [
                                     [
                                         "95d876ec9e825008"
                                     ]
                                 ]
                             },
                             {
                                 "id": "2672eebe41c3d35a",
                                 "type": "json",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 1650,
                                 "y": 100,
                                 "wires": [
                                     [
                                         "e7b2c3dba88f7574"
                                     ]
                                 ]
                             },
                             {
                                 "id": "95d876ec9e825008",
                                 "type": "switch",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "IoB read ?",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "null"
                                     },
                                     {
                                         "t": "nnull"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 2,
                                 "x": 1450,
                                 "y": 80,
                                 "wires": [
                                     [
                                         "d2e703aaee60b32c"
                                     ],
                                     [
                                         "2672eebe41c3d35a"
                                     ]
                                 ]
                             },
                             {
                                 "id": "d2e703aaee60b32c",
                                 "type": "change",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "[]",
                                         "tot": "json"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1650,
                                 "y": 60,
                                 "wires": [
                                     [
                                         "e7b2c3dba88f7574"
                                     ]
                                 ]
                             },
                             {
                                 "id": "eaac747b9c1b37da",
                                 "type": "change",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "payload sichern und flow var löschen",
                                 "rules": [
                                     {
                                         "t": "move",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "payload_bak",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "delete",
                                         "p": "array_bezug",
                                         "pt": "flow"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 990,
                                 "y": 80,
                                 "wires": [
                                     [
                                         "82c856dec8c7af8d"
                                     ]
                                 ]
                             },
                             {
                                 "id": "a89ae99abd8609c0",
                                 "type": "change",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "payload anhängen und sichern",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "$append(array_bezug, payload)",
                                         "tot": "jsonata"
                                     },
                                     {
                                         "t": "set",
                                         "p": "array_bezug",
                                         "pt": "flow",
                                         "to": "payload",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 2170,
                                 "y": 160,
                                 "wires": [
                                     [
                                         "c097566fbf70cacc"
                                     ]
                                 ]
                             },
                             {
                                 "id": "102ed68150c3074f",
                                 "type": "change",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "array_bezug",
                                         "pt": "msg",
                                         "to": "array_bezug",
                                         "tot": "flow"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 950,
                                 "y": 160,
                                 "wires": [
                                     [
                                         "a89ae99abd8609c0"
                                     ]
                                 ]
                             },
                             {
                                 "id": "e7b2c3dba88f7574",
                                 "type": "change",
                                 "z": "5dbdd0fd840b4eee",
                                 "name": "payload wiederherstellen",
                                 "rules": [
                                     {
                                         "t": "move",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "array_bezug",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "move",
                                         "p": "payload_bak",
                                         "pt": "msg",
                                         "to": "payload",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1890,
                                 "y": 80,
                                 "wires": [
                                     [
                                         "a89ae99abd8609c0"
                                     ]
                                 ]
                             }
                          ]
                          

                          und schau, ob Du den verstehst. Ansonsten schaun ich mir Deinen Flow gerne an - aber ich verstehe immer nicht, warum mit JS in NodeRed arbeitet - ich rate Dir immer, die function Nodes wenn möglich immer zu meiden. Für Deine dynamischen Datenpunkte solltest Du es nicht brauchen. Ich habe übrigens mal einen Flow gemacht, den Du Dir auch mal anschauen solltest.

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

                            @martybr sagte in Wert in dynamische Struktur im ioBroker ablegen:

                            @mickym
                            Ich habe hier noch ein Problem, die Zahl der Tage im Monat in eine globale Variable zu schreiben. Statt der 28 Tage aus der Funktion liefert mir der Change Node nur payload == 5

                            Bildschirmfoto 2025-02-07 um 08.23.20.png

                            [
                                {
                                    "id": "f6ed836d74798c7f",
                                    "type": "inject",
                                    "z": "3ebdbbcf49e0ac40",
                                    "name": "",
                                    "props": [
                                        {
                                            "p": "payload"
                                        },
                                        {
                                            "p": "topic",
                                            "vt": "str"
                                        }
                                    ],
                                    "repeat": "",
                                    "crontab": "",
                                    "once": false,
                                    "onceDelay": 0.1,
                                    "topic": "",
                                    "payload": "",
                                    "payloadType": "date",
                                    "x": 100,
                                    "y": 400,
                                    "wires": [
                                        [
                                            "a3434007e702fcdc"
                                        ]
                                    ]
                                },
                                {
                                    "id": "7a09df47bef16411",
                                    "type": "function",
                                    "z": "3ebdbbcf49e0ac40",
                                    "name": "function 1",
                                    "func": "// Eingabe: msg.payload sollte ein Datum im Format 'YYYY-MM-DD' sein\nlet inputDate = new Date(msg.payload);\n\n// Hole den Monat und das Jahr\nlet month = inputDate.getMonth(); // 0-11\nlet year = inputDate.getFullYear();\n\n// Berechne die Anzahl der Tage im Monat\nlet daysInMonth = new Date(year, month + 1, 0).getDate();\n\n// Setze das Ergebnis in msg.payload\nmsg.payload = daysInMonth;\n\nreturn msg;",
                                    "outputs": 1,
                                    "timeout": 0,
                                    "noerr": 0,
                                    "initialize": "",
                                    "finalize": "",
                                    "libs": [],
                                    "x": 480,
                                    "y": 400,
                                    "wires": [
                                        [
                                            "599b66169127c12d",
                                            "185c42081279a5e0"
                                        ]
                                    ]
                                },
                                {
                                    "id": "a3434007e702fcdc",
                                    "type": "change",
                                    "z": "3ebdbbcf49e0ac40",
                                    "name": "",
                                    "rules": [
                                        {
                                            "t": "set",
                                            "p": "payload",
                                            "pt": "msg",
                                            "to": "$moment().locale('de').format('YYYY.MM.DD')",
                                            "tot": "jsonata"
                                        }
                                    ],
                                    "action": "",
                                    "property": "",
                                    "from": "",
                                    "to": "",
                                    "reg": false,
                                    "x": 290,
                                    "y": 400,
                                    "wires": [
                                        [
                                            "7a09df47bef16411"
                                        ]
                                    ]
                                },
                                {
                                    "id": "d8d647f4ae028cb8",
                                    "type": "debug",
                                    "z": "3ebdbbcf49e0ac40",
                                    "name": "debug 182",
                                    "active": true,
                                    "tosidebar": true,
                                    "console": false,
                                    "tostatus": false,
                                    "complete": "false",
                                    "statusVal": "",
                                    "statusType": "auto",
                                    "x": 670,
                                    "y": 320,
                                    "wires": []
                                },
                                {
                                    "id": "599b66169127c12d",
                                    "type": "change",
                                    "z": "3ebdbbcf49e0ac40",
                                    "name": "Monatstage",
                                    "rules": [
                                        {
                                            "t": "move",
                                            "p": "payload",
                                            "pt": "msg",
                                            "to": "monatstage",
                                            "tot": "global"
                                        }
                                    ],
                                    "action": "",
                                    "property": "",
                                    "from": "",
                                    "to": "",
                                    "reg": false,
                                    "x": 650,
                                    "y": 400,
                                    "wires": [
                                        [
                                            "d8d647f4ae028cb8"
                                        ]
                                    ]
                                },
                                {
                                    "id": "185c42081279a5e0",
                                    "type": "debug",
                                    "z": "3ebdbbcf49e0ac40",
                                    "name": "debug 183",
                                    "active": true,
                                    "tosidebar": true,
                                    "console": false,
                                    "tostatus": false,
                                    "complete": "false",
                                    "statusVal": "",
                                    "statusType": "auto",
                                    "x": 590,
                                    "y": 480,
                                    "wires": []
                                }
                            ]
                            

                            Das kann ich leider nicht nachvollziehen, bei mir funktioniert der Flow einwandfrei:

                            c55b16d5-fe6b-49ce-b3b7-5cdfca82cca6-image.png

                            Ich schau trotzdem mal kurz, ob man das mit $moments direkt erledigen kann.

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

                              @mickym
                              Stimmt, bei mir liefert er nun die richtige Anzahl der Tage.

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

                                @martybr sagte in Wert in dynamische Struktur im ioBroker ablegen:

                                @mickym
                                Stimmt, bei mir liefert er nun die richtige Anzahl der Tage.

                                Ok - dann passt ja alles - ich bin dann erst mal weg - schau dann am Abend nochmal vorbei. Schau Dir mal den neuen Flow - für Deine Arrays und dynam. Datenpunkte derweil an.

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

                                  @mickym
                                  Es sieht alles gut aus. Ich werde mir das genau anschauen und danke dir für deine Hilfe.

                                  M 1 Reply Last reply Reply Quote 0
                                  • M
                                    MartyBr @MartyBr last edited by

                                    Ich habe den Flow für die Mittelwertbildung auf den Node aggregate umgestellt.
                                    Die Delays dienen der richtigen Reihenfolge der drei Werte min, mean und max im Json. Das ganze wird in einem fortlaufenden Array unter Jahr.Monat abgelegt.

                                    Hier der Flow, der zumindest bei mir ohne Fehler erfolgreich läuft.

                                    [
                                        {
                                            "id": "ae673cf6cd8433a0",
                                            "type": "subflow",
                                            "name": "Datum in Topic",
                                            "info": "",
                                            "category": "",
                                            "in": [
                                                {
                                                    "x": 60,
                                                    "y": 80,
                                                    "wires": [
                                                        {
                                                            "id": "2e1ea06b2e94bf1a"
                                                        }
                                                    ]
                                                }
                                            ],
                                            "out": [
                                                {
                                                    "x": 820,
                                                    "y": 80,
                                                    "wires": [
                                                        {
                                                            "id": "fc37f5f9d2b0297b",
                                                            "port": 0
                                                        }
                                                    ]
                                                }
                                            ],
                                            "env": [
                                                {
                                                    "name": "basePath",
                                                    "type": "str",
                                                    "value": "Test1.Test2"
                                                }
                                            ],
                                            "meta": {},
                                            "color": "#DDAA99"
                                        },
                                        {
                                            "id": "2e1ea06b2e94bf1a",
                                            "type": "change",
                                            "z": "ae673cf6cd8433a0",
                                            "name": "",
                                            "rules": [
                                                {
                                                    "t": "set",
                                                    "p": "datum",
                                                    "pt": "msg",
                                                    "to": "$moment().locale('de').format('YYYY.MMMM')",
                                                    "tot": "jsonata"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 230,
                                            "y": 80,
                                            "wires": [
                                                [
                                                    "0e8de9437c3c420a"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "0e8de9437c3c420a",
                                            "type": "change",
                                            "z": "ae673cf6cd8433a0",
                                            "name": "März zu Maerz",
                                            "rules": [
                                                {
                                                    "t": "change",
                                                    "p": "datum",
                                                    "pt": "msg",
                                                    "from": "März",
                                                    "fromt": "str",
                                                    "to": "Maerz",
                                                    "tot": "str"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 440,
                                            "y": 80,
                                            "wires": [
                                                [
                                                    "fc37f5f9d2b0297b"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "fc37f5f9d2b0297b",
                                            "type": "change",
                                            "z": "ae673cf6cd8433a0",
                                            "name": "",
                                            "rules": [
                                                {
                                                    "t": "set",
                                                    "p": "topic",
                                                    "pt": "msg",
                                                    "to": "\"0_userdata.0.\"  & $env(\"basePath\") & \".\" & datum & \".\" & topic",
                                                    "tot": "jsonata"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 660,
                                            "y": 80,
                                            "wires": [
                                                []
                                            ]
                                        },
                                        {
                                            "id": "8c459eb88d1bf5f1",
                                            "type": "tab",
                                            "label": "Mittelwert",
                                            "disabled": false,
                                            "info": "",
                                            "env": []
                                        },
                                        {
                                            "id": "9b11db08a1cca5b3",
                                            "type": "aggregator",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "Mean",
                                            "topic": "mean",
                                            "intervalCount": "1",
                                            "intervalUnits": "d",
                                            "submitIncompleteInterval": true,
                                            "submitPerTopic": false,
                                            "aggregationType": "mean",
                                            "x": 290,
                                            "y": 260,
                                            "wires": [
                                                [
                                                    "0290eb1787934b73"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "f33e1d253e22a2dd",
                                            "type": "ioBroker in",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "Aussentemperatur",
                                            "attrname": "payload",
                                            "topic": "mqtt.0.vitocal.outside_temperature",
                                            "payloadType": "value",
                                            "onlyack": "",
                                            "func": "all",
                                            "gap": "",
                                            "fireOnStart": "false",
                                            "outFormat": "MQTT",
                                            "x": 110,
                                            "y": 260,
                                            "wires": [
                                                [
                                                    "5a18bba8160e8e94",
                                                    "9b11db08a1cca5b3",
                                                    "32753fd69085ce71"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "5a18bba8160e8e94",
                                            "type": "aggregator",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "Min",
                                            "topic": "min",
                                            "intervalCount": "1",
                                            "intervalUnits": "d",
                                            "submitIncompleteInterval": true,
                                            "submitPerTopic": false,
                                            "aggregationType": "min",
                                            "x": 290,
                                            "y": 200,
                                            "wires": [
                                                [
                                                    "15a56c790ce29f8d"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "32753fd69085ce71",
                                            "type": "aggregator",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "Max",
                                            "topic": "max",
                                            "intervalCount": "1",
                                            "intervalUnits": "d",
                                            "submitIncompleteInterval": true,
                                            "submitPerTopic": false,
                                            "aggregationType": "max",
                                            "x": 290,
                                            "y": 320,
                                            "wires": [
                                                [
                                                    "7a8c3b56e65b5059"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "15a56c790ce29f8d",
                                            "type": "join",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "mode": "custom",
                                            "build": "object",
                                            "property": "payload",
                                            "propertyType": "msg",
                                            "key": "topic",
                                            "joiner": "\\n",
                                            "joinerType": "str",
                                            "accumulate": true,
                                            "timeout": "60",
                                            "count": "3",
                                            "reduceRight": false,
                                            "reduceExp": "",
                                            "reduceInit": "",
                                            "reduceInitType": "",
                                            "reduceFixup": "",
                                            "x": 670,
                                            "y": 200,
                                            "wires": [
                                                [
                                                    "8ef8ee85844f2bb2"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "8ef8ee85844f2bb2",
                                            "type": "change",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "rules": [
                                                {
                                                    "t": "set",
                                                    "p": "topic",
                                                    "pt": "msg",
                                                    "to": "meanTmp",
                                                    "tot": "str"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 840,
                                            "y": 200,
                                            "wires": [
                                                [
                                                    "5d3e4f7dea0efe7c"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "5d3e4f7dea0efe7c",
                                            "type": "subflow:ae673cf6cd8433a0",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "Datum in Topic",
                                            "env": [
                                                {
                                                    "name": "basePath",
                                                    "value": "Heizung1.MonatsTabellen",
                                                    "type": "str"
                                                }
                                            ],
                                            "x": 1040,
                                            "y": 200,
                                            "wires": [
                                                [
                                                    "9aa634789fccf445"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "e44c746b92947c39",
                                            "type": "ioBroker out",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "topic": "",
                                            "ack": "true",
                                            "autoCreate": "true",
                                            "stateName": "",
                                            "role": "",
                                            "payloadType": "",
                                            "readonly": "false",
                                            "stateUnit": "°C",
                                            "stateMin": "",
                                            "stateMax": "",
                                            "x": 2920,
                                            "y": 280,
                                            "wires": []
                                        },
                                        {
                                            "id": "0290eb1787934b73",
                                            "type": "delay",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "pauseType": "delay",
                                            "timeout": "5",
                                            "timeoutUnits": "seconds",
                                            "rate": "1",
                                            "nbRateUnits": "1",
                                            "rateUnits": "second",
                                            "randomFirst": "1",
                                            "randomLast": "5",
                                            "randomUnits": "seconds",
                                            "drop": false,
                                            "allowrate": false,
                                            "outputs": 1,
                                            "x": 460,
                                            "y": 260,
                                            "wires": [
                                                [
                                                    "15a56c790ce29f8d"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "7a8c3b56e65b5059",
                                            "type": "delay",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "pauseType": "delay",
                                            "timeout": "10",
                                            "timeoutUnits": "seconds",
                                            "rate": "1",
                                            "nbRateUnits": "1",
                                            "rateUnits": "second",
                                            "randomFirst": "1",
                                            "randomLast": "5",
                                            "randomUnits": "seconds",
                                            "drop": false,
                                            "allowrate": false,
                                            "outputs": 1,
                                            "x": 470,
                                            "y": 320,
                                            "wires": [
                                                [
                                                    "15a56c790ce29f8d"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "9aa634789fccf445",
                                            "type": "switch",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "topic geändert?",
                                            "property": "topic",
                                            "propertyType": "msg",
                                            "rules": [
                                                {
                                                    "t": "neq",
                                                    "v": "",
                                                    "vt": "prev"
                                                },
                                                {
                                                    "t": "eq",
                                                    "v": "",
                                                    "vt": "prev"
                                                }
                                            ],
                                            "checkall": "true",
                                            "repair": false,
                                            "outputs": 2,
                                            "x": 1240,
                                            "y": 200,
                                            "wires": [
                                                [
                                                    "c7fa49ea854690ed"
                                                ],
                                                [
                                                    "edaece611a7db6d5"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "c7fa49ea854690ed",
                                            "type": "change",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "payload sichern und flow var löschen",
                                            "rules": [
                                                {
                                                    "t": "move",
                                                    "p": "payload",
                                                    "pt": "msg",
                                                    "to": "payload_bak_mean",
                                                    "tot": "msg"
                                                },
                                                {
                                                    "t": "delete",
                                                    "p": "array_mean",
                                                    "pt": "flow"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 1530,
                                            "y": 180,
                                            "wires": [
                                                [
                                                    "7fd2bba1daf6d9f3"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "edaece611a7db6d5",
                                            "type": "change",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "rules": [
                                                {
                                                    "t": "set",
                                                    "p": "array_bezug",
                                                    "pt": "msg",
                                                    "to": "array_bezug",
                                                    "tot": "flow"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 1490,
                                            "y": 280,
                                            "wires": [
                                                [
                                                    "515ae9918126f535"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "7fd2bba1daf6d9f3",
                                            "type": "ioBroker get",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "topic": "",
                                            "attrname": "payload",
                                            "payloadType": "value",
                                            "errOnInvalidState": "false",
                                            "x": 1800,
                                            "y": 180,
                                            "wires": [
                                                [
                                                    "6e576a4e6d33f548"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "6e576a4e6d33f548",
                                            "type": "switch",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "IoB read ?",
                                            "property": "payload",
                                            "propertyType": "msg",
                                            "rules": [
                                                {
                                                    "t": "null"
                                                },
                                                {
                                                    "t": "nnull"
                                                }
                                            ],
                                            "checkall": "true",
                                            "repair": false,
                                            "outputs": 2,
                                            "x": 2010,
                                            "y": 180,
                                            "wires": [
                                                [
                                                    "ba58ec451fbfa53e"
                                                ],
                                                [
                                                    "ae2e0346dd5f3824"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "ba58ec451fbfa53e",
                                            "type": "change",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "rules": [
                                                {
                                                    "t": "set",
                                                    "p": "payload",
                                                    "pt": "msg",
                                                    "to": "[]",
                                                    "tot": "json"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 2250,
                                            "y": 160,
                                            "wires": [
                                                [
                                                    "db03a4ed74093df5"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "ae2e0346dd5f3824",
                                            "type": "json",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "property": "payload",
                                            "action": "",
                                            "pretty": false,
                                            "x": 2230,
                                            "y": 220,
                                            "wires": [
                                                [
                                                    "db03a4ed74093df5"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "db03a4ed74093df5",
                                            "type": "change",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "payload wiederherstellen",
                                            "rules": [
                                                {
                                                    "t": "move",
                                                    "p": "payload",
                                                    "pt": "msg",
                                                    "to": "array_mean",
                                                    "tot": "msg"
                                                },
                                                {
                                                    "t": "move",
                                                    "p": "payload_bak_mean",
                                                    "pt": "msg",
                                                    "to": "payload",
                                                    "tot": "msg"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 2490,
                                            "y": 160,
                                            "wires": [
                                                [
                                                    "515ae9918126f535"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "515ae9918126f535",
                                            "type": "change",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "payload anhängen und sichern",
                                            "rules": [
                                                {
                                                    "t": "set",
                                                    "p": "payload",
                                                    "pt": "msg",
                                                    "to": "$append(array_mean, payload)",
                                                    "tot": "jsonata"
                                                },
                                                {
                                                    "t": "set",
                                                    "p": "array_mean",
                                                    "pt": "flow",
                                                    "to": "payload",
                                                    "tot": "msg"
                                                }
                                            ],
                                            "action": "",
                                            "property": "",
                                            "from": "",
                                            "to": "",
                                            "reg": false,
                                            "x": 2510,
                                            "y": 280,
                                            "wires": [
                                                [
                                                    "0427391d23dcb6ad"
                                                ]
                                            ]
                                        },
                                        {
                                            "id": "0427391d23dcb6ad",
                                            "type": "json",
                                            "z": "8c459eb88d1bf5f1",
                                            "name": "",
                                            "property": "payload",
                                            "action": "",
                                            "pretty": false,
                                            "x": 2750,
                                            "y": 280,
                                            "wires": [
                                                [
                                                    "e44c746b92947c39"
                                                ]
                                            ]
                                        }
                                    ]
                                    
                                    M 1 Reply Last reply Reply Quote 0
                                    • M
                                      MartyBr @MartyBr last edited by MartyBr

                                      @mickym
                                      Ich habe noch eine Frage zu dem u.a. Flow. Ich würde gerne den Payload min, mean und max
                                      an die Tagesposition schieben.
                                      Also das bedeutet heute (09.02.2025) die 9 Position, das das Element 8.
                                      Man könnte doch mit einem Function Node den Code

                                      let i ===global.monatstage
                                      i = i-1

                                      msg.payload[i] = msg.payload[i].state

                                      schreiben. Ich habe Monatstage als globale Variable definiert.
                                      Mein Problem ist aber im Change node das append. Das widerspricht ja die Nutzung der Function Node.

                                      Hast du einen Tipp für mich?

                                      EDIT:
                                      Ich habe in der Doku gesehen, dass auch in der Change Node mit JSONata mit $sum(payload.state in die Elemente des Arrays geschrieben werden kann.

                                      Bildschirmfoto 2025-02-09 um 17.34.27.png

                                      Bildschirmfoto 2025-02-09 um 17.34.45.png

                                      Bildschirmfoto 2025-02-09 um 17.34.57.png

                                      Array Mean:

                                      [
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": -4,
                                          "mean": 0.05,
                                          "max": 3.3
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        },
                                        {
                                          "min": 0,
                                          "mean": 0,
                                          "max": 0
                                        }
                                      ]
                                      
                                      code_tex[
                                          {
                                              "id": "ae673cf6cd8433a0",
                                              "type": "subflow",
                                              "name": "Datum in Topic",
                                              "info": "",
                                              "category": "",
                                              "in": [
                                                  {
                                                      "x": 60,
                                                      "y": 80,
                                                      "wires": [
                                                          {
                                                              "id": "2e1ea06b2e94bf1a"
                                                          }
                                                      ]
                                                  }
                                              ],
                                              "out": [
                                                  {
                                                      "x": 820,
                                                      "y": 80,
                                                      "wires": [
                                                          {
                                                              "id": "fc37f5f9d2b0297b",
                                                              "port": 0
                                                          }
                                                      ]
                                                  }
                                              ],
                                              "env": [
                                                  {
                                                      "name": "basePath",
                                                      "type": "str",
                                                      "value": "Test1.Test2"
                                                  }
                                              ],
                                              "meta": {},
                                              "color": "#DDAA99"
                                          },
                                          {
                                              "id": "2e1ea06b2e94bf1a",
                                              "type": "change",
                                              "z": "ae673cf6cd8433a0",
                                              "name": "",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "datum",
                                                      "pt": "msg",
                                                      "to": "$moment().locale('de').format('YYYY.MMMM')",
                                                      "tot": "jsonata"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 230,
                                              "y": 80,
                                              "wires": [
                                                  [
                                                      "0e8de9437c3c420a"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "0e8de9437c3c420a",
                                              "type": "change",
                                              "z": "ae673cf6cd8433a0",
                                              "name": "März zu Maerz",
                                              "rules": [
                                                  {
                                                      "t": "change",
                                                      "p": "datum",
                                                      "pt": "msg",
                                                      "from": "März",
                                                      "fromt": "str",
                                                      "to": "Maerz",
                                                      "tot": "str"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 440,
                                              "y": 80,
                                              "wires": [
                                                  [
                                                      "fc37f5f9d2b0297b"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "fc37f5f9d2b0297b",
                                              "type": "change",
                                              "z": "ae673cf6cd8433a0",
                                              "name": "",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "topic",
                                                      "pt": "msg",
                                                      "to": "\"0_userdata.0.\"  & $env(\"basePath\") & \".\" & datum & \".\" & topic",
                                                      "tot": "jsonata"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 660,
                                              "y": 80,
                                              "wires": [
                                                  []
                                              ]
                                          },
                                          {
                                              "id": "9b11db08a1cca5b3",
                                              "type": "aggregator",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "Mean",
                                              "topic": "mean",
                                              "intervalCount": "1",
                                              "intervalUnits": "h",
                                              "submitIncompleteInterval": true,
                                              "submitPerTopic": false,
                                              "aggregationType": "mean",
                                              "x": 290,
                                              "y": 260,
                                              "wires": [
                                                  [
                                                      "0290eb1787934b73"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "f33e1d253e22a2dd",
                                              "type": "ioBroker in",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "Aussentemperatur",
                                              "attrname": "payload",
                                              "topic": "mqtt.0.vitocal.outside_temperature",
                                              "payloadType": "value",
                                              "onlyack": "",
                                              "func": "all",
                                              "gap": "",
                                              "fireOnStart": "false",
                                              "outFormat": "MQTT",
                                              "x": 110,
                                              "y": 260,
                                              "wires": [
                                                  [
                                                      "5a18bba8160e8e94",
                                                      "9b11db08a1cca5b3",
                                                      "32753fd69085ce71"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "5a18bba8160e8e94",
                                              "type": "aggregator",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "Min",
                                              "topic": "min",
                                              "intervalCount": "1",
                                              "intervalUnits": "h",
                                              "submitIncompleteInterval": true,
                                              "submitPerTopic": false,
                                              "aggregationType": "min",
                                              "x": 290,
                                              "y": 200,
                                              "wires": [
                                                  [
                                                      "15a56c790ce29f8d"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "32753fd69085ce71",
                                              "type": "aggregator",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "Max",
                                              "topic": "max",
                                              "intervalCount": "1",
                                              "intervalUnits": "h",
                                              "submitIncompleteInterval": true,
                                              "submitPerTopic": false,
                                              "aggregationType": "max",
                                              "x": 290,
                                              "y": 320,
                                              "wires": [
                                                  [
                                                      "7a8c3b56e65b5059"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "15a56c790ce29f8d",
                                              "type": "join",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "mode": "custom",
                                              "build": "object",
                                              "property": "payload",
                                              "propertyType": "msg",
                                              "key": "topic",
                                              "joiner": "\\n",
                                              "joinerType": "str",
                                              "accumulate": true,
                                              "timeout": "60",
                                              "count": "3",
                                              "reduceRight": false,
                                              "reduceExp": "",
                                              "reduceInit": "",
                                              "reduceInitType": "",
                                              "reduceFixup": "",
                                              "x": 670,
                                              "y": 200,
                                              "wires": [
                                                  [
                                                      "8ef8ee85844f2bb2"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "8ef8ee85844f2bb2",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "topic",
                                                      "pt": "msg",
                                                      "to": "meanTmp",
                                                      "tot": "str"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 840,
                                              "y": 200,
                                              "wires": [
                                                  [
                                                      "5d3e4f7dea0efe7c"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "5d3e4f7dea0efe7c",
                                              "type": "subflow:ae673cf6cd8433a0",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "Datum in Topic",
                                              "env": [
                                                  {
                                                      "name": "basePath",
                                                      "value": "Heizung1.MonatsTabellen",
                                                      "type": "str"
                                                  }
                                              ],
                                              "x": 1040,
                                              "y": 200,
                                              "wires": [
                                                  [
                                                      "9aa634789fccf445"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "e44c746b92947c39",
                                              "type": "ioBroker out",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "topic": "",
                                              "ack": "true",
                                              "autoCreate": "true",
                                              "stateName": "",
                                              "role": "",
                                              "payloadType": "",
                                              "readonly": "false",
                                              "stateUnit": "°C",
                                              "stateMin": "",
                                              "stateMax": "",
                                              "x": 2920,
                                              "y": 280,
                                              "wires": []
                                          },
                                          {
                                              "id": "0290eb1787934b73",
                                              "type": "delay",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "pauseType": "delay",
                                              "timeout": "5",
                                              "timeoutUnits": "seconds",
                                              "rate": "1",
                                              "nbRateUnits": "1",
                                              "rateUnits": "second",
                                              "randomFirst": "1",
                                              "randomLast": "5",
                                              "randomUnits": "seconds",
                                              "drop": false,
                                              "allowrate": false,
                                              "outputs": 1,
                                              "x": 460,
                                              "y": 260,
                                              "wires": [
                                                  [
                                                      "15a56c790ce29f8d"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "7a8c3b56e65b5059",
                                              "type": "delay",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "pauseType": "delay",
                                              "timeout": "10",
                                              "timeoutUnits": "seconds",
                                              "rate": "1",
                                              "nbRateUnits": "1",
                                              "rateUnits": "second",
                                              "randomFirst": "1",
                                              "randomLast": "5",
                                              "randomUnits": "seconds",
                                              "drop": false,
                                              "allowrate": false,
                                              "outputs": 1,
                                              "x": 470,
                                              "y": 320,
                                              "wires": [
                                                  [
                                                      "15a56c790ce29f8d"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "9aa634789fccf445",
                                              "type": "switch",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "topic geändert?",
                                              "property": "topic",
                                              "propertyType": "msg",
                                              "rules": [
                                                  {
                                                      "t": "neq",
                                                      "v": "",
                                                      "vt": "prev"
                                                  },
                                                  {
                                                      "t": "eq",
                                                      "v": "",
                                                      "vt": "prev"
                                                  }
                                              ],
                                              "checkall": "true",
                                              "repair": false,
                                              "outputs": 2,
                                              "x": 1240,
                                              "y": 200,
                                              "wires": [
                                                  [
                                                      "c7fa49ea854690ed"
                                                  ],
                                                  [
                                                      "edaece611a7db6d5"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "c7fa49ea854690ed",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "payload sichern und flow var löschen",
                                              "rules": [
                                                  {
                                                      "t": "move",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "payload_bak_mean",
                                                      "tot": "msg"
                                                  },
                                                  {
                                                      "t": "delete",
                                                      "p": "array_mean",
                                                      "pt": "flow"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 1530,
                                              "y": 180,
                                              "wires": [
                                                  [
                                                      "7fd2bba1daf6d9f3"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "edaece611a7db6d5",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "array_bezug",
                                                      "pt": "msg",
                                                      "to": "array_bezug",
                                                      "tot": "flow"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 1490,
                                              "y": 280,
                                              "wires": [
                                                  [
                                                      "515ae9918126f535"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "7fd2bba1daf6d9f3",
                                              "type": "ioBroker get",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "topic": "",
                                              "attrname": "payload",
                                              "payloadType": "value",
                                              "errOnInvalidState": "false",
                                              "x": 1800,
                                              "y": 180,
                                              "wires": [
                                                  [
                                                      "6e576a4e6d33f548"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "6e576a4e6d33f548",
                                              "type": "switch",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "IoB read ?",
                                              "property": "payload",
                                              "propertyType": "msg",
                                              "rules": [
                                                  {
                                                      "t": "null"
                                                  },
                                                  {
                                                      "t": "nnull"
                                                  }
                                              ],
                                              "checkall": "true",
                                              "repair": false,
                                              "outputs": 2,
                                              "x": 2010,
                                              "y": 180,
                                              "wires": [
                                                  [
                                                      "ba58ec451fbfa53e"
                                                  ],
                                                  [
                                                      "ae2e0346dd5f3824"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "ba58ec451fbfa53e",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "[]",
                                                      "tot": "json"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 2250,
                                              "y": 160,
                                              "wires": [
                                                  [
                                                      "db03a4ed74093df5"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "ae2e0346dd5f3824",
                                              "type": "json",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "property": "payload",
                                              "action": "",
                                              "pretty": false,
                                              "x": 2230,
                                              "y": 220,
                                              "wires": [
                                                  [
                                                      "db03a4ed74093df5"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "db03a4ed74093df5",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "payload wiederherstellen",
                                              "rules": [
                                                  {
                                                      "t": "move",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "array_mean",
                                                      "tot": "msg"
                                                  },
                                                  {
                                                      "t": "move",
                                                      "p": "payload_bak_mean",
                                                      "pt": "msg",
                                                      "to": "payload",
                                                      "tot": "msg"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 2490,
                                              "y": 160,
                                              "wires": [
                                                  [
                                                      "515ae9918126f535"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "515ae9918126f535",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "payload anhängen und sichern",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "$append(array_mean, payload)",
                                                      "tot": "jsonata"
                                                  },
                                                  {
                                                      "t": "set",
                                                      "p": "array_mean",
                                                      "pt": "flow",
                                                      "to": "payload",
                                                      "tot": "msg"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 2510,
                                              "y": 280,
                                              "wires": [
                                                  [
                                                      "0427391d23dcb6ad"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "0427391d23dcb6ad",
                                              "type": "json",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "property": "payload",
                                              "action": "",
                                              "pretty": false,
                                              "x": 2750,
                                              "y": 280,
                                              "wires": [
                                                  [
                                                      "e44c746b92947c39"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "809efb6124c3639c",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "$moment().date()",
                                                      "tot": "jsonata"
                                                  },
                                                  {
                                                      "t": "set",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "monatstage",
                                                      "tot": "global"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 290,
                                              "y": 460,
                                              "wires": [
                                                  [
                                                      "a27f09da64977051"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "02c66f19b70ff804",
                                              "type": "inject",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "",
                                              "props": [
                                                  {
                                                      "p": "payload"
                                                  },
                                                  {
                                                      "p": "topic",
                                                      "vt": "str"
                                                  }
                                              ],
                                              "repeat": "300",
                                              "crontab": "",
                                              "once": false,
                                              "onceDelay": 0.1,
                                              "topic": "",
                                              "payload": "",
                                              "payloadType": "date",
                                              "x": 110,
                                              "y": 460,
                                              "wires": [
                                                  [
                                                      "809efb6124c3639c"
                                                  ]
                                              ]
                                          },
                                          {
                                              "id": "a27f09da64977051",
                                              "type": "debug",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "Datum",
                                              "active": true,
                                              "tosidebar": true,
                                              "console": false,
                                              "tostatus": false,
                                              "complete": "payload",
                                              "targetType": "msg",
                                              "statusVal": "",
                                              "statusType": "auto",
                                              "x": 470,
                                              "y": 460,
                                              "wires": []
                                          },
                                          {
                                              "id": "be82df1e7a1f3571",
                                              "type": "change",
                                              "z": "8c459eb88d1bf5f1",
                                              "name": "payload anhängen und sichern",
                                              "rules": [
                                                  {
                                                      "t": "set",
                                                      "p": "payload",
                                                      "pt": "msg",
                                                      "to": "$append(array_mean, payload)",
                                                      "tot": "jsonata"
                                                  },
                                                  {
                                                      "t": "set",
                                                      "p": "array_mean",
                                                      "pt": "flow",
                                                      "to": "payload",
                                                      "tot": "msg"
                                                  }
                                              ],
                                              "action": "",
                                              "property": "",
                                              "from": "",
                                              "to": "",
                                              "reg": false,
                                              "x": 2470,
                                              "y": 380,
                                              "wires": [
                                                  []
                                              ]
                                          }
                                      ]t
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • mickym
                                        mickym Most Active last edited by

                                        du brauchst keine monatstage etc. du hast doch ein Array und da bildest du einfach den durchschnitt der werte. das Array wid doch jeden monat neu geschrieben

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

                                          @mickym
                                          Ich dachte mir das nur als Fallback, wenn iobroker / Node-red mal steht und ein Tag übersprungen wird.

                                          So klappt es wunderbar und ich fuchse mich so langsam in die Materie ein.

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

                                            @mickym
                                            Ich sehe gerade den Read IOB Baustein. Liesst dieser die Anzahl der Elemente im Array ein? Ich sehe hier keine Einstellungen oder Code.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.2k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            2
                                            91
                                            4041
                                            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