Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Node-Red
  5. Zwei Strings zusammenführen

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    16
    1
    313

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    4.7k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.3k

Zwei Strings zusammenführen

Scheduled Pinned Locked Moved Node-Red
23 Posts 2 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J JU_

    @peterfido

    Die Funktion "msg.payload = flow.get("GelbDatum") + " (" + flow.get("GelbTage")+")";" funktioniert super (siehe Payload auf dem Bild). Nur leider erkennt die KNX Node den Payload nur zur hälfte (siehe Wert unter der Node). Hast du eine Ahnung wie es dazu kommt? Zu lang ist die Nachricht nicht. Sie ist genau 14 Werte Lang - so wie als maximum erlaubt.

    10.png

    P Offline
    P Offline
    peterfido
    wrote on last edited by
    #6

    @ju_
    mangels KNX kann ich da nur spekulieren. Evtl. mag es die Leerzeichen nicht, die Klammer, oder irgendwas anderes. Da stehen nichtdruckbare Zeichen im Node. Wo kommen die her? Evtl. mal dessen Werte posten.

    Gruß

    Peterfido


    Proxmox auf Intel NUC12WSHi5
    ioBroker: Debian (VM)
    CCU: Debmatic (VM)
    Influx: Debian (VM)
    Grafana: Debian (VM)
    eBus: Debian (VM)
    Zigbee: Debian (VM) mit zigbee2mqtt

    J 1 Reply Last reply
    0
    • P peterfido

      @ju_
      mangels KNX kann ich da nur spekulieren. Evtl. mag es die Leerzeichen nicht, die Klammer, oder irgendwas anderes. Da stehen nichtdruckbare Zeichen im Node. Wo kommen die her? Evtl. mal dessen Werte posten.

      J Offline
      J Offline
      JU_
      wrote on last edited by JU_
      #7

      @peterfido habe es bereits ohne Klammern und leerzeichen probiert. Bringt alles nichts. Aber die Debug Node zeigt immer das korrekte an. Ich weis nicht wieso die KNX Node die eigentlich druckbaren zeichen als nicht druckbare wertet. :(

      P 1 Reply Last reply
      0
      • J JU_

        @peterfido habe es bereits ohne Klammern und leerzeichen probiert. Bringt alles nichts. Aber die Debug Node zeigt immer das korrekte an. Ich weis nicht wieso die KNX Node die eigentlich druckbaren zeichen als nicht druckbare wertet. :(

        P Offline
        P Offline
        peterfido
        wrote on last edited by peterfido
        #8

        @ju_ Ich habe eben mal geschaut. Du kannst wohl wählen, welches Datenformat Du willst. ASCII Zeichen, UTF8 Zeichen, etc.

        Bei mir zeigt er aber keine Vorschau am Node selbst an. Habe ja auch keinen KNX-Bus, wohin das gesendet werden kann. Du kannst Dein Node-Diagramm ja mal exportieren und hier posten.

        Bei mir sieht es so aus:
        Bildschirmfoto 2025-01-17 um 16.38.33.png

        Gruß

        Peterfido


        Proxmox auf Intel NUC12WSHi5
        ioBroker: Debian (VM)
        CCU: Debmatic (VM)
        Influx: Debian (VM)
        Grafana: Debian (VM)
        eBus: Debian (VM)
        Zigbee: Debian (VM) mit zigbee2mqtt

        J 1 Reply Last reply
        0
        • P peterfido

          @ju_ Ich habe eben mal geschaut. Du kannst wohl wählen, welches Datenformat Du willst. ASCII Zeichen, UTF8 Zeichen, etc.

          Bei mir zeigt er aber keine Vorschau am Node selbst an. Habe ja auch keinen KNX-Bus, wohin das gesendet werden kann. Du kannst Dein Node-Diagramm ja mal exportieren und hier posten.

          Bei mir sieht es so aus:
          Bildschirmfoto 2025-01-17 um 16.38.33.png

          J Offline
          J Offline
          JU_
          wrote on last edited by JU_
          #9

          @peterfido kannst du mir erklären, wie ich ein "Node-Diagramm" exportiere? Dachte es geht nur über Bilder. Übrigend wenn ich über eine Inject Node direkt "27.01.25 (10d)" als "msg.payload" auf die KNX Node schicke funktioniert es. Also scheint sie irgendwas gegen den Output der Funktion zu haben.

          11.png

          P 1 Reply Last reply
          0
          • J JU_

            @peterfido kannst du mir erklären, wie ich ein "Node-Diagramm" exportiere? Dachte es geht nur über Bilder. Übrigend wenn ich über eine Inject Node direkt "27.01.25 (10d)" als "msg.payload" auf die KNX Node schicke funktioniert es. Also scheint sie irgendwas gegen den Output der Funktion zu haben.

            11.png

            P Offline
            P Offline
            peterfido
            wrote on last edited by
            #10

            @ju_ ja, bei mir geht es auch. Ich frage mich, mit welchem KNX sich die Node standardmäßig verbindet.

            Exportieren geht über das Menü oben rechts in Node-Red.

            Gruß

            Peterfido


            Proxmox auf Intel NUC12WSHi5
            ioBroker: Debian (VM)
            CCU: Debmatic (VM)
            Influx: Debian (VM)
            Grafana: Debian (VM)
            eBus: Debian (VM)
            Zigbee: Debian (VM) mit zigbee2mqtt

            J 1 Reply Last reply
            0
            • P peterfido

              @ju_ ja, bei mir geht es auch. Ich frage mich, mit welchem KNX sich die Node standardmäßig verbindet.

              Exportieren geht über das Menü oben rechts in Node-Red.

              J Offline
              J Offline
              JU_
              wrote on last edited by JU_
              #11

              @peterfido und dann als JSON?

              P 1 Reply Last reply
              0
              • J JU_

                @peterfido und dann als JSON?

                P Offline
                P Offline
                peterfido
                wrote on last edited by
                #12

                @ju_ ja. Per JSON in die Zwischenablage und dann hier in Code-Tags posten.

                Gruß

                Peterfido


                Proxmox auf Intel NUC12WSHi5
                ioBroker: Debian (VM)
                CCU: Debmatic (VM)
                Influx: Debian (VM)
                Grafana: Debian (VM)
                eBus: Debian (VM)
                Zigbee: Debian (VM) mit zigbee2mqtt

                J 1 Reply Last reply
                0
                • P peterfido

                  @ju_ ja. Per JSON in die Zwischenablage und dann hier in Code-Tags posten.

                  J Offline
                  J Offline
                  JU_
                  wrote on last edited by JU_
                  #13

                  @peterfido ist drin, musste ihn nochmal fix bearbeiten.

                  P 1 Reply Last reply
                  0
                  • J JU_

                    @peterfido ist drin, musste ihn nochmal fix bearbeiten.

                    P Offline
                    P Offline
                    peterfido
                    wrote on last edited by
                    #14

                    @ju_ probiere es mal als Code. So lässt es sich nicht importieren. Code-Symbol ist </>

                    Gruß

                    Peterfido


                    Proxmox auf Intel NUC12WSHi5
                    ioBroker: Debian (VM)
                    CCU: Debmatic (VM)
                    Influx: Debian (VM)
                    Grafana: Debian (VM)
                    eBus: Debian (VM)
                    Zigbee: Debian (VM) mit zigbee2mqtt

                    J 1 Reply Last reply
                    0
                    • P peterfido

                      @ju_ probiere es mal als Code. So lässt es sich nicht importieren. Code-Symbol ist </>

                      J Offline
                      J Offline
                      JU_
                      wrote on last edited by JU_
                      #15

                      @peterfido ```
                      [{"id":"90489d5f43af09b5","type":"knxUltimate","z":"de15a47dbea6c285","server":"98b73fada3be00aa","topic":"8/1/0","setTopicType":"str","outputtopic":"","dpt":"16.001","initialread":"1","notifyreadrequest":false,"notifyresponse":true,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","name":"Gelbe Tonne Datum","outputtype":"write","outputRBE":"true","inputRBE":"false","formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","sendMsgToKNXCode":"","receiveMsgFromKNXCode":"","listenallga":false,"x":130,"y":100,"wires":[["02034f10ed38c317"]]},{"id":"a2dbe9c2f590573a","type":"knxUltimate","z":"de15a47dbea6c285","server":"98b73fada3be00aa","topic":"8/2/0","setTopicType":"str","outputtopic":"","dpt":"16.001","initialread":"1","notifyreadrequest":false,"notifyresponse":true,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","name":"Gelbe Tonne Tage","outputtype":"write","outputRBE":"true","inputRBE":"false","formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","sendMsgToKNXCode":"","receiveMsgFromKNXCode":"","listenallga":false,"x":130,"y":160,"wires":[["4ea9b5ca4631e2ce"]]},{"id":"02034f10ed38c317","type":"change","z":"de15a47dbea6c285","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Datum","tot":"str"},{"t":"set","p":"GelbDatum","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":100,"wires":[["5b74298a9d871858"]]},{"id":"4ea9b5ca4631e2ce","type":"change","z":"de15a47dbea6c285","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Tage","tot":"str"},{"t":"set","p":"GelbTage","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":160,"wires":[["5b74298a9d871858"]]},{"id":"58a426e6d74f6020","type":"knxUltimate","z":"de15a47dbea6c285","server":"98b73fada3be00aa","topic":"8/3/0","setTopicType":"str","outputtopic":"","dpt":"16.001","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","name":"Zusammengesetztes Datum Gelb","outputtype":"write","outputRBE":"true","inputRBE":"false","formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","sendMsgToKNXCode":"","receiveMsgFromKNXCode":"","listenallga":false,"x":1230,"y":100,"wires":[[]]},{"id":"2861740aaba0f1c9","type":"inject","z":"de15a47dbea6c285","name":"Manuelle Betätigung","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"27.01.25 (10d)","payloadType":"str","x":890,"y":20,"wires":[["58a426e6d74f6020"]]},{"id":"d22d4525c542b4d0","type":"debug","z":"de15a47dbea6c285","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1140,"y":180,"wires":[]},{"id":"cccfb4eb94a27733","type":"change","z":"de15a47dbea6c285","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"8/3/0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":100,"wires":[["58a426e6d74f6020","d22d4525c542b4d0"]]},{"id":"5b74298a9d871858","type":"function","z":"de15a47dbea6c285","name":"function 3","func":"msg.payload = flow.get("GelbDatum") + " (" + flow.get("GelbTage") + "d)";\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":100,"wires":[["cccfb4eb94a27733"]]},{"id":"141076626e9e6cf8","type":"inject","z":"de15a47dbea6c285","name":"Manuelle Betätigung","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":350,"y":40,"wires":[["5b74298a9d871858"]]},{"id":"98b73fada3be00aa","type":"knxUltimate-config","host":"10.0.0.2","port":"3671","physAddr":"1.1.64","hostProtocol":"TunnelUDP","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","stopETSImportIfNoDatapoint":"fake","loglevel":"error","name":"KNX Gateway","localEchoInTunneling":true,"delaybetweentelegrams":"50","ignoreTelegramsWithRepeatedFlag":false,"autoReconnect":"yes"}]

                      P 1 Reply Last reply
                      0
                      • J JU_

                        @peterfido ```
                        [{"id":"90489d5f43af09b5","type":"knxUltimate","z":"de15a47dbea6c285","server":"98b73fada3be00aa","topic":"8/1/0","setTopicType":"str","outputtopic":"","dpt":"16.001","initialread":"1","notifyreadrequest":false,"notifyresponse":true,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","name":"Gelbe Tonne Datum","outputtype":"write","outputRBE":"true","inputRBE":"false","formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","sendMsgToKNXCode":"","receiveMsgFromKNXCode":"","listenallga":false,"x":130,"y":100,"wires":[["02034f10ed38c317"]]},{"id":"a2dbe9c2f590573a","type":"knxUltimate","z":"de15a47dbea6c285","server":"98b73fada3be00aa","topic":"8/2/0","setTopicType":"str","outputtopic":"","dpt":"16.001","initialread":"1","notifyreadrequest":false,"notifyresponse":true,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","name":"Gelbe Tonne Tage","outputtype":"write","outputRBE":"true","inputRBE":"false","formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","sendMsgToKNXCode":"","receiveMsgFromKNXCode":"","listenallga":false,"x":130,"y":160,"wires":[["4ea9b5ca4631e2ce"]]},{"id":"02034f10ed38c317","type":"change","z":"de15a47dbea6c285","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Datum","tot":"str"},{"t":"set","p":"GelbDatum","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":100,"wires":[["5b74298a9d871858"]]},{"id":"4ea9b5ca4631e2ce","type":"change","z":"de15a47dbea6c285","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Tage","tot":"str"},{"t":"set","p":"GelbTage","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":160,"wires":[["5b74298a9d871858"]]},{"id":"58a426e6d74f6020","type":"knxUltimate","z":"de15a47dbea6c285","server":"98b73fada3be00aa","topic":"8/3/0","setTopicType":"str","outputtopic":"","dpt":"16.001","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","name":"Zusammengesetztes Datum Gelb","outputtype":"write","outputRBE":"true","inputRBE":"false","formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","sendMsgToKNXCode":"","receiveMsgFromKNXCode":"","listenallga":false,"x":1230,"y":100,"wires":[[]]},{"id":"2861740aaba0f1c9","type":"inject","z":"de15a47dbea6c285","name":"Manuelle Betätigung","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"27.01.25 (10d)","payloadType":"str","x":890,"y":20,"wires":[["58a426e6d74f6020"]]},{"id":"d22d4525c542b4d0","type":"debug","z":"de15a47dbea6c285","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1140,"y":180,"wires":[]},{"id":"cccfb4eb94a27733","type":"change","z":"de15a47dbea6c285","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"8/3/0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":100,"wires":[["58a426e6d74f6020","d22d4525c542b4d0"]]},{"id":"5b74298a9d871858","type":"function","z":"de15a47dbea6c285","name":"function 3","func":"msg.payload = flow.get("GelbDatum") + " (" + flow.get("GelbTage") + "d)";\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":100,"wires":[["cccfb4eb94a27733"]]},{"id":"141076626e9e6cf8","type":"inject","z":"de15a47dbea6c285","name":"Manuelle Betätigung","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":350,"y":40,"wires":[["5b74298a9d871858"]]},{"id":"98b73fada3be00aa","type":"knxUltimate-config","host":"10.0.0.2","port":"3671","physAddr":"1.1.64","hostProtocol":"TunnelUDP","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","stopETSImportIfNoDatapoint":"fake","loglevel":"error","name":"KNX Gateway","localEchoInTunneling":true,"delaybetweentelegrams":"50","ignoreTelegramsWithRepeatedFlag":false,"autoReconnect":"yes"}]

                        P Offline
                        P Offline
                        peterfido
                        wrote on last edited by
                        #16

                        @ju_ Das Symbol anklicken und dann zwischen den '' einfügen.
                        Bildschirmfoto 2025-01-17 um 16.52.44.png

                        Gruß

                        Peterfido


                        Proxmox auf Intel NUC12WSHi5
                        ioBroker: Debian (VM)
                        CCU: Debmatic (VM)
                        Influx: Debian (VM)
                        Grafana: Debian (VM)
                        eBus: Debian (VM)
                        Zigbee: Debian (VM) mit zigbee2mqtt

                        J 1 Reply Last reply
                        0
                        • P peterfido

                          @ju_ Das Symbol anklicken und dann zwischen den '' einfügen.
                          Bildschirmfoto 2025-01-17 um 16.52.44.png

                          J Offline
                          J Offline
                          JU_
                          wrote on last edited by
                          #17

                          @peterfido habe ich verstanden, ist oben geändert. Sorry :D

                          P 1 Reply Last reply
                          0
                          • J JU_

                            @peterfido habe ich verstanden, ist oben geändert. Sorry :D

                            P Offline
                            P Offline
                            peterfido
                            wrote on last edited by
                            #18

                            @ju_ Fast :)

                            Sollte so aussehen:

                            [
                                {
                                    "id": "076b7140f384fc31",
                                    "type": "tab",
                                    "label": "Flow 2",
                                    "disabled": false,
                                    "info": "",
                                    "env": []
                                },
                                {
                                    "id": "4be12d8e923cd33b",
                                    "type": "knxUltimate",
                                    "z": "076b7140f384fc31",
                                    "server": "2e5af07acfd111fe",
                                    "topic": "8/3/0",
                                    "setTopicType": "str",
                                    "outputtopic": "",
                                    "dpt": "16.000",
                                    "initialread": 0,
                                    "notifyreadrequest": false,
                                    "notifyresponse": false,
                                    "notifywrite": true,
                                    "notifyreadrequestalsorespondtobus": false,
                                    "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                    "name": "",
                                    "outputtype": "write",
                                    "outputRBE": "true",
                                    "inputRBE": "false",
                                    "formatmultiplyvalue": 1,
                                    "formatnegativevalue": "leave",
                                    "formatdecimalsvalue": 999,
                                    "passthrough": "yes",
                                    "sendMsgToKNXCode": "",
                                    "receiveMsgFromKNXCode": "",
                                    "listenallga": false,
                                    "x": 360,
                                    "y": 100,
                                    "wires": [
                                        [
                                            "2d3c593b7f85b176"
                                        ]
                                    ]
                                },
                                {
                                    "id": "b0b348a7ad1db526",
                                    "type": "inject",
                                    "z": "076b7140f384fc31",
                                    "name": "",
                                    "props": [
                                        {
                                            "p": "payload"
                                        },
                                        {
                                            "p": "topic",
                                            "vt": "str"
                                        }
                                    ],
                                    "repeat": "",
                                    "crontab": "",
                                    "once": false,
                                    "onceDelay": 0.1,
                                    "topic": "",
                                    "payload": "30.01.25 (13d)",
                                    "payloadType": "str",
                                    "x": 170,
                                    "y": 100,
                                    "wires": [
                                        [
                                            "4be12d8e923cd33b"
                                        ]
                                    ]
                                },
                                {
                                    "id": "2d3c593b7f85b176",
                                    "type": "debug",
                                    "z": "076b7140f384fc31",
                                    "name": "debug 2",
                                    "active": true,
                                    "tosidebar": true,
                                    "console": false,
                                    "tostatus": false,
                                    "complete": "true",
                                    "targetType": "full",
                                    "statusVal": "",
                                    "statusType": "auto",
                                    "x": 560,
                                    "y": 100,
                                    "wires": []
                                },
                                {
                                    "id": "2e5af07acfd111fe",
                                    "type": "knxUltimate-config",
                                    "host": "224.0.23.12",
                                    "port": "3671",
                                    "physAddr": "15.15.22",
                                    "hostProtocol": "Auto",
                                    "suppressACKRequest": false,
                                    "csv": "",
                                    "KNXEthInterface": "Auto",
                                    "KNXEthInterfaceManuallyInput": "",
                                    "stopETSImportIfNoDatapoint": "fake",
                                    "loglevel": "error",
                                    "name": "KNX Gateway",
                                    "localEchoInTunneling": true,
                                    "delaybetweentelegrams": "25",
                                    "ignoreTelegramsWithRepeatedFlag": false,
                                    "autoReconnect": "yes"
                                }
                            ]
                            

                            Gruß

                            Peterfido


                            Proxmox auf Intel NUC12WSHi5
                            ioBroker: Debian (VM)
                            CCU: Debmatic (VM)
                            Influx: Debian (VM)
                            Grafana: Debian (VM)
                            eBus: Debian (VM)
                            Zigbee: Debian (VM) mit zigbee2mqtt

                            J 1 Reply Last reply
                            0
                            • P peterfido

                              @ju_ Fast :)

                              Sollte so aussehen:

                              [
                                  {
                                      "id": "076b7140f384fc31",
                                      "type": "tab",
                                      "label": "Flow 2",
                                      "disabled": false,
                                      "info": "",
                                      "env": []
                                  },
                                  {
                                      "id": "4be12d8e923cd33b",
                                      "type": "knxUltimate",
                                      "z": "076b7140f384fc31",
                                      "server": "2e5af07acfd111fe",
                                      "topic": "8/3/0",
                                      "setTopicType": "str",
                                      "outputtopic": "",
                                      "dpt": "16.000",
                                      "initialread": 0,
                                      "notifyreadrequest": false,
                                      "notifyresponse": false,
                                      "notifywrite": true,
                                      "notifyreadrequestalsorespondtobus": false,
                                      "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                      "name": "",
                                      "outputtype": "write",
                                      "outputRBE": "true",
                                      "inputRBE": "false",
                                      "formatmultiplyvalue": 1,
                                      "formatnegativevalue": "leave",
                                      "formatdecimalsvalue": 999,
                                      "passthrough": "yes",
                                      "sendMsgToKNXCode": "",
                                      "receiveMsgFromKNXCode": "",
                                      "listenallga": false,
                                      "x": 360,
                                      "y": 100,
                                      "wires": [
                                          [
                                              "2d3c593b7f85b176"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "b0b348a7ad1db526",
                                      "type": "inject",
                                      "z": "076b7140f384fc31",
                                      "name": "",
                                      "props": [
                                          {
                                              "p": "payload"
                                          },
                                          {
                                              "p": "topic",
                                              "vt": "str"
                                          }
                                      ],
                                      "repeat": "",
                                      "crontab": "",
                                      "once": false,
                                      "onceDelay": 0.1,
                                      "topic": "",
                                      "payload": "30.01.25 (13d)",
                                      "payloadType": "str",
                                      "x": 170,
                                      "y": 100,
                                      "wires": [
                                          [
                                              "4be12d8e923cd33b"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "2d3c593b7f85b176",
                                      "type": "debug",
                                      "z": "076b7140f384fc31",
                                      "name": "debug 2",
                                      "active": true,
                                      "tosidebar": true,
                                      "console": false,
                                      "tostatus": false,
                                      "complete": "true",
                                      "targetType": "full",
                                      "statusVal": "",
                                      "statusType": "auto",
                                      "x": 560,
                                      "y": 100,
                                      "wires": []
                                  },
                                  {
                                      "id": "2e5af07acfd111fe",
                                      "type": "knxUltimate-config",
                                      "host": "224.0.23.12",
                                      "port": "3671",
                                      "physAddr": "15.15.22",
                                      "hostProtocol": "Auto",
                                      "suppressACKRequest": false,
                                      "csv": "",
                                      "KNXEthInterface": "Auto",
                                      "KNXEthInterfaceManuallyInput": "",
                                      "stopETSImportIfNoDatapoint": "fake",
                                      "loglevel": "error",
                                      "name": "KNX Gateway",
                                      "localEchoInTunneling": true,
                                      "delaybetweentelegrams": "25",
                                      "ignoreTelegramsWithRepeatedFlag": false,
                                      "autoReconnect": "yes"
                                  }
                              ]
                              
                              J Offline
                              J Offline
                              JU_
                              wrote on last edited by JU_
                              #19

                              @peterfido jetzt :D

                              [
                                  {
                                      "id": "90489d5f43af09b5",
                                      "type": "knxUltimate",
                                      "z": "de15a47dbea6c285",
                                      "server": "98b73fada3be00aa",
                                      "topic": "8/1/0",
                                      "setTopicType": "str",
                                      "outputtopic": "",
                                      "dpt": "16.001",
                                      "initialread": "1",
                                      "notifyreadrequest": false,
                                      "notifyresponse": true,
                                      "notifywrite": true,
                                      "notifyreadrequestalsorespondtobus": false,
                                      "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                      "name": "Gelbe Tonne Datum",
                                      "outputtype": "write",
                                      "outputRBE": "true",
                                      "inputRBE": "false",
                                      "formatmultiplyvalue": 1,
                                      "formatnegativevalue": "leave",
                                      "formatdecimalsvalue": 999,
                                      "passthrough": "no",
                                      "sendMsgToKNXCode": "",
                                      "receiveMsgFromKNXCode": "",
                                      "listenallga": false,
                                      "x": 130,
                                      "y": 100,
                                      "wires": [
                                          [
                                              "02034f10ed38c317"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "a2dbe9c2f590573a",
                                      "type": "knxUltimate",
                                      "z": "de15a47dbea6c285",
                                      "server": "98b73fada3be00aa",
                                      "topic": "8/2/0",
                                      "setTopicType": "str",
                                      "outputtopic": "",
                                      "dpt": "16.001",
                                      "initialread": "1",
                                      "notifyreadrequest": false,
                                      "notifyresponse": true,
                                      "notifywrite": true,
                                      "notifyreadrequestalsorespondtobus": false,
                                      "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                      "name": "Gelbe Tonne Tage",
                                      "outputtype": "write",
                                      "outputRBE": "true",
                                      "inputRBE": "false",
                                      "formatmultiplyvalue": 1,
                                      "formatnegativevalue": "leave",
                                      "formatdecimalsvalue": 999,
                                      "passthrough": "no",
                                      "sendMsgToKNXCode": "",
                                      "receiveMsgFromKNXCode": "",
                                      "listenallga": false,
                                      "x": 130,
                                      "y": 160,
                                      "wires": [
                                          [
                                              "4ea9b5ca4631e2ce"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "02034f10ed38c317",
                                      "type": "change",
                                      "z": "de15a47dbea6c285",
                                      "name": "",
                                      "rules": [
                                          {
                                              "t": "set",
                                              "p": "topic",
                                              "pt": "msg",
                                              "to": "Datum",
                                              "tot": "str"
                                          },
                                          {
                                              "t": "set",
                                              "p": "GelbDatum",
                                              "pt": "flow",
                                              "to": "payload",
                                              "tot": "msg"
                                          }
                                      ],
                                      "action": "",
                                      "property": "",
                                      "from": "",
                                      "to": "",
                                      "reg": false,
                                      "x": 360,
                                      "y": 100,
                                      "wires": [
                                          [
                                              "5b74298a9d871858"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "4ea9b5ca4631e2ce",
                                      "type": "change",
                                      "z": "de15a47dbea6c285",
                                      "name": "",
                                      "rules": [
                                          {
                                              "t": "set",
                                              "p": "topic",
                                              "pt": "msg",
                                              "to": "Tage",
                                              "tot": "str"
                                          },
                                          {
                                              "t": "set",
                                              "p": "GelbTage",
                                              "pt": "flow",
                                              "to": "payload",
                                              "tot": "msg"
                                          }
                                      ],
                                      "action": "",
                                      "property": "",
                                      "from": "",
                                      "to": "",
                                      "reg": false,
                                      "x": 360,
                                      "y": 160,
                                      "wires": [
                                          [
                                              "5b74298a9d871858"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "58a426e6d74f6020",
                                      "type": "knxUltimate",
                                      "z": "de15a47dbea6c285",
                                      "server": "98b73fada3be00aa",
                                      "topic": "8/3/0",
                                      "setTopicType": "str",
                                      "outputtopic": "",
                                      "dpt": "16.001",
                                      "initialread": 0,
                                      "notifyreadrequest": false,
                                      "notifyresponse": false,
                                      "notifywrite": true,
                                      "notifyreadrequestalsorespondtobus": false,
                                      "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                      "name": "Zusammengesetztes Datum Gelb",
                                      "outputtype": "write",
                                      "outputRBE": "true",
                                      "inputRBE": "false",
                                      "formatmultiplyvalue": 1,
                                      "formatnegativevalue": "leave",
                                      "formatdecimalsvalue": 999,
                                      "passthrough": "no",
                                      "sendMsgToKNXCode": "",
                                      "receiveMsgFromKNXCode": "",
                                      "listenallga": false,
                                      "x": 1230,
                                      "y": 100,
                                      "wires": [
                                          []
                                      ]
                                  },
                                  {
                                      "id": "2861740aaba0f1c9",
                                      "type": "inject",
                                      "z": "de15a47dbea6c285",
                                      "name": "Manuelle Betätigung",
                                      "props": [
                                          {
                                              "p": "payload"
                                          }
                                      ],
                                      "repeat": "",
                                      "crontab": "",
                                      "once": false,
                                      "onceDelay": 0.1,
                                      "topic": "",
                                      "payload": "27.01.25 (10d)",
                                      "payloadType": "str",
                                      "x": 890,
                                      "y": 20,
                                      "wires": [
                                          [
                                              "58a426e6d74f6020"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "d22d4525c542b4d0",
                                      "type": "debug",
                                      "z": "de15a47dbea6c285",
                                      "name": "debug 1",
                                      "active": true,
                                      "tosidebar": true,
                                      "console": false,
                                      "tostatus": false,
                                      "complete": "true",
                                      "targetType": "full",
                                      "statusVal": "",
                                      "statusType": "auto",
                                      "x": 1140,
                                      "y": 180,
                                      "wires": []
                                  },
                                  {
                                      "id": "cccfb4eb94a27733",
                                      "type": "change",
                                      "z": "de15a47dbea6c285",
                                      "name": "",
                                      "rules": [
                                          {
                                              "t": "set",
                                              "p": "topic",
                                              "pt": "msg",
                                              "to": "8/3/0",
                                              "tot": "str"
                                          }
                                      ],
                                      "action": "",
                                      "property": "",
                                      "from": "",
                                      "to": "",
                                      "reg": false,
                                      "x": 850,
                                      "y": 100,
                                      "wires": [
                                          [
                                              "58a426e6d74f6020",
                                              "d22d4525c542b4d0"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "5b74298a9d871858",
                                      "type": "function",
                                      "z": "de15a47dbea6c285",
                                      "name": "function 3",
                                      "func": "msg.payload = flow.get(\"GelbDatum\") + \" (\" + flow.get(\"GelbTage\") + \"d)\";\nreturn msg;",
                                      "outputs": 1,
                                      "timeout": 0,
                                      "noerr": 0,
                                      "initialize": "",
                                      "finalize": "",
                                      "libs": [],
                                      "x": 620,
                                      "y": 100,
                                      "wires": [
                                          [
                                              "cccfb4eb94a27733"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "141076626e9e6cf8",
                                      "type": "inject",
                                      "z": "de15a47dbea6c285",
                                      "name": "Manuelle Betätigung",
                                      "props": [
                                          {
                                              "p": "topic",
                                              "vt": "str"
                                          }
                                      ],
                                      "repeat": "",
                                      "crontab": "",
                                      "once": false,
                                      "onceDelay": 0.1,
                                      "topic": "",
                                      "x": 350,
                                      "y": 40,
                                      "wires": [
                                          [
                                              "5b74298a9d871858"
                                          ]
                                      ]
                                  },
                                  {
                                      "id": "98b73fada3be00aa",
                                      "type": "knxUltimate-config",
                                      "host": "10.0.0.2",
                                      "port": "3671",
                                      "physAddr": "1.1.64",
                                      "hostProtocol": "TunnelUDP",
                                      "suppressACKRequest": false,
                                      "csv": "",
                                      "KNXEthInterface": "Auto",
                                      "KNXEthInterfaceManuallyInput": "",
                                      "stopETSImportIfNoDatapoint": "fake",
                                      "loglevel": "error",
                                      "name": "KNX Gateway",
                                      "localEchoInTunneling": true,
                                      "delaybetweentelegrams": "50",
                                      "ignoreTelegramsWithRepeatedFlag": false,
                                      "autoReconnect": "yes"
                                  }
                              ]
                              
                              P 1 Reply Last reply
                              0
                              • J JU_

                                @peterfido jetzt :D

                                [
                                    {
                                        "id": "90489d5f43af09b5",
                                        "type": "knxUltimate",
                                        "z": "de15a47dbea6c285",
                                        "server": "98b73fada3be00aa",
                                        "topic": "8/1/0",
                                        "setTopicType": "str",
                                        "outputtopic": "",
                                        "dpt": "16.001",
                                        "initialread": "1",
                                        "notifyreadrequest": false,
                                        "notifyresponse": true,
                                        "notifywrite": true,
                                        "notifyreadrequestalsorespondtobus": false,
                                        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                        "name": "Gelbe Tonne Datum",
                                        "outputtype": "write",
                                        "outputRBE": "true",
                                        "inputRBE": "false",
                                        "formatmultiplyvalue": 1,
                                        "formatnegativevalue": "leave",
                                        "formatdecimalsvalue": 999,
                                        "passthrough": "no",
                                        "sendMsgToKNXCode": "",
                                        "receiveMsgFromKNXCode": "",
                                        "listenallga": false,
                                        "x": 130,
                                        "y": 100,
                                        "wires": [
                                            [
                                                "02034f10ed38c317"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "a2dbe9c2f590573a",
                                        "type": "knxUltimate",
                                        "z": "de15a47dbea6c285",
                                        "server": "98b73fada3be00aa",
                                        "topic": "8/2/0",
                                        "setTopicType": "str",
                                        "outputtopic": "",
                                        "dpt": "16.001",
                                        "initialread": "1",
                                        "notifyreadrequest": false,
                                        "notifyresponse": true,
                                        "notifywrite": true,
                                        "notifyreadrequestalsorespondtobus": false,
                                        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                        "name": "Gelbe Tonne Tage",
                                        "outputtype": "write",
                                        "outputRBE": "true",
                                        "inputRBE": "false",
                                        "formatmultiplyvalue": 1,
                                        "formatnegativevalue": "leave",
                                        "formatdecimalsvalue": 999,
                                        "passthrough": "no",
                                        "sendMsgToKNXCode": "",
                                        "receiveMsgFromKNXCode": "",
                                        "listenallga": false,
                                        "x": 130,
                                        "y": 160,
                                        "wires": [
                                            [
                                                "4ea9b5ca4631e2ce"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "02034f10ed38c317",
                                        "type": "change",
                                        "z": "de15a47dbea6c285",
                                        "name": "",
                                        "rules": [
                                            {
                                                "t": "set",
                                                "p": "topic",
                                                "pt": "msg",
                                                "to": "Datum",
                                                "tot": "str"
                                            },
                                            {
                                                "t": "set",
                                                "p": "GelbDatum",
                                                "pt": "flow",
                                                "to": "payload",
                                                "tot": "msg"
                                            }
                                        ],
                                        "action": "",
                                        "property": "",
                                        "from": "",
                                        "to": "",
                                        "reg": false,
                                        "x": 360,
                                        "y": 100,
                                        "wires": [
                                            [
                                                "5b74298a9d871858"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "4ea9b5ca4631e2ce",
                                        "type": "change",
                                        "z": "de15a47dbea6c285",
                                        "name": "",
                                        "rules": [
                                            {
                                                "t": "set",
                                                "p": "topic",
                                                "pt": "msg",
                                                "to": "Tage",
                                                "tot": "str"
                                            },
                                            {
                                                "t": "set",
                                                "p": "GelbTage",
                                                "pt": "flow",
                                                "to": "payload",
                                                "tot": "msg"
                                            }
                                        ],
                                        "action": "",
                                        "property": "",
                                        "from": "",
                                        "to": "",
                                        "reg": false,
                                        "x": 360,
                                        "y": 160,
                                        "wires": [
                                            [
                                                "5b74298a9d871858"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "58a426e6d74f6020",
                                        "type": "knxUltimate",
                                        "z": "de15a47dbea6c285",
                                        "server": "98b73fada3be00aa",
                                        "topic": "8/3/0",
                                        "setTopicType": "str",
                                        "outputtopic": "",
                                        "dpt": "16.001",
                                        "initialread": 0,
                                        "notifyreadrequest": false,
                                        "notifyresponse": false,
                                        "notifywrite": true,
                                        "notifyreadrequestalsorespondtobus": false,
                                        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
                                        "name": "Zusammengesetztes Datum Gelb",
                                        "outputtype": "write",
                                        "outputRBE": "true",
                                        "inputRBE": "false",
                                        "formatmultiplyvalue": 1,
                                        "formatnegativevalue": "leave",
                                        "formatdecimalsvalue": 999,
                                        "passthrough": "no",
                                        "sendMsgToKNXCode": "",
                                        "receiveMsgFromKNXCode": "",
                                        "listenallga": false,
                                        "x": 1230,
                                        "y": 100,
                                        "wires": [
                                            []
                                        ]
                                    },
                                    {
                                        "id": "2861740aaba0f1c9",
                                        "type": "inject",
                                        "z": "de15a47dbea6c285",
                                        "name": "Manuelle Betätigung",
                                        "props": [
                                            {
                                                "p": "payload"
                                            }
                                        ],
                                        "repeat": "",
                                        "crontab": "",
                                        "once": false,
                                        "onceDelay": 0.1,
                                        "topic": "",
                                        "payload": "27.01.25 (10d)",
                                        "payloadType": "str",
                                        "x": 890,
                                        "y": 20,
                                        "wires": [
                                            [
                                                "58a426e6d74f6020"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "d22d4525c542b4d0",
                                        "type": "debug",
                                        "z": "de15a47dbea6c285",
                                        "name": "debug 1",
                                        "active": true,
                                        "tosidebar": true,
                                        "console": false,
                                        "tostatus": false,
                                        "complete": "true",
                                        "targetType": "full",
                                        "statusVal": "",
                                        "statusType": "auto",
                                        "x": 1140,
                                        "y": 180,
                                        "wires": []
                                    },
                                    {
                                        "id": "cccfb4eb94a27733",
                                        "type": "change",
                                        "z": "de15a47dbea6c285",
                                        "name": "",
                                        "rules": [
                                            {
                                                "t": "set",
                                                "p": "topic",
                                                "pt": "msg",
                                                "to": "8/3/0",
                                                "tot": "str"
                                            }
                                        ],
                                        "action": "",
                                        "property": "",
                                        "from": "",
                                        "to": "",
                                        "reg": false,
                                        "x": 850,
                                        "y": 100,
                                        "wires": [
                                            [
                                                "58a426e6d74f6020",
                                                "d22d4525c542b4d0"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "5b74298a9d871858",
                                        "type": "function",
                                        "z": "de15a47dbea6c285",
                                        "name": "function 3",
                                        "func": "msg.payload = flow.get(\"GelbDatum\") + \" (\" + flow.get(\"GelbTage\") + \"d)\";\nreturn msg;",
                                        "outputs": 1,
                                        "timeout": 0,
                                        "noerr": 0,
                                        "initialize": "",
                                        "finalize": "",
                                        "libs": [],
                                        "x": 620,
                                        "y": 100,
                                        "wires": [
                                            [
                                                "cccfb4eb94a27733"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "141076626e9e6cf8",
                                        "type": "inject",
                                        "z": "de15a47dbea6c285",
                                        "name": "Manuelle Betätigung",
                                        "props": [
                                            {
                                                "p": "topic",
                                                "vt": "str"
                                            }
                                        ],
                                        "repeat": "",
                                        "crontab": "",
                                        "once": false,
                                        "onceDelay": 0.1,
                                        "topic": "",
                                        "x": 350,
                                        "y": 40,
                                        "wires": [
                                            [
                                                "5b74298a9d871858"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "98b73fada3be00aa",
                                        "type": "knxUltimate-config",
                                        "host": "10.0.0.2",
                                        "port": "3671",
                                        "physAddr": "1.1.64",
                                        "hostProtocol": "TunnelUDP",
                                        "suppressACKRequest": false,
                                        "csv": "",
                                        "KNXEthInterface": "Auto",
                                        "KNXEthInterfaceManuallyInput": "",
                                        "stopETSImportIfNoDatapoint": "fake",
                                        "loglevel": "error",
                                        "name": "KNX Gateway",
                                        "localEchoInTunneling": true,
                                        "delaybetweentelegrams": "50",
                                        "ignoreTelegramsWithRepeatedFlag": false,
                                        "autoReconnect": "yes"
                                    }
                                ]
                                
                                P Offline
                                P Offline
                                peterfido
                                wrote on last edited by peterfido
                                #20

                                @ju_ probiere mal:

                                [
                                    {
                                        "id": "5b74298a9d871858",
                                        "type": "function",
                                        "z": "e85adb77025ff03d",
                                        "name": "function 3",
                                        "func": "if(msg.topic==\"Datum\"){\n    flow.set(\"GelbDatum\", msg.payload.slice(0,8));\n}\nif(msg.topic==\"Tage\"){\n    var s = msg.payload;\n    for(var i=1;i<s.length;i++){\n        var x = s.slice(i,i+1);\n        if(isNaN(x)){\n            flow.set(\"GelbTage\", s.slice(0,i-1));\n            break;\n        }\n    }\n}\nnode.status({ text: flow.get(\"GelbDatum\") + flow.get(\"GelbTage\") + \" \" + x });\n\nif(flow.get(\"GelbDatum\").length > 0  && flow.get(\"GelbTage\").length > 0) {\n    msg.payload = flow.get(\"GelbDatum\").slice(0,8) + \" (\" + flow.get(\"GelbTage\") + \"d)\";\n    node.status({text: msg.payload});\n    return msg;\n}",
                                        "outputs": 1,
                                        "timeout": 0,
                                        "noerr": 0,
                                        "initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\nflow.set(\"GelbDatum\",\"\");\nflow.set(\"GelbTage\", \"\");\n",
                                        "finalize": "",
                                        "libs": [],
                                        "x": 620,
                                        "y": 200,
                                        "wires": [
                                            [
                                                "cccfb4eb94a27733"
                                            ]
                                        ]
                                    }
                                ]
                                

                                Ich habe die Strings jetzt nach der erwarteten Länge abgeschnitten.

                                Im Prinzip nur die Function Node:

                                if(msg.topic=="Datum"){
                                    flow.set("GelbDatum", msg.payload.slice(0,8));
                                }
                                if(msg.topic=="Tage"){
                                    var s = msg.payload;
                                    for(var i=1;i<s.length;i++){
                                        var x = s.slice(i,i+1);
                                        if(isNaN(x)){
                                            flow.set("GelbTage", s.slice(0,i-1));
                                            break;
                                        }
                                    }
                                }
                                node.status({ text: flow.get("GelbDatum") + flow.get("GelbTage") + " " + x });
                                
                                if(flow.get("GelbDatum").length > 0  && flow.get("GelbTage").length > 0) {
                                    msg.payload = flow.get("GelbDatum").slice(0,8) + " (" + flow.get("GelbTage") + "d)";
                                    node.status({text: msg.payload});
                                    return msg;
                                }
                                

                                Ich habe es nochmal editiert.

                                Im Start-Bereich der Function die Variablen zurücksetzen. Sonst bleiben die alten Werte.

                                flow.set("GelbDatum","");
                                flow.set("GelbTage", "");
                                

                                Gruß

                                Peterfido


                                Proxmox auf Intel NUC12WSHi5
                                ioBroker: Debian (VM)
                                CCU: Debmatic (VM)
                                Influx: Debian (VM)
                                Grafana: Debian (VM)
                                eBus: Debian (VM)
                                Zigbee: Debian (VM) mit zigbee2mqtt

                                J 2 Replies Last reply
                                0
                                • P peterfido

                                  @ju_ probiere mal:

                                  [
                                      {
                                          "id": "5b74298a9d871858",
                                          "type": "function",
                                          "z": "e85adb77025ff03d",
                                          "name": "function 3",
                                          "func": "if(msg.topic==\"Datum\"){\n    flow.set(\"GelbDatum\", msg.payload.slice(0,8));\n}\nif(msg.topic==\"Tage\"){\n    var s = msg.payload;\n    for(var i=1;i<s.length;i++){\n        var x = s.slice(i,i+1);\n        if(isNaN(x)){\n            flow.set(\"GelbTage\", s.slice(0,i-1));\n            break;\n        }\n    }\n}\nnode.status({ text: flow.get(\"GelbDatum\") + flow.get(\"GelbTage\") + \" \" + x });\n\nif(flow.get(\"GelbDatum\").length > 0  && flow.get(\"GelbTage\").length > 0) {\n    msg.payload = flow.get(\"GelbDatum\").slice(0,8) + \" (\" + flow.get(\"GelbTage\") + \"d)\";\n    node.status({text: msg.payload});\n    return msg;\n}",
                                          "outputs": 1,
                                          "timeout": 0,
                                          "noerr": 0,
                                          "initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\nflow.set(\"GelbDatum\",\"\");\nflow.set(\"GelbTage\", \"\");\n",
                                          "finalize": "",
                                          "libs": [],
                                          "x": 620,
                                          "y": 200,
                                          "wires": [
                                              [
                                                  "cccfb4eb94a27733"
                                              ]
                                          ]
                                      }
                                  ]
                                  

                                  Ich habe die Strings jetzt nach der erwarteten Länge abgeschnitten.

                                  Im Prinzip nur die Function Node:

                                  if(msg.topic=="Datum"){
                                      flow.set("GelbDatum", msg.payload.slice(0,8));
                                  }
                                  if(msg.topic=="Tage"){
                                      var s = msg.payload;
                                      for(var i=1;i<s.length;i++){
                                          var x = s.slice(i,i+1);
                                          if(isNaN(x)){
                                              flow.set("GelbTage", s.slice(0,i-1));
                                              break;
                                          }
                                      }
                                  }
                                  node.status({ text: flow.get("GelbDatum") + flow.get("GelbTage") + " " + x });
                                  
                                  if(flow.get("GelbDatum").length > 0  && flow.get("GelbTage").length > 0) {
                                      msg.payload = flow.get("GelbDatum").slice(0,8) + " (" + flow.get("GelbTage") + "d)";
                                      node.status({text: msg.payload});
                                      return msg;
                                  }
                                  

                                  Ich habe es nochmal editiert.

                                  Im Start-Bereich der Function die Variablen zurücksetzen. Sonst bleiben die alten Werte.

                                  flow.set("GelbDatum","");
                                  flow.set("GelbTage", "");
                                  
                                  J Offline
                                  J Offline
                                  JU_
                                  wrote on last edited by
                                  #21

                                  @peterfido vielen Dank, probiere es gleich morgen früh aus! Melde mich. :)

                                  1 Reply Last reply
                                  0
                                  • P peterfido

                                    @ju_ probiere mal:

                                    [
                                        {
                                            "id": "5b74298a9d871858",
                                            "type": "function",
                                            "z": "e85adb77025ff03d",
                                            "name": "function 3",
                                            "func": "if(msg.topic==\"Datum\"){\n    flow.set(\"GelbDatum\", msg.payload.slice(0,8));\n}\nif(msg.topic==\"Tage\"){\n    var s = msg.payload;\n    for(var i=1;i<s.length;i++){\n        var x = s.slice(i,i+1);\n        if(isNaN(x)){\n            flow.set(\"GelbTage\", s.slice(0,i-1));\n            break;\n        }\n    }\n}\nnode.status({ text: flow.get(\"GelbDatum\") + flow.get(\"GelbTage\") + \" \" + x });\n\nif(flow.get(\"GelbDatum\").length > 0  && flow.get(\"GelbTage\").length > 0) {\n    msg.payload = flow.get(\"GelbDatum\").slice(0,8) + \" (\" + flow.get(\"GelbTage\") + \"d)\";\n    node.status({text: msg.payload});\n    return msg;\n}",
                                            "outputs": 1,
                                            "timeout": 0,
                                            "noerr": 0,
                                            "initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\nflow.set(\"GelbDatum\",\"\");\nflow.set(\"GelbTage\", \"\");\n",
                                            "finalize": "",
                                            "libs": [],
                                            "x": 620,
                                            "y": 200,
                                            "wires": [
                                                [
                                                    "cccfb4eb94a27733"
                                                ]
                                            ]
                                        }
                                    ]
                                    

                                    Ich habe die Strings jetzt nach der erwarteten Länge abgeschnitten.

                                    Im Prinzip nur die Function Node:

                                    if(msg.topic=="Datum"){
                                        flow.set("GelbDatum", msg.payload.slice(0,8));
                                    }
                                    if(msg.topic=="Tage"){
                                        var s = msg.payload;
                                        for(var i=1;i<s.length;i++){
                                            var x = s.slice(i,i+1);
                                            if(isNaN(x)){
                                                flow.set("GelbTage", s.slice(0,i-1));
                                                break;
                                            }
                                        }
                                    }
                                    node.status({ text: flow.get("GelbDatum") + flow.get("GelbTage") + " " + x });
                                    
                                    if(flow.get("GelbDatum").length > 0  && flow.get("GelbTage").length > 0) {
                                        msg.payload = flow.get("GelbDatum").slice(0,8) + " (" + flow.get("GelbTage") + "d)";
                                        node.status({text: msg.payload});
                                        return msg;
                                    }
                                    

                                    Ich habe es nochmal editiert.

                                    Im Start-Bereich der Function die Variablen zurücksetzen. Sonst bleiben die alten Werte.

                                    flow.set("GelbDatum","");
                                    flow.set("GelbTage", "");
                                    
                                    J Offline
                                    J Offline
                                    JU_
                                    wrote on last edited by
                                    #22

                                    @peterfido Es funktioniert! Vielen lieben Dank für deine Hilfe und deine Gedult!! <3

                                    P 1 Reply Last reply
                                    0
                                    • J JU_

                                      @peterfido Es funktioniert! Vielen lieben Dank für deine Hilfe und deine Gedult!! <3

                                      P Offline
                                      P Offline
                                      peterfido
                                      wrote on last edited by peterfido
                                      #23

                                      @ju_ Prima. Danke für die Rückmeldung.

                                      Edit: In den beiden Change-Nodes kann die Regel, wo die Werte nach flow.Datum und flow.Tage geschrieben werden, raus. Da brauchts nur das Topic. Den Rest macht die Function.

                                      Die nimmt vom Datum die ersten 8 Stellen und vom Tage sucht die sich nur die Ziffern am Anfang raus. Wenn beides gefunden wurde, wird es weitergeleitet.

                                      Gruß

                                      Peterfido


                                      Proxmox auf Intel NUC12WSHi5
                                      ioBroker: Debian (VM)
                                      CCU: Debmatic (VM)
                                      Influx: Debian (VM)
                                      Grafana: Debian (VM)
                                      eBus: Debian (VM)
                                      Zigbee: Debian (VM) mit zigbee2mqtt

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      Support us

                                      ioBroker
                                      Community Adapters
                                      Donate

                                      361

                                      Online

                                      32.7k

                                      Users

                                      82.5k

                                      Topics

                                      1.3m

                                      Posts
                                      Community
                                      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                      ioBroker Community 2014-2025
                                      logo
                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Home
                                      • Recent
                                      • Tags
                                      • Unread 0
                                      • Categories
                                      • Unreplied
                                      • Popular
                                      • GitHub
                                      • Docu
                                      • Hilfe