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.
    • mickym
      mickym Most Active @MartyBr last edited by mickym

      @martybr Das ist eigentlich ganz einfach:

      c705030e-7ff8-4f7f-be1c-c3e494dfaa28-image.png

      1. Da die payload kein Objekt sondern ein skalarer Wert ist, kann auch kein Objekt neu definiert werden. Also musst Du der payload Eigenschaft einfach ein Objekt zuweisen.
      2. In einer ChangeNode gibst Du das Wurzelobjekt - also das Nachrichtenobjekt msg - nie an. Das ist in der ChangeNode bereits festgelegt, deswegen kann man auch nicht auf Eigenschaften außerhalb des Nachrichtenobjektes zugreifen.

      Deine ChangeNode hätte als bereits wie folgt funktioniert:

      94254ba6-f965-4089-82a4-45397591c8de-image.png

      Um die gleiche Ausgabe wie mit Deinem Javascriptcode zu erhalten:

      function getHistoryTimestamp(seconds) {
          var historyDate = new Date(Date.now() - (seconds * 1000));
          return historyDate.getTime();
      }
      
      var historyTimestamp = getHistoryTimestamp(43200);
      
      msg.payload = { value: msg.payload, time: historyTimestamp }
      
      return msg;
      

      schreibst Du in JSONATA also nur folgendes:

      {
         "value":payload,
         "time": $millis() -43200*1000
      }
      

      87a7bba6-3113-46a7-9b98-d953b8690fe2-image.png

      Hier wieder alles zusammen zum Import:

      [
          {
              "id": "88f12c4fab5f8e9b",
              "type": "mqtt in",
              "z": "3b40b768dd849499",
              "d": true,
              "name": "Vitovent ZuluftTemp",
              "topic": "vitocal/ZuluftTemp",
              "qos": "0",
              "datatype": "auto-detect",
              "broker": "bcf16446273a18e6",
              "nl": false,
              "rap": true,
              "rh": 0,
              "inputs": 0,
              "x": 310,
              "y": 160,
              "wires": [
                  [
                      "0e5f1ebe84c213fc"
                  ]
              ]
          },
          {
              "id": "0e5f1ebe84c213fc",
              "type": "change",
              "z": "3b40b768dd849499",
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "topic",
                      "pt": "msg",
                      "to": "zuluft",
                      "tot": "str"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 540,
              "y": 220,
              "wires": [
                  [
                      "a8b5d292c778eeb7"
                  ]
              ]
          },
          {
              "id": "a8b5d292c778eeb7",
              "type": "function",
              "z": "3b40b768dd849499",
              "name": "function 22",
              "func": "function getHistoryTimestamp(seconds) {\n    var historyDate = new Date(Date.now() - (seconds * 1000));\n    return historyDate.getTime();\n}\n\nvar historyTimestamp = getHistoryTimestamp(43200);\n\nmsg.payload = { value: msg.payload, time: historyTimestamp }\n\nreturn msg;",
              "outputs": 1,
              "timeout": 0,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 750,
              "y": 220,
              "wires": [
                  [
                      "7f48f630a7765a4a",
                      "d844ef86e37ba92c"
                  ]
              ]
          },
          {
              "id": "7f48f630a7765a4a",
              "type": "influxdb out",
              "z": "3b40b768dd849499",
              "d": true,
              "influxdb": "5d7e54ca.019d44",
              "name": "outside",
              "measurement": "test.test3.outside",
              "precision": "",
              "retentionPolicy": "",
              "database": "database",
              "precisionV18FluxV20": "ms",
              "retentionPolicyV18Flux": "",
              "org": "Home",
              "bucket": "iobroker",
              "x": 940,
              "y": 220,
              "wires": []
          },
          {
              "id": "26d58a13f8c13bd6",
              "type": "change",
              "z": "3b40b768dd849499",
              "d": true,
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "payload",
                      "pt": "msg",
                      "to": "{\t   \"measurement\":payload,\t   \"timestamp\":$millis() \t}",
                      "tot": "jsonata"
                  },
                  {
                      "t": "set",
                      "p": "topic",
                      "pt": "msg",
                      "to": "zuluft",
                      "tot": "str"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 570,
              "y": 340,
              "wires": [
                  [
                      "7adb8e9803e35709"
                  ]
              ]
          },
          {
              "id": "7b4222c2e177b48f",
              "type": "inject",
              "z": "3b40b768dd849499",
              "name": "",
              "props": [
                  {
                      "p": "payload"
                  },
                  {
                      "p": "topic",
                      "vt": "str"
                  }
              ],
              "repeat": "",
              "crontab": "",
              "once": false,
              "onceDelay": 0.1,
              "topic": "",
              "payload": "21",
              "payloadType": "num",
              "x": 310,
              "y": 220,
              "wires": [
                  [
                      "0e5f1ebe84c213fc",
                      "26d58a13f8c13bd6",
                      "18c22fa209a126c5"
                  ]
              ]
          },
          {
              "id": "d844ef86e37ba92c",
              "type": "debug",
              "z": "3b40b768dd849499",
              "name": "Ausgabe",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 940,
              "y": 160,
              "wires": []
          },
          {
              "id": "7adb8e9803e35709",
              "type": "debug",
              "z": "3b40b768dd849499",
              "name": "Ausgabe JSONATA",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 830,
              "y": 340,
              "wires": []
          },
          {
              "id": "18c22fa209a126c5",
              "type": "change",
              "z": "3b40b768dd849499",
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "payload",
                      "pt": "msg",
                      "to": "{\"value\":payload,\"time\": $millis() -43200*1000}",
                      "tot": "jsonata"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 570,
              "y": 280,
              "wires": [
                  [
                      "a547d2d79fafb77f"
                  ]
              ]
          },
          {
              "id": "a547d2d79fafb77f",
              "type": "debug",
              "z": "3b40b768dd849499",
              "name": "Ausgabe JSONATA mit identischer Ausgabe",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 890,
              "y": 280,
              "wires": []
          },
          {
              "id": "14c452221e5c975e",
              "type": "change",
              "z": "3b40b768dd849499",
              "name": "",
              "rules": [
                  {
                      "t": "set",
                      "p": "payload",
                      "pt": "msg",
                      "to": "payload.{    \"measurement\":msg.payload,    \"timestamp\":$millis() }",
                      "tot": "jsonata"
                  },
                  {
                      "t": "set",
                      "p": "topic",
                      "pt": "msg",
                      "to": "zuluft",
                      "tot": "str"
                  }
              ],
              "action": "",
              "property": "",
              "from": "",
              "to": "",
              "reg": false,
              "x": 670,
              "y": 420,
              "wires": [
                  []
              ]
          },
          {
              "id": "bcf16446273a18e6",
              "type": "mqtt-broker",
              "name": "Mosquito",
              "broker": "192.168.178.10",
              "port": 1883,
              "clientid": "",
              "autoConnect": true,
              "usetls": false,
              "protocolVersion": 4,
              "keepalive": 60,
              "cleansession": true,
              "autoUnsubscribe": true,
              "birthTopic": "",
              "birthQos": "0",
              "birthRetain": "false",
              "birthPayload": "",
              "birthMsg": {},
              "closeTopic": "",
              "closeQos": "0",
              "closeRetain": "false",
              "closePayload": "",
              "closeMsg": {},
              "willTopic": "",
              "willQos": "0",
              "willRetain": "false",
              "willPayload": "",
              "willMsg": {},
              "userProps": "",
              "sessionExpiry": ""
          },
          {
              "id": "5d7e54ca.019d44",
              "type": "influxdb",
              "hostname": "127.0.0.1",
              "port": "8086",
              "protocol": "http",
              "database": "database",
              "name": "Influxdb2",
              "usetls": false,
              "tls": "d50d0c9f.31e858",
              "influxdbVersion": "2.0",
              "url": "http://192.168.178.111:8086",
              "timeout": "",
              "rejectUnauthorized": false
          },
          {
              "id": "d50d0c9f.31e858",
              "type": "tls-config",
              "name": "",
              "cert": "",
              "key": "",
              "ca": "",
              "certname": "",
              "keyname": "",
              "caname": "",
              "servername": "",
              "verifyservercert": false
          }
      ]
      

      3-5 ms Laufzeitunterschied ist rasend schnell - diesen Unterschied musst du verkraften. 😉 (wobei die ChangeNode in dem Fall schneller ist, als die function Node).

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

        @mickym
        Wenn ich vom mqtt triggere, dann ist der Laufzeitunterschied nur 1 ms, aber weiterhin zugunsten der JSONata-Version.
        Das klappt perfekt.

        Eine Frage dazu:
        Ich möchte das täglich um Mitternacht + 1 Minute triggern. Dazu habe ich den cron-plus genommen. Dieser verändert aber den msg.payload. Wo setze ich den Node am besten hin?

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

          @martybr Die cronplus verändert nicht die payload - weil die ja triggert - sie erzeugt eine payload. Woher willst Du denn die payload nehmen?
          Als trigger steht die cronplus deshalb immer am Anfang.

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

            @mickym
            Ich habe das mal so gemacht:
            (der mqtt hat ja keinen Eingang)

            Bildschirmfoto 2025-02-12 um 13.57.31.png

            Fehler:
            Bildschirmfoto 2025-02-12 um 13.57.14.png

            Code:

            [
                {
                    "id": "9e09070debba5a70",
                    "type": "mqtt in",
                    "z": "2987494fe96ff2fb",
                    "name": "Vitovent ZuluftTemp",
                    "topic": "vitocal/ZuluftTemp",
                    "qos": "0",
                    "datatype": "auto-detect",
                    "broker": "bcf16446273a18e6",
                    "nl": false,
                    "rap": true,
                    "rh": 0,
                    "inputs": 0,
                    "x": 150,
                    "y": 1700,
                    "wires": [
                        [
                            "458daafa3e776526"
                        ]
                    ]
                },
                {
                    "id": "458daafa3e776526",
                    "type": "cronplus",
                    "z": "2987494fe96ff2fb",
                    "name": "",
                    "outputField": "payload",
                    "timeZone": "",
                    "storeName": "",
                    "commandResponseMsgOutput": "output1",
                    "defaultLocation": "",
                    "defaultLocationType": "default",
                    "outputs": 1,
                    "options": [
                        {
                            "name": "schedule2",
                            "topic": "topic2",
                            "payloadType": "default",
                            "payload": "",
                            "expressionType": "cron",
                            "expression": "0 * * * * *",
                            "location": "",
                            "offset": "0",
                            "solarType": "all",
                            "solarEvents": "sunrise,sunset"
                        }
                    ],
                    "x": 360,
                    "y": 1700,
                    "wires": [
                        [
                            "18e23ebeebdc502e"
                        ]
                    ]
                },
                {
                    "id": "18e23ebeebdc502e",
                    "type": "change",
                    "z": "2987494fe96ff2fb",
                    "name": "",
                    "rules": [
                        {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "{\"value\":payload,\"time\": $millis() -43200*1000}",
                            "tot": "jsonata"
                        }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 550,
                    "y": 1700,
                    "wires": [
                        [
                            "379bfe9421c88668"
                        ]
                    ]
                },
                {
                    "id": "379bfe9421c88668",
                    "type": "debug",
                    "z": "2987494fe96ff2fb",
                    "name": "Ausgabe JSONATA mit identischer Ausgabe",
                    "active": true,
                    "tosidebar": true,
                    "console": false,
                    "tostatus": false,
                    "complete": "payload",
                    "targetType": "msg",
                    "statusVal": "",
                    "statusType": "auto",
                    "x": 870,
                    "y": 1700,
                    "wires": []
                },
                {
                    "id": "bcf16446273a18e6",
                    "type": "mqtt-broker",
                    "name": "Mosquito",
                    "broker": "192.168.178.10",
                    "port": 1883,
                    "clientid": "",
                    "autoConnect": true,
                    "usetls": false,
                    "protocolVersion": 4,
                    "keepalive": 60,
                    "cleansession": true,
                    "autoUnsubscribe": true,
                    "birthTopic": "",
                    "birthQos": "0",
                    "birthRetain": "false",
                    "birthPayload": "",
                    "birthMsg": {},
                    "closeTopic": "",
                    "closeQos": "0",
                    "closeRetain": "false",
                    "closePayload": "",
                    "closeMsg": {},
                    "willTopic": "",
                    "willQos": "0",
                    "willRetain": "false",
                    "willPayload": "",
                    "willMsg": {},
                    "userProps": "",
                    "sessionExpiry": ""
                }
            ]
            
            M mickym 2 Replies Last reply Reply Quote 0
            • M
              MartyBr @MartyBr last edited by

              @martybr
              P.S. brauche einen switch node? Nur wenn beide "wahr" sind?

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

                @martybr Nein das ist verkehrt. Wie gesagt die cronplus triggert - und der Eingang in die cronplus-Node dient alleine zum Steuern der cronplus Node.

                In dem Fall musst Du den Wert aus dem mqtt Node in einer Flowvariablen zwischenspeichern und diese kann dann die cronplus bei triggern als payload verschicken.

                846452e1-4bb3-4844-aa10-d18decc12190-image.png

                Da die mqtt Node die Flowvariable ja kontinuierlich aktualisiert, hast Du somit zum Triggerzeitpunkt immer den letzten, aktuellsten Wert in der Flowvariable, der dann von der cron-plus auf die Reise geschickt wird.

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

                  @mickym
                  Das sieht nicht gut aus:

                  Bildschirmfoto 2025-02-12 um 14.11.54.png

                  Bildschirmfoto 2025-02-12 um 14.12.13.png

                  [
                      {
                          "id": "379bfe9421c88668",
                          "type": "debug",
                          "z": "2987494fe96ff2fb",
                          "name": "Ausgabe JSONATA mit identischer Ausgabe",
                          "active": true,
                          "tosidebar": true,
                          "console": false,
                          "tostatus": false,
                          "complete": "payload",
                          "targetType": "msg",
                          "statusVal": "",
                          "statusType": "auto",
                          "x": 850,
                          "y": 1700,
                          "wires": []
                      },
                      {
                          "id": "18e23ebeebdc502e",
                          "type": "change",
                          "z": "2987494fe96ff2fb",
                          "name": "",
                          "rules": [
                              {
                                  "t": "set",
                                  "p": "payload",
                                  "pt": "msg",
                                  "to": "{\"value\":payload,\"time\": $millis() -43200*1000}",
                                  "tot": "jsonata"
                              }
                          ],
                          "action": "",
                          "property": "",
                          "from": "",
                          "to": "",
                          "reg": false,
                          "x": 530,
                          "y": 1700,
                          "wires": [
                              [
                                  "379bfe9421c88668"
                              ]
                          ]
                      },
                      {
                          "id": "9e09070debba5a70",
                          "type": "mqtt in",
                          "z": "2987494fe96ff2fb",
                          "name": "Vitovent ZuluftTemp",
                          "topic": "vitocal/ZuluftTemp",
                          "qos": "0",
                          "datatype": "auto-detect",
                          "broker": "bcf16446273a18e6",
                          "nl": false,
                          "rap": true,
                          "rh": 0,
                          "inputs": 0,
                          "x": 270,
                          "y": 1740,
                          "wires": [
                              [
                                  "18e23ebeebdc502e"
                              ]
                          ]
                      },
                      {
                          "id": "458daafa3e776526",
                          "type": "cronplus",
                          "z": "2987494fe96ff2fb",
                          "name": "",
                          "outputField": "payload",
                          "timeZone": "",
                          "storeName": "",
                          "commandResponseMsgOutput": "output1",
                          "defaultLocation": "",
                          "defaultLocationType": "default",
                          "outputs": 1,
                          "options": [
                              {
                                  "name": "schedule2",
                                  "topic": "topic",
                                  "payloadType": "flow",
                                  "payload": "payload",
                                  "expressionType": "cron",
                                  "expression": "0 */5 * * * *",
                                  "location": "",
                                  "offset": "0",
                                  "solarType": "all",
                                  "solarEvents": "sunrise,sunset"
                              }
                          ],
                          "x": 280,
                          "y": 1640,
                          "wires": [
                              [
                                  "18e23ebeebdc502e"
                              ]
                          ]
                      },
                      {
                          "id": "bcf16446273a18e6",
                          "type": "mqtt-broker",
                          "name": "Mosquito",
                          "broker": "192.168.178.10",
                          "port": 1883,
                          "clientid": "",
                          "autoConnect": true,
                          "usetls": false,
                          "protocolVersion": 4,
                          "keepalive": 60,
                          "cleansession": true,
                          "autoUnsubscribe": true,
                          "birthTopic": "",
                          "birthQos": "0",
                          "birthRetain": "false",
                          "birthPayload": "",
                          "birthMsg": {},
                          "closeTopic": "",
                          "closeQos": "0",
                          "closeRetain": "false",
                          "closePayload": "",
                          "closeMsg": {},
                          "willTopic": "",
                          "willQos": "0",
                          "willRetain": "false",
                          "willPayload": "",
                          "willMsg": {},
                          "userProps": "",
                          "sessionExpiry": ""
                      }
                  ]
                  

                  Der mqtt triggert alle 30 Sekunden. Mit dem cron-plus zusammen wird der payload wieder gelöscht.
                  Irgendetwas (oder alles 😧 ) mache ich hier falsch.

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

                    Ich hatte doch gesagt, dass Du die Ausgabe aus dem Mqtt in einer Flowvariable speichern sollst. Ich habe nun ein Objekt genommen - du kannst natürlich auch eine skalare Variable nehmen.

                    Merke wenn 2 Trigger zu unterschiedlichen Zeitpunkten triggern (in diesem Fall cronplus und mqtt) bringst Du die Nachrichtenobjekte nie zusammen (JOIN Node macht hier keinen Sinn), sondern dann speicherst Du den Wert im Kontext und nutzt ihn dann im anderen Trigger.

                    Hier siehst Du wie ich die mqtt In Ausgabe im Flow-Kontext speichere:

                    e6d83b18-31cb-49fe-9262-326c5ee55771-image.png

                    Wenn die cronplus Node dann triggert, dann schnappt sie sich den Wert aus der Flowvariable

                    7799ebf3-a19a-402b-ac71-a4b6561d0d1b-image.png

                    und sendet ihn als payload in Deine ChangeNode.

                    039b29f5-c799-4fed-b0e2-c361f1e2ec69-image.png

                    Hier wieder der Import:

                    [
                       {
                           "id": "379bfe9421c88668",
                           "type": "debug",
                           "z": "c52a337a80f950fc",
                           "name": "Ausgabe JSONATA mit identischer Ausgabe",
                           "active": true,
                           "tosidebar": true,
                           "console": false,
                           "tostatus": false,
                           "complete": "payload",
                           "targetType": "msg",
                           "statusVal": "",
                           "statusType": "auto",
                           "x": 810,
                           "y": 200,
                           "wires": []
                       },
                       {
                           "id": "18e23ebeebdc502e",
                           "type": "change",
                           "z": "c52a337a80f950fc",
                           "name": "",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\"value\":payload,\"time\": $millis() -43200*1000}",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 490,
                           "y": 200,
                           "wires": [
                               [
                                   "379bfe9421c88668"
                               ]
                           ]
                       },
                       {
                           "id": "9e09070debba5a70",
                           "type": "mqtt in",
                           "z": "c52a337a80f950fc",
                           "d": true,
                           "name": "Vitovent ZuluftTemp",
                           "topic": "vitocal/ZuluftTemp",
                           "qos": "0",
                           "datatype": "auto-detect",
                           "broker": "bcf16446273a18e6",
                           "nl": false,
                           "rap": true,
                           "rh": 0,
                           "inputs": 0,
                           "x": 210,
                           "y": 340,
                           "wires": [
                               [
                                   "155c85431cc02d77"
                               ]
                           ]
                       },
                       {
                           "id": "458daafa3e776526",
                           "type": "cronplus",
                           "z": "c52a337a80f950fc",
                           "name": "",
                           "outputField": "payload",
                           "timeZone": "",
                           "storeName": "",
                           "commandResponseMsgOutput": "output1",
                           "defaultLocation": "",
                           "defaultLocationType": "default",
                           "outputs": 1,
                           "options": [
                               {
                                   "name": "schedule2",
                                   "topic": "topic",
                                   "payloadType": "flow",
                                   "payload": "vitocal.ZuluftTemp",
                                   "expressionType": "cron",
                                   "expression": "0 */5 * * * *",
                                   "location": "",
                                   "offset": "0",
                                   "solarType": "all",
                                   "solarEvents": "sunrise,sunset"
                               }
                           ],
                           "x": 260,
                           "y": 200,
                           "wires": [
                               [
                                   "18e23ebeebdc502e"
                               ]
                           ]
                       },
                       {
                           "id": "155c85431cc02d77",
                           "type": "change",
                           "z": "c52a337a80f950fc",
                           "name": "",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "vitocal.ZuluftTemp",
                                   "pt": "flow",
                                   "to": "payload",
                                   "tot": "msg"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 460,
                           "y": 340,
                           "wires": [
                               []
                           ]
                       },
                       {
                           "id": "665b4c711f50a646",
                           "type": "inject",
                           "z": "c52a337a80f950fc",
                           "name": "",
                           "props": [
                               {
                                   "p": "payload"
                               }
                           ],
                           "repeat": "",
                           "crontab": "",
                           "once": false,
                           "onceDelay": 0.1,
                           "topic": "",
                           "payload": "21",
                           "payloadType": "num",
                           "x": 230,
                           "y": 300,
                           "wires": [
                               [
                                   "155c85431cc02d77"
                               ]
                           ]
                       },
                       {
                           "id": "bcf16446273a18e6",
                           "type": "mqtt-broker",
                           "name": "Mosquito",
                           "broker": "192.168.178.10",
                           "port": 1883,
                           "clientid": "",
                           "autoConnect": true,
                           "usetls": false,
                           "protocolVersion": 4,
                           "keepalive": 60,
                           "cleansession": true,
                           "autoUnsubscribe": true,
                           "birthTopic": "",
                           "birthQos": "0",
                           "birthRetain": "false",
                           "birthPayload": "",
                           "birthMsg": {},
                           "closeTopic": "",
                           "closeQos": "0",
                           "closeRetain": "false",
                           "closePayload": "",
                           "closeMsg": {},
                           "willTopic": "",
                           "willQos": "0",
                           "willRetain": "false",
                           "willPayload": "",
                           "willMsg": {},
                           "userProps": "",
                           "sessionExpiry": ""
                       }
                    ]
                    

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

                      @mickym

                      Auch hier der Fehler. Der Cron ist bei schedule auf "flow.payload" gestellt.
                      Nur der untere Teil ist relevant.

                      Bildschirmfoto 2025-02-12 um 14.25.31.png

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

                        Wenn Du das so wie Du geplant hättest, dann hätte ja deine mqtt alle 30 s getriggert und du hättest alle 30 s in die Influx geschrieben.

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

                          @martybr Was soll das - Du hast keine Flowvariable payload - ich hab Dir doch einen fertigen Flow geschickt.

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

                          M 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:

                            Auch hier der Fehler. Der Cron ist bei schedule auf "flow.payload" gestellt.

                            Der Eingang der cron Node ist NUR ZUM STEUERN der Cron Node da. Schau Dir die Hilfe zur Cronnode an. Das bombardieren dieser Node mit irgendwelchen Nachrichten bzw. payloads ist Kontraproduktiv.

                            Mit dem Eingang kannst Du zum Beispiel dynamisch irgendwelche Zeitereignisse erstellen, siehe wie gesagt die Hilfe zur cronplus Node:

                            902110ea-4fa7-4fa9-a024-9f98e82995a4-image.png

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

                              @mickym
                              Ich hatte deinen Flow nicht gesehen und hatte meine "Programmierung" in einem Flow gesetzt. Sorry, hatte versucht das Problem zu lösen.

                              Nun habe ich deinen Ansatz verstanden: Die Trigger-Node schreibt ihren Wert in eine Flow-Variable (flow.irgendwas) und die cron-plus-node triggert diesen Flow flow.irgendwas.

                              Jetzt ist mir das klar.

                              Zu deiner Frage wegen der dreissig Sekunden. Das ist ein Trigger, der häufig Daten liefert.
                              Im echten Flow nehme ich dann Datenpunkte mit täglich aggregierten Werten, die ich dann mit einem Timestamp vom Vortag in Influx schreibe.
                              Dazu reicht der normale influx-out aus. Der influx-batch ist nicht notwendig.

                              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:

                                Nun habe ich deinen Ansatz verstanden: Die Trigger-Node schreibt ihren Wert in eine Flow-Variable (flow.irgendwas) und die cron-plus-node triggert diesen Flow flow.irgendwas.

                                Die mqtt-In Node schreibt ihren Wert in eine Flow-Variable ....

                                Die cronplus Node triggert zum konfigurierten Zeitpunkt und schickt als payload den Inhalt der Flow Variable.

                                Zu deiner Frage wegen der dreissig Sekunden. Das ist ein Trigger, der häufig Daten liefert.

                                Im echten Flow nehme ich dann Datenpunkte mit täglich aggregierten Werten, die ich dann mit einem Timestamp vom Vortag in Influx schreibe.

                                War keine Frage - aber Du willst ja in die Influx zu definierten Zeitpunkten schreiben, sprich wenn die cronplus triggert und nicht wenn die mqtt-In triggert.

                                Gut dann sollte dieses Kapitel aber gelöst und geklärt sein.

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

                                  @mickym
                                  Genau. Und vielen Dank.

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

                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate

                                  970
                                  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