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

      @mickym
      Habe ich zu spät gesehen. Dein Flow funktioniert perfekt, ich habe nur einen Change nach dem MQTT gesetzt, da dieser einen hierarchischen DP erzeugt (..virocal/zuluft)

      Nun funktioniert es perfekt. Vielen Dank. Jetzt habe ich das System der Variablen verstanden. Ich muss mir trotzdem das Konzept hinter env(basePath) anschauen.

      Hier mein/unser Ergebnis:
      Bildschirmfoto 2025-02-06 um 16.46.31.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": "71de45f27137890c",
              "type": "tab",
              "label": "Datum",
              "disabled": false,
              "info": "",
              "env": []
          },
          {
              "id": "f0dd9b6950d71727",
              "type": "ioBroker out",
              "z": "71de45f27137890c",
              "name": "",
              "topic": "",
              "ack": "true",
              "autoCreate": "true",
              "stateName": "zuluft-neu",
              "role": "state",
              "payloadType": "",
              "readonly": "",
              "stateUnit": "°C",
              "stateMin": "",
              "stateMax": "",
              "x": 720,
              "y": 80,
              "wires": []
          },
          {
              "id": "7e0364b0b8f9043e",
              "type": "mqtt in",
              "z": "71de45f27137890c",
              "name": "Vitovent ZuluftTemp",
              "topic": "vitocal/ZuluftTemp",
              "qos": "0",
              "datatype": "auto-detect",
              "broker": "bf311140.13d2b8",
              "nl": false,
              "rap": true,
              "rh": 0,
              "inputs": 0,
              "x": 110,
              "y": 80,
              "wires": [
                  [
                      "90912a5dffeb17cc"
                  ]
              ]
          },
          {
              "id": "e4826cebe9af4d64",
              "type": "debug",
              "z": "71de45f27137890c",
              "name": "payload und topic",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 510,
              "y": 20,
              "wires": []
          },
          {
              "id": "5267d5edc8abe331",
              "type": "subflow:ae673cf6cd8433a0",
              "z": "71de45f27137890c",
              "name": "Datum in Topic",
              "env": [
                  {
                      "name": "basePath",
                      "value": "Test1.Test5",
                      "type": "str"
                  }
              ],
              "x": 520,
              "y": 80,
              "wires": [
                  [
                      "e4826cebe9af4d64",
                      "f0dd9b6950d71727"
                  ]
              ]
          },
          {
              "id": "90912a5dffeb17cc",
              "type": "change",
              "z": "71de45f27137890c",
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "topic",
                      "pt": "msg",
                      "to": "Zuluft-Temp",
                      "tot": "str"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 320,
              "y": 80,
              "wires": [
                  [
                      "5267d5edc8abe331",
                      "527e1cef1285c117"
                  ]
              ]
          },
          {
              "id": "527e1cef1285c117",
              "type": "debug",
              "z": "71de45f27137890c",
              "name": "payload und topic",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 270,
              "y": 20,
              "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": ""
          }
      ]
      
      mickym 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:

        Jetzt habe ich das System der Variablen verstanden. Ich muss mir trotzdem das Konzept hinter env(basePath) anschauen.

        Wie gesagt - hast Du ja super gemacht - kannst Du nun mit dem topic mehrere datenpunkte und oder sogar Hierarchien erzeugen.

        So habe ich ja auch meinen Subflow erzeugt mit dem Du ganze JSONS oder Bäume in iobroker Einzelwerte zerlegen kannst.

        Die Variablen in einer Subflow - gelten nur für diese Instanz - so kannst Du also eine ganze Menge in einer Instanz eines Subflows parametrisieren.

        Schau Dir mal meinen Subflow an, der JSONS oder ganze Bäume in Einzelwerte zerlegt:

        https://forum.iobroker.net/topic/43856/json-oder-javascript-objekt-in-iobroker-datenpunkte-zerlegen

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

          @mickym
          Jetzt bin auf den Geschmack gekommen. Ich habe jetzt versucht, einen JSON-Datenpunkt anzulegen. Das sieht auf dem ersten Blick auch gut aus. In kann aber im Objektbaum ioBroker die Daten nicht öffnen bzw. bearbeiten.

          Hier mal die Infos:
          Bildschirmfoto 2025-02-06 um 17.19.28.png

          Datensatz:
          Bildschirmfoto 2025-02-06 um 17.18.52.png

          Flow:

          [
              {
                  "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": "fad92726ff7c3254",
                  "type": "tab",
                  "label": "JSON",
                  "disabled": false,
                  "info": "",
                  "env": []
              },
              {
                  "id": "29a754f2b7a96a31",
                  "type": "mqtt in",
                  "z": "fad92726ff7c3254",
                  "name": "ZuluftTemp",
                  "topic": "vitocal/ZuluftTemp",
                  "qos": "0",
                  "datatype": "auto-detect",
                  "broker": "bf311140.13d2b8",
                  "nl": false,
                  "rap": true,
                  "rh": 0,
                  "inputs": 0,
                  "x": 100,
                  "y": 120,
                  "wires": [
                      [
                          "5026b4d763ed7dcc"
                      ]
                  ]
              },
              {
                  "id": "535565225c8e6f99",
                  "type": "subflow:ae673cf6cd8433a0",
                  "z": "fad92726ff7c3254",
                  "name": "Datum in Topic",
                  "env": [
                      {
                          "name": "basePath",
                          "value": "Test1.Test7",
                          "type": "str"
                      }
                  ],
                  "x": 780,
                  "y": 180,
                  "wires": [
                      [
                          "05ad3c7ae6fe582b",
                          "9c9e217c842acefc"
                      ]
                  ]
              },
              {
                  "id": "05ad3c7ae6fe582b",
                  "type": "ioBroker out",
                  "z": "fad92726ff7c3254",
                  "name": "",
                  "topic": "",
                  "ack": "true",
                  "autoCreate": "true",
                  "stateName": "zuluft-neu",
                  "role": "state",
                  "payloadType": "object",
                  "readonly": "",
                  "stateUnit": "°C",
                  "stateMin": "",
                  "stateMax": "",
                  "x": 980,
                  "y": 180,
                  "wires": []
              },
              {
                  "id": "5026b4d763ed7dcc",
                  "type": "change",
                  "z": "fad92726ff7c3254",
                  "name": "Zuluft",
                  "rules": [
                      {
                          "t": "set",
                          "p": "topic",
                          "pt": "msg",
                          "to": "Zuluft-Temp",
                          "tot": "str"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 310,
                  "y": 120,
                  "wires": [
                      [
                          "766be49e74305196"
                      ]
                  ]
              },
              {
                  "id": "a3c1535e1da94552",
                  "type": "mqtt in",
                  "z": "fad92726ff7c3254",
                  "name": "AbluftTemp",
                  "topic": "vitocal/AbluftTemp",
                  "qos": "0",
                  "datatype": "auto-detect",
                  "broker": "bf311140.13d2b8",
                  "nl": false,
                  "rap": true,
                  "rh": 0,
                  "inputs": 0,
                  "x": 110,
                  "y": 240,
                  "wires": [
                      [
                          "225419c87f910c3e"
                      ]
                  ]
              },
              {
                  "id": "225419c87f910c3e",
                  "type": "change",
                  "z": "fad92726ff7c3254",
                  "name": "Abluft",
                  "rules": [
                      {
                          "t": "set",
                          "p": "topic",
                          "pt": "msg",
                          "to": "Abluft-Temp",
                          "tot": "str"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 310,
                  "y": 240,
                  "wires": [
                      [
                          "766be49e74305196"
                      ]
                  ]
              },
              {
                  "id": "766be49e74305196",
                  "type": "join",
                  "z": "fad92726ff7c3254",
                  "name": "",
                  "mode": "custom",
                  "build": "object",
                  "property": "payload",
                  "propertyType": "msg",
                  "key": "topic",
                  "joiner": "\\n",
                  "joinerType": "str",
                  "accumulate": true,
                  "timeout": "60",
                  "count": "2",
                  "reduceRight": false,
                  "reduceExp": "",
                  "reduceInit": "",
                  "reduceInitType": "",
                  "reduceFixup": "",
                  "x": 430,
                  "y": 180,
                  "wires": [
                      [
                          "dd61fc92c8961b14",
                          "457c8ae43cf33de1"
                      ]
                  ]
              },
              {
                  "id": "224380ff0709c559",
                  "type": "json",
                  "z": "fad92726ff7c3254",
                  "name": "",
                  "property": "payload",
                  "action": "",
                  "pretty": true,
                  "x": 610,
                  "y": 180,
                  "wires": [
                      [
                          "c828c8f4b32a9c0c",
                          "535565225c8e6f99"
                      ]
                  ]
              },
              {
                  "id": "dd61fc92c8961b14",
                  "type": "debug",
                  "z": "fad92726ff7c3254",
                  "name": "debug 174",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 510,
                  "y": 80,
                  "wires": []
              },
              {
                  "id": "c828c8f4b32a9c0c",
                  "type": "debug",
                  "z": "fad92726ff7c3254",
                  "name": "debug 175",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 710,
                  "y": 100,
                  "wires": []
              },
              {
                  "id": "9c9e217c842acefc",
                  "type": "debug",
                  "z": "fad92726ff7c3254",
                  "name": "debug 176",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 950,
                  "y": 100,
                  "wires": []
              },
              {
                  "id": "457c8ae43cf33de1",
                  "type": "change",
                  "z": "fad92726ff7c3254",
                  "name": "",
                  "rules": [
                      {
                          "t": "set",
                          "p": "topic",
                          "pt": "msg",
                          "to": "vitovent300",
                          "tot": "str"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 540,
                  "y": 300,
                  "wires": [
                      [
                          "224380ff0709c559",
                          "f92533e2c4de9cf4"
                      ]
                  ]
              },
              {
                  "id": "f92533e2c4de9cf4",
                  "type": "debug",
                  "z": "fad92726ff7c3254",
                  "name": "debug 177",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 730,
                  "y": 360,
                  "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": ""
              }
          ]
          

          Müssen evtl eckige Klammern um den Jason gesetzt werden (also [json]?

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

            @martybr Na den Datenpunkt hast Du wahrscheinlich schreibgeschützt angelegt - siehst Du doch an dem Schloss. Musst Du wahrscheinlich beschreibbar machen, in der iobroker-Out Node. Oder im Nachhinein in den Objekteigenschaften des Datenpunktes.

            965e3392-0f00-447f-a1e0-d807ba8dfa3f-image.png

            Ausserdem empfehle ich Dir - keinen Datentyp festzulegen - das macht die NOde selbst und wie gesagt musst Du es beschreibbar anlegen.

            b2ed9541-fad8-4875-b40a-7cfb190aa439-image.png

            Ja und wie gesagt - Objekte muss man als Strings - also JSON Strings schreiben und auch wieder in Objekte wandeln.
            iobroker kann nur Strings in den States verarbeiten.

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

              @martybr Es geht auch als Objekt zu öffnen - aber muss halt beschreibbar sein.

              d2c9f560-51b8-4568-9b0e-935c61219b96-image.png

              Und wenn Du es nicht als Objekt, sondern richtig als String festlegst (wie gesagt normalerweise legt man nichts fest, dann wird automatisch der richtige Typ festgelegt), dann macht er auch einen JSON daraus:

              a9609a2a-49d9-42e3-9efe-ba1ce6b0400b-image.png

              Grundsätzlich würde ich mir übrigens angewöhnen, die JSON Node immer direkt vor die Ausgabe in die iobroker-out -Node zu machen, damit man solange wie möglich mit Objekten arbeiten kann.

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

                @mickym
                Okay, setze ich um.

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

                  @mickym
                  Funktioniert jetzt.
                  Hast du noch eine Idee wie ich die eckigen Klammern um den Datensatz setzen kann? Mit einem Change-Node?

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

                    @martybr Eckige Klammern sind ein Array oder in Blockly Chargon eine Liste - Ja Du kannst einfach ein Array mit eckigen Klammern daraus machen - macht aber nur Sinn, wenn Du dann mehrere Objekte im Array hast.

                    Selbstverstöndlich kannst Du ein Objekt in ein Array stellen. Wenn Du aber mehrere Objekte in ein Array machen mächtest, dann nutze die $append Funktion.

                    9cabe9d2-053d-41f0-8c6a-340d46af5b84-image.png

                    Du solltest Dir angewöhnen - nie KLammern zu bezeichen, sondern was für Objekte Du erstellen möchtest.

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

                      @mickym
                      Okay. das ist mein Ziel. Ich möchte Tageswerte in ein Monatsarray speichern. Das mit den Klammern hat funktioniert.
                      Über Arrays muss ich mich erst kundig machen.

                      Ziel ist, um 00:00 Uhr generierte Werte in ein Monatsarray zu speichern.

                      Ich bereite mal einen Versuch vor.

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

                        @martybr Dann nimm die $append Funktion

                        06bdd31e-3a0b-46aa-a49c-71bc0ec14d06-image.png

                        Hier zum Ausprobieren:

                        [
                           {
                               "id": "1db807e2530b5198",
                               "type": "change",
                               "z": "7e6af0015415146d",
                               "name": "Vorhandenes Array",
                               "rules": [
                                   {
                                       "t": "set",
                                       "p": "array",
                                       "pt": "msg",
                                       "to": "[{\"Zuluft-Temp\":20.1,\"Abluft-Temp\":20.9},{\"Zuluft-Temp\":21.1,\"Abluft-Temp\":22.9}]",
                                       "tot": "json"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 410,
                               "y": 6500,
                               "wires": [
                                   [
                                       "16c668ac241e55c4"
                                   ]
                               ]
                           },
                           {
                               "id": "86b4268438857773",
                               "type": "inject",
                               "z": "7e6af0015415146d",
                               "name": "Einzelnes Objekt",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "{     \"Zuluft-Temp\": 20.1,     \"Abluft-Temp\": 20.9 }",
                               "payloadType": "json",
                               "x": 180,
                               "y": 6500,
                               "wires": [
                                   [
                                       "1db807e2530b5198"
                                   ]
                               ]
                           },
                           {
                               "id": "16c668ac241e55c4",
                               "type": "change",
                               "z": "7e6af0015415146d",
                               "name": "",
                               "rules": [
                                   {
                                       "t": "set",
                                       "p": "payload",
                                       "pt": "msg",
                                       "to": "$append(array, payload)",
                                       "tot": "jsonata"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 630,
                               "y": 6500,
                               "wires": [
                                   [
                                       "c9cfdb97d8474804"
                                   ]
                               ]
                           },
                           {
                               "id": "c9cfdb97d8474804",
                               "type": "debug",
                               "z": "7e6af0015415146d",
                               "name": "Neues Array",
                               "active": true,
                               "tosidebar": true,
                               "console": false,
                               "tostatus": false,
                               "complete": "payload",
                               "targetType": "msg",
                               "statusVal": "",
                               "statusType": "auto",
                               "x": 850,
                               "y": 6500,
                               "wires": []
                           }
                        ]
                        

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

                          @mickym
                          das Array wird nach meinem Test nicht aufgefüllt, es bleibt immer nur ein Wert im Array.
                          Die $append scheint nicht zu wirken.

                          Bildschirmfoto 2025-02-06 um 21.08.05.png

                          [
                              {
                                  "id": "a0d8740faea1647b",
                                  "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": 140,
                                  "y": 260,
                                  "wires": [
                                      [
                                          "afdcb37ccbacb06f"
                                      ]
                                  ]
                              },
                              {
                                  "id": "afdcb37ccbacb06f",
                                  "type": "change",
                                  "z": "5c488c180ba51f18",
                                  "name": "Zuluft",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "topic",
                                          "pt": "msg",
                                          "to": "zuluft",
                                          "tot": "str"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 290,
                                  "y": 320,
                                  "wires": [
                                      [
                                          "1643873aeecd8613"
                                      ]
                                  ]
                              },
                              {
                                  "id": "1643873aeecd8613",
                                  "type": "change",
                                  "z": "5c488c180ba51f18",
                                  "name": "Vorhandenes Array",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "array",
                                          "pt": "msg",
                                          "to": "[]",
                                          "tot": "json"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 490,
                                  "y": 280,
                                  "wires": [
                                      [
                                          "c9d97aec2949301c",
                                          "34c8064e4b5c52fa"
                                      ]
                                  ]
                              },
                              {
                                  "id": "34c8064e4b5c52fa",
                                  "type": "change",
                                  "z": "5c488c180ba51f18",
                                  "name": "",
                                  "rules": [
                                      {
                                          "t": "set",
                                          "p": "payload",
                                          "pt": "msg",
                                          "to": "$append(array, payload)",
                                          "tot": "jsonata"
                                      }
                                  ],
                                  "action": "",
                                  "property": "",
                                  "from": "",
                                  "to": "",
                                  "reg": false,
                                  "x": 610,
                                  "y": 340,
                                  "wires": [
                                      [
                                          "5b551b24fc1bb26e"
                                      ]
                                  ]
                              },
                              {
                                  "id": "5b551b24fc1bb26e",
                                  "type": "debug",
                                  "z": "5c488c180ba51f18",
                                  "name": "debug 179",
                                  "active": true,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "false",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 750,
                                  "y": 280,
                                  "wires": []
                              },
                              {
                                  "id": "c9d97aec2949301c",
                                  "type": "debug",
                                  "z": "5c488c180ba51f18",
                                  "name": "debug 178",
                                  "active": true,
                                  "tosidebar": true,
                                  "console": false,
                                  "tostatus": false,
                                  "complete": "false",
                                  "statusVal": "",
                                  "statusType": "auto",
                                  "x": 710,
                                  "y": 160,
                                  "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": ""
                              }
                          ]
                          

                          Was mache ich falsch?

                          Edit:
                          Als Ziel benötige ich für die 4 Werte jeweils ein Array mit

                          [
                          Wert1,
                          Wert2,
                          Wert3,

                          ...

                          Wert28
                          ]

                          Anzahl der Werte entspricht der Zahl der Tage im laufenden Monat.

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

                            @martybr Na Du mergst ein leeres Array mit einem skalaren Wert. Dann ist es doch richtig, dass nur ein Wert in dem Array ist. Du musst das Array ja speichern und dann den nächsten Wert anhängen.

                            0f36d792-5db8-4846-9914-81224feb7e6f-image.png

                            So hängst Du doch immer wieder nur EIN Wert an ein leeres Array. Du musst doch das Array irgendwo abspeichern und dann das neu erstellte Array mit einem neuen Wert ergänzen.

                            Also überleg Dir wohin Du Dein Array Ergebnis des Anhänges abspeichern willst. In einer Variable oder in einem Datenpunkt.

                            Oder mit anderen Worten: Ein Wert an ein leeres Array angehängt, gibt immer nur ein Array mit einem Wert.

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

                              @mickym
                              Okay, das ist ein Ansatzpunkt. Ich mache mir mal Gedanken.
                              Danke für deine Unterstützung.

                              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
                                Okay, das ist ein Ansatzpunkt. Ich mache mir mal Gedanken.
                                Danke für deine Unterstützung.

                                Ich habs Dir mal mit eine Flowvariable gemacht. Das heißt das Ergebnis wird in eine Variable gespeichert und dann wieder eingelesen und der neue Wert angehängt.

                                80b18580-7c9d-4b54-9dd0-4cef812c1065-image.png

                                [
                                   {
                                       "id": "a0d8740faea1647b",
                                       "type": "mqtt in",
                                       "z": "7e6af0015415146d",
                                       "d": true,
                                       "name": "ZuluftTemp",
                                       "topic": "vitocal/ZuluftTemp",
                                       "qos": "0",
                                       "datatype": "auto-detect",
                                       "broker": "bf311140.13d2b8",
                                       "nl": false,
                                       "rap": true,
                                       "rh": 0,
                                       "inputs": 0,
                                       "x": 260,
                                       "y": 6740,
                                       "wires": [
                                           [
                                               "afdcb37ccbacb06f"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "afdcb37ccbacb06f",
                                       "type": "change",
                                       "z": "7e6af0015415146d",
                                       "name": "Zuluft",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "topic",
                                               "pt": "msg",
                                               "to": "zuluft",
                                               "tot": "str"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 410,
                                       "y": 6800,
                                       "wires": [
                                           [
                                               "1643873aeecd8613"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "1643873aeecd8613",
                                       "type": "change",
                                       "z": "7e6af0015415146d",
                                       "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": 610,
                                       "y": 6760,
                                       "wires": [
                                           [
                                               "c9d97aec2949301c",
                                               "34c8064e4b5c52fa"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "34c8064e4b5c52fa",
                                       "type": "change",
                                       "z": "7e6af0015415146d",
                                       "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": 850,
                                       "y": 6760,
                                       "wires": [
                                           [
                                               "5b551b24fc1bb26e"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "5b551b24fc1bb26e",
                                       "type": "debug",
                                       "z": "7e6af0015415146d",
                                       "name": "debug 179",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "false",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 1070,
                                       "y": 6740,
                                       "wires": []
                                   },
                                   {
                                       "id": "c9d97aec2949301c",
                                       "type": "debug",
                                       "z": "7e6af0015415146d",
                                       "name": "debug 178",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "false",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 830,
                                       "y": 6640,
                                       "wires": []
                                   },
                                   {
                                       "id": "7961970716d0df25",
                                       "type": "inject",
                                       "z": "7e6af0015415146d",
                                       "name": "",
                                       "props": [
                                           {
                                               "p": "payload"
                                           }
                                       ],
                                       "repeat": "",
                                       "crontab": "",
                                       "once": false,
                                       "onceDelay": 0.1,
                                       "topic": "",
                                       "payload": "20.2",
                                       "payloadType": "num",
                                       "x": 230,
                                       "y": 6800,
                                       "wires": [
                                           [
                                               "afdcb37ccbacb06f"
                                           ]
                                       ]
                                   },
                                   {
                                       "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": ""
                                   }
                                ]
                                

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

                                  @mickym
                                  Der Flow funktioniert.
                                  Ich habe eine Objektveriable in ioBroker.

                                  [
                                     {
                                         "id": "a0d8740faea1647b",
                                         "type": "mqtt in",
                                         "z": "7e6af0015415146d",
                                         "d": true,
                                         "name": "ZuluftTemp",
                                         "topic": "vitocal/ZuluftTemp",
                                         "qos": "0",
                                         "datatype": "auto-detect",
                                         "broker": "bf311140.13d2b8",
                                         "nl": false,
                                         "rap": true,
                                         "rh": 0,
                                         "inputs": 0,
                                         "x": 260,
                                         "y": 6740,
                                         "wires": [
                                             [
                                                 "afdcb37ccbacb06f"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "afdcb37ccbacb06f",
                                         "type": "change",
                                         "z": "7e6af0015415146d",
                                         "name": "Zuluft",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "to": "zuluft",
                                                 "tot": "str"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 410,
                                         "y": 6800,
                                         "wires": [
                                             [
                                                 "1643873aeecd8613"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "1643873aeecd8613",
                                         "type": "change",
                                         "z": "7e6af0015415146d",
                                         "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": 610,
                                         "y": 6760,
                                         "wires": [
                                             [
                                                 "c9d97aec2949301c",
                                                 "34c8064e4b5c52fa"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "34c8064e4b5c52fa",
                                         "type": "change",
                                         "z": "7e6af0015415146d",
                                         "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": 850,
                                         "y": 6760,
                                         "wires": [
                                             [
                                                 "5b551b24fc1bb26e"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "5b551b24fc1bb26e",
                                         "type": "debug",
                                         "z": "7e6af0015415146d",
                                         "name": "debug 179",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "false",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 1070,
                                         "y": 6740,
                                         "wires": []
                                     },
                                     {
                                         "id": "c9d97aec2949301c",
                                         "type": "debug",
                                         "z": "7e6af0015415146d",
                                         "name": "debug 178",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "false",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 830,
                                         "y": 6640,
                                         "wires": []
                                     },
                                     {
                                         "id": "7961970716d0df25",
                                         "type": "inject",
                                         "z": "7e6af0015415146d",
                                         "name": "",
                                         "props": [
                                             {
                                                 "p": "payload"
                                             }
                                         ],
                                         "repeat": "",
                                         "crontab": "",
                                         "once": false,
                                         "onceDelay": 0.1,
                                         "topic": "",
                                         "payload": "20.2",
                                         "payloadType": "num",
                                         "x": 230,
                                         "y": 6800,
                                         "wires": [
                                             [
                                                 "afdcb37ccbacb06f"
                                             ]
                                         ]
                                     },
                                     {
                                         "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": ""
                                     }
                                  ]
                                  
                                  

                                  Wie kann ich das Array persistent ablegen?

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

                                    @martybr

                                    Wie kann ich das Array persistent ablegen?

                                    Datenpunkt im iobroker oder im mqtt - wo immer Du willst.

                                    M 1 Reply Last reply Reply Quote 0
                                    • 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
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.0k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

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