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. Switch funktioniert nur einmal nach deploy

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Switch funktioniert nur einmal nach deploy

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

      @nftvirus Packe das was aus der Alexa Node rauskommt in eine Inject Node und schau, ob Du das Verhalten nachvollziehen kannst, wenn Du manuell den Flow mit verschiedenen Daten der Alexa Node triggerst. Vielleicht gibt die Alexa Node ja auch unterschiedliche Nachrichten aus und diese Alexa Node wird durch jedes deploy zurückgesetzt.

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

        @mickym erst mal danke für deine Antwort! Habe jetzt einen inject reingebaut und das selbe Verhalten. Beim ersten mal läuft mein JSON Befehl durch. Bei zweiten mal macht der Switch Node wieder nichts mehr.

        N 2 Replies Last reply Reply Quote 0
        • N
          NFTVirus @NFTVirus last edited by

          @nftvirus Habe leider immer noch keine Ahnung woran es liegt. An sich arbeitet Node Red gut aber es ist total reproduzierbar das der Flow nur einmal komplett durch läuft und danach immer an einem Join hängt. Eventuell hat ja noch jemand eine Idee:

          [
              {
                  "id": "5251b05d8dcb44d2",
                  "type": "function",
                  "z": "9f5b324af15fbb32",
                  "name": "function 2",
                  "func": "msg.topic = \"brightness\";\nmsg.payload = msg.payload.bri;\nreturn msg;",
                  "outputs": 1,
                  "timeout": 0,
                  "noerr": 0,
                  "initialize": "",
                  "finalize": "",
                  "libs": [],
                  "x": 400,
                  "y": 260,
                  "wires": [
                      [
                          "2f3b67eee446ea0a",
                          "23458ad4a09fab41"
                      ]
                  ]
              },
              {
                  "id": "2f3b67eee446ea0a",
                  "type": "join",
                  "z": "9f5b324af15fbb32",
                  "name": "",
                  "mode": "custom",
                  "build": "object",
                  "property": "payload",
                  "propertyType": "msg",
                  "key": "topic",
                  "joiner": "\\n",
                  "joinerType": "str",
                  "accumulate": true,
                  "timeout": "0.1",
                  "count": "",
                  "reduceRight": false,
                  "reduceExp": "",
                  "reduceInit": "",
                  "reduceInitType": "",
                  "reduceFixup": "",
                  "x": 870,
                  "y": 260,
                  "wires": [
                      [
                          "4e320b068f1edb88",
                          "6f3cbe12a233222c"
                      ]
                  ]
              },
              {
                  "id": "4e320b068f1edb88",
                  "type": "json",
                  "z": "9f5b324af15fbb32",
                  "name": "",
                  "property": "payload",
                  "action": "",
                  "pretty": false,
                  "x": 1010,
                  "y": 260,
                  "wires": [
                      [
                          "cc8e59201c4bdc82"
                      ]
                  ]
              },
              {
                  "id": "3703e00eef57da29",
                  "type": "switch",
                  "z": "9f5b324af15fbb32",
                  "name": "",
                  "property": "payload.on",
                  "propertyType": "msg",
                  "rules": [
                      {
                          "t": "true"
                      },
                      {
                          "t": "false"
                      }
                  ],
                  "checkall": "true",
                  "repair": false,
                  "outputs": 2,
                  "x": 390,
                  "y": 140,
                  "wires": [
                      [
                          "60a90d3ada282185"
                      ],
                      [
                          "bd2ee7ed033d59ba",
                          "1e330702139ad824"
                      ]
                  ]
              },
              {
                  "id": "60a90d3ada282185",
                  "type": "function",
                  "z": "9f5b324af15fbb32",
                  "name": "function 14",
                  "func": "msg.topic = \"state\"\nmsg.payload.on = \"ON\"\nmsg.payload = msg.payload.on\nreturn msg;",
                  "outputs": 1,
                  "timeout": 0,
                  "noerr": 0,
                  "initialize": "",
                  "finalize": "",
                  "libs": [],
                  "x": 690,
                  "y": 180,
                  "wires": [
                      [
                          "2f3b67eee446ea0a"
                      ]
                  ]
              },
              {
                  "id": "bd2ee7ed033d59ba",
                  "type": "function",
                  "z": "9f5b324af15fbb32",
                  "name": "function 15",
                  "func": "msg.topic = \"state\"\nmsg.payload.on = \"OFF\"\nmsg.payload = msg.payload.on\nreturn msg;",
                  "outputs": 1,
                  "timeout": 0,
                  "noerr": 0,
                  "initialize": "",
                  "finalize": "",
                  "libs": [],
                  "x": 690,
                  "y": 240,
                  "wires": [
                      [
                          "2f3b67eee446ea0a",
                          "c79431d898a3fb85"
                      ]
                  ]
              },
              {
                  "id": "1e330702139ad824",
                  "type": "debug",
                  "z": "9f5b324af15fbb32",
                  "name": "debug 1",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 620,
                  "y": 100,
                  "wires": []
              },
              {
                  "id": "6f3cbe12a233222c",
                  "type": "debug",
                  "z": "9f5b324af15fbb32",
                  "name": "debug 2",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 1080,
                  "y": 100,
                  "wires": []
              },
              {
                  "id": "1e5fd043fc06b201",
                  "type": "inject",
                  "z": "9f5b324af15fbb32",
                  "name": "",
                  "props": [
                      {
                          "p": "payload"
                      },
                      {
                          "p": "topic",
                          "vt": "str"
                      }
                  ],
                  "repeat": "",
                  "crontab": "",
                  "once": false,
                  "onceDelay": 0.1,
                  "topic": "",
                  "payload": "{\"on\":false,\"bri\":254,\"command\":\"switch\",\"bri_normalized\":100}",
                  "payloadType": "json",
                  "x": 150,
                  "y": 220,
                  "wires": [
                      [
                          "5251b05d8dcb44d2",
                          "3703e00eef57da29"
                      ]
                  ]
              },
              {
                  "id": "c79431d898a3fb85",
                  "type": "debug",
                  "z": "9f5b324af15fbb32",
                  "name": "debug 4",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 940,
                  "y": 40,
                  "wires": []
              },
              {
                  "id": "23458ad4a09fab41",
                  "type": "debug",
                  "z": "9f5b324af15fbb32",
                  "name": "debug 3",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "false",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 750,
                  "y": 340,
                  "wires": []
              }
          ]```
          1 Reply Last reply Reply Quote 0
          • N
            NFTVirus @NFTVirus last edited by NFTVirus

            Doppelpost deleted

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

              Also in meinen Augen hast Du die JOIN Node auch falsch konfiguriert.

              b2ca154d-bae0-4303-ba0e-a198d157a3d7-image.png

              Dieser Haken bezieht sich nur auf die Anzahl. Da Du 2 topics hast, nämlich brightness und state würde ich das ganze eh nach der Anzahl konfigurieren. Ich zeige es Dir gleich.

              Ausserdem ist es Käse schon vorher ein Objekt zu machen, das macht die JOIN Node doch selbst.

              Soll so Dein Objekt zum Schluss aussehen?

              d4b5f917-a6b4-4614-b06c-d54b02edbcf4-image.png

              Nachdem doch alles schon in einem Objekt rauskommt, musst Du es auch nicht splitten.

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

                @mickym ja muss nur mein state von true/false in ON/OFF umwandeln

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

                  @nftvirus und bri in brightness?

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

                    Wärst Du hiermit auch zufrieden?

                    8e0f65ef-7891-4b03-a7c6-aaa4e89a3f3c-image.png

                    [{"id":"02211df8c4be96d6","type":"inject","z":"8fca765b626b50bd","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"on\":true,\"bri\":254,\"command\":\"switch\",\"bri_normalized\":100}","payloadType":"json","x":190,"y":860,"wires":[["7e8d0b7a62e8dfc0"]]},{"id":"7e8d0b7a62e8dfc0","type":"change","z":"8fca765b626b50bd","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.{\"brightness\":bri,\"state\": on ? \"ON\" : \"OFF\"}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":860,"wires":[["87f25852eabdac7b"]]},{"id":"87f25852eabdac7b","type":"debug","z":"8fca765b626b50bd","name":"Gewandelt","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":860,"wires":[]}]
                    

                    Wenn ihr nur mal aufhört mit function nodes Javascript zu schreiben. 🙄

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

                      @mickym Oh danke so funktioniert es! Ich habe noch einiges zu lernen 🙂 Wirklich Vielen Dank für die Hilfe!

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

                        @nftvirus Deine Join Node hätte auch funktioniert - nur

                        3b7bee7f-00cf-402c-b410-48b7fb7f8920-image.png

                        der Haken mit jeder nachfolgenden Nachricht ist fehl am Platz - da sich das oben auf die Anzahl bezieht. Sprich dann hättest Du da was eintragen müssen.

                        Du hast die JOIN Node ja auf Zeit konfiguriert - was man auch nur im Notfall machen sollte.

                        Da Du Dein Objekt ja auseinandergerissen hast, hätte auch das funktioniert, da ja immer 2 Nachrichten ankommen:

                        50f0a2b0-6e45-42e6-a0ef-5bf38698cd46-image.png

                        Aber wie gesagt alles zu umständlich, da Du ja bereits ein Objekt hattest.

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        1.1k
                        Online

                        31.7k
                        Users

                        79.7k
                        Topics

                        1.3m
                        Posts

                        2
                        11
                        297
                        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