Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • 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

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Node-Red
  5. Function node erstellen

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.3k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.5k

Function node erstellen

Geplant Angeheftet Gesperrt Verschoben Node-Red
node-red
8 Beiträge 3 Kommentatoren 973 Aufrufe 3 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • M Offline
    M Offline
    Matthias1234
    schrieb am zuletzt editiert von Matthias1234
    #1

    Ich hätte da mal ein Anliegen:
    da ich mich mit Java-Befehlen nicht so auskenne bzw. gar nicht, würde ich gerne ein payload aus dreien erstellen. Wert aus den drei Iobroker-Werten soll am ende dieses Format habe:

    {
    "payload":{
    "hsv": {
    "hue": 358,
    "staturation": 96,
    "brightness": 100
    }
    }
    }
    

    kann mir jemand dazu die drei function-nodes erstellen?

    AsgothianA mickymM 2 Antworten Letzte Antwort
    0
    • M Matthias1234

      Ich hätte da mal ein Anliegen:
      da ich mich mit Java-Befehlen nicht so auskenne bzw. gar nicht, würde ich gerne ein payload aus dreien erstellen. Wert aus den drei Iobroker-Werten soll am ende dieses Format habe:

      {
      "payload":{
      "hsv": {
      "hue": 358,
      "staturation": 96,
      "brightness": 100
      }
      }
      }
      

      kann mir jemand dazu die drei function-nodes erstellen?

      AsgothianA Offline
      AsgothianA Offline
      Asgothian
      Developer
      schrieb am zuletzt editiert von
      #2

      @matthias1234

      Ich fürchte ich verstehe Deine Frage nicht.

      • Java nutzt der ioBroker nativ nicht
      • Welche 3 ioBroker Werte sollen denn zu diesem JSON zusammen gebaut werden ?
      • in welchem Zusammenhang soll das passieren ?

      A.

      ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
      "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

      1 Antwort Letzte Antwort
      0
      • M Matthias1234

        Ich hätte da mal ein Anliegen:
        da ich mich mit Java-Befehlen nicht so auskenne bzw. gar nicht, würde ich gerne ein payload aus dreien erstellen. Wert aus den drei Iobroker-Werten soll am ende dieses Format habe:

        {
        "payload":{
        "hsv": {
        "hue": 358,
        "staturation": 96,
        "brightness": 100
        }
        }
        }
        

        kann mir jemand dazu die drei function-nodes erstellen?

        mickymM Online
        mickymM Online
        mickym
        Most Active
        schrieb am zuletzt editiert von mickym
        #3

        @matthias1234

        Du musst halt anstelle der Inject-Nodes die entsprechenden iobroker in Nodes verkabeln. Ich habe es jetzt mit einer flow Variablen, anstelle einer function Node gemacht - da das dann ohne Programmcode geht. Diese Lösung hat dann den Vorteil, dass sich wenn alle Parameter voll sind - sich nur noch 1 Parameter ändern braucht und Du bekommst dann jeweils das ganze Objekt geliefert.

        c4d0fdb9-c4d5-490e-8d92-524ce6440401-image.png

        hier zum Importieren:

        [
           {
               "id": "9b64da83.381b98",
               "type": "inject",
               "z": "6e170384.60c96c",
               "name": "hue",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "358",
               "payloadType": "num",
               "x": 1910,
               "y": 3300,
               "wires": [
                   [
                       "44952956.f71358"
                   ]
               ]
           },
           {
               "id": "ed8d575f.f2a648",
               "type": "inject",
               "z": "6e170384.60c96c",
               "name": "staturation",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "358",
               "payloadType": "num",
               "x": 1900,
               "y": 3340,
               "wires": [
                   [
                       "5b4fc7bb.4f2408"
                   ]
               ]
           },
           {
               "id": "5534abf1.d25fb4",
               "type": "inject",
               "z": "6e170384.60c96c",
               "name": "brightness",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "100",
               "payloadType": "num",
               "x": 1900,
               "y": 3380,
               "wires": [
                   [
                       "39a42fef.233e1"
                   ]
               ]
           },
           {
               "id": "44952956.f71358",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "hsv.hue",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2090,
               "y": 3300,
               "wires": [
                   [
                       "f0b73ac7.8b2ff8"
                   ]
               ]
           },
           {
               "id": "5b4fc7bb.4f2408",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "hsv.saturation",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2110,
               "y": 3340,
               "wires": [
                   [
                       "f0b73ac7.8b2ff8"
                   ]
               ]
           },
           {
               "id": "39a42fef.233e1",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "hsv.brightness",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2110,
               "y": 3380,
               "wires": [
                   [
                       "f0b73ac7.8b2ff8"
                   ]
               ]
           },
           {
               "id": "f0b73ac7.8b2ff8",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "{}",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "payload.hsv",
                       "pt": "msg",
                       "to": "hsv",
                       "tot": "flow"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2390,
               "y": 3340,
               "wires": [
                   [
                       "a370119d.88939",
                       "696bb18f.c3732"
                   ]
               ]
           },
           {
               "id": "a370119d.88939",
               "type": "debug",
               "z": "6e170384.60c96c",
               "name": "",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "true",
               "targetType": "full",
               "statusVal": "",
               "statusType": "auto",
               "x": 2570,
               "y": 3300,
               "wires": []
           },
           {
               "id": "696bb18f.c3732",
               "type": "json",
               "z": "6e170384.60c96c",
               "name": "",
               "property": "payload",
               "action": "",
               "pretty": false,
               "x": 2570,
               "y": 3340,
               "wires": [
                   [
                       "737c2aed.c930a4"
                   ]
               ]
           },
           {
               "id": "737c2aed.c930a4",
               "type": "debug",
               "z": "6e170384.60c96c",
               "name": "",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "true",
               "targetType": "full",
               "statusVal": "",
               "statusType": "auto",
               "x": 2710,
               "y": 3340,
               "wires": []
           }
        ]
        

        Wenn Dein Node Red Adapter nur Strings liefert, dann musst halt vorher noch in Zahlenwerte konvertieren. Ich empfehle das eh umzustellen - aber das bedeutet je nachdem was Du schon implementiert hast gehörigen Umstellungsaufwand.

        Hier noch eine elegantere Möglichkeit - ohne Flow Variable - dafür bekommst Du nur vollständige Objekte zurück - erst wenn alle 3 Nodes Werte geliefert haben:

        2a618835-eaee-43ba-a899-2860f98a0bca-image.png

        [
           {
               "id": "4cf4c2be.b6899c",
               "type": "inject",
               "z": "6e170384.60c96c",
               "name": "hue",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "358",
               "payloadType": "num",
               "x": 1890,
               "y": 3460,
               "wires": [
                   [
                       "6db9d1aa.c3c81"
                   ]
               ]
           },
           {
               "id": "2217fcc6.5dd9b4",
               "type": "inject",
               "z": "6e170384.60c96c",
               "name": "staturation",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "358",
               "payloadType": "num",
               "x": 1880,
               "y": 3500,
               "wires": [
                   [
                       "a2b9e60e.263838"
                   ]
               ]
           },
           {
               "id": "9ab6b1e9.10bb2",
               "type": "inject",
               "z": "6e170384.60c96c",
               "name": "brightness",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "100",
               "payloadType": "num",
               "x": 1880,
               "y": 3540,
               "wires": [
                   [
                       "48711847.1c5d48"
                   ]
               ]
           },
           {
               "id": "6db9d1aa.c3c81",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "topic",
                       "pt": "msg",
                       "to": "hue",
                       "tot": "str"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2060,
               "y": 3460,
               "wires": [
                   [
                       "72cce25d.16a08c"
                   ]
               ]
           },
           {
               "id": "a2b9e60e.263838",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "topic",
                       "pt": "msg",
                       "to": "saturation",
                       "tot": "str"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2060,
               "y": 3500,
               "wires": [
                   [
                       "72cce25d.16a08c"
                   ]
               ]
           },
           {
               "id": "48711847.1c5d48",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "topic",
                       "pt": "msg",
                       "to": "brightness",
                       "tot": "str"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2060,
               "y": 3540,
               "wires": [
                   [
                       "72cce25d.16a08c"
                   ]
               ]
           },
           {
               "id": "72cce25d.16a08c",
               "type": "join",
               "z": "6e170384.60c96c",
               "name": "",
               "mode": "custom",
               "build": "object",
               "property": "payload",
               "propertyType": "msg",
               "key": "topic",
               "joiner": "\\n",
               "joinerType": "str",
               "accumulate": true,
               "timeout": "",
               "count": "3",
               "reduceRight": false,
               "reduceExp": "",
               "reduceInit": "",
               "reduceInitType": "",
               "reduceFixup": "",
               "x": 2260,
               "y": 3500,
               "wires": [
                   [
                       "5a9662a.438b29c"
                   ]
               ]
           },
           {
               "id": "d17d0760.b685c8",
               "type": "debug",
               "z": "6e170384.60c96c",
               "name": "",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "true",
               "targetType": "full",
               "statusVal": "",
               "statusType": "auto",
               "x": 2750,
               "y": 3500,
               "wires": []
           },
           {
               "id": "5a9662a.438b29c",
               "type": "change",
               "z": "6e170384.60c96c",
               "name": "",
               "rules": [
                   {
                       "t": "move",
                       "p": "payload",
                       "pt": "msg",
                       "to": "hsv",
                       "tot": "msg"
                   },
                   {
                       "t": "move",
                       "p": "hsv",
                       "pt": "msg",
                       "to": "payload.hsv",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2420,
               "y": 3500,
               "wires": [
                   [
                       "4624a586.319bac"
                   ]
               ]
           },
           {
               "id": "4624a586.319bac",
               "type": "json",
               "z": "6e170384.60c96c",
               "name": "",
               "property": "payload",
               "action": "",
               "pretty": false,
               "x": 2610,
               "y": 3500,
               "wires": [
                   [
                       "d17d0760.b685c8"
                   ]
               ]
           }
        ]
        

        Im topic steht dann der letzte Wert, der geliefert hat. Falls Du das nicht willst - kannst natürlich in der letzten Change Node auch noch die msg.topic löschen.

        Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

        M 1 Antwort Letzte Antwort
        0
        • mickymM mickym

          @matthias1234

          Du musst halt anstelle der Inject-Nodes die entsprechenden iobroker in Nodes verkabeln. Ich habe es jetzt mit einer flow Variablen, anstelle einer function Node gemacht - da das dann ohne Programmcode geht. Diese Lösung hat dann den Vorteil, dass sich wenn alle Parameter voll sind - sich nur noch 1 Parameter ändern braucht und Du bekommst dann jeweils das ganze Objekt geliefert.

          c4d0fdb9-c4d5-490e-8d92-524ce6440401-image.png

          hier zum Importieren:

          [
             {
                 "id": "9b64da83.381b98",
                 "type": "inject",
                 "z": "6e170384.60c96c",
                 "name": "hue",
                 "props": [
                     {
                         "p": "payload"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "358",
                 "payloadType": "num",
                 "x": 1910,
                 "y": 3300,
                 "wires": [
                     [
                         "44952956.f71358"
                     ]
                 ]
             },
             {
                 "id": "ed8d575f.f2a648",
                 "type": "inject",
                 "z": "6e170384.60c96c",
                 "name": "staturation",
                 "props": [
                     {
                         "p": "payload"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "358",
                 "payloadType": "num",
                 "x": 1900,
                 "y": 3340,
                 "wires": [
                     [
                         "5b4fc7bb.4f2408"
                     ]
                 ]
             },
             {
                 "id": "5534abf1.d25fb4",
                 "type": "inject",
                 "z": "6e170384.60c96c",
                 "name": "brightness",
                 "props": [
                     {
                         "p": "payload"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "100",
                 "payloadType": "num",
                 "x": 1900,
                 "y": 3380,
                 "wires": [
                     [
                         "39a42fef.233e1"
                     ]
                 ]
             },
             {
                 "id": "44952956.f71358",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "hsv.hue",
                         "pt": "flow",
                         "to": "payload",
                         "tot": "msg"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2090,
                 "y": 3300,
                 "wires": [
                     [
                         "f0b73ac7.8b2ff8"
                     ]
                 ]
             },
             {
                 "id": "5b4fc7bb.4f2408",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "hsv.saturation",
                         "pt": "flow",
                         "to": "payload",
                         "tot": "msg"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2110,
                 "y": 3340,
                 "wires": [
                     [
                         "f0b73ac7.8b2ff8"
                     ]
                 ]
             },
             {
                 "id": "39a42fef.233e1",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "hsv.brightness",
                         "pt": "flow",
                         "to": "payload",
                         "tot": "msg"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2110,
                 "y": 3380,
                 "wires": [
                     [
                         "f0b73ac7.8b2ff8"
                     ]
                 ]
             },
             {
                 "id": "f0b73ac7.8b2ff8",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "payload",
                         "pt": "msg",
                         "to": "{}",
                         "tot": "json"
                     },
                     {
                         "t": "set",
                         "p": "payload.hsv",
                         "pt": "msg",
                         "to": "hsv",
                         "tot": "flow"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2390,
                 "y": 3340,
                 "wires": [
                     [
                         "a370119d.88939",
                         "696bb18f.c3732"
                     ]
                 ]
             },
             {
                 "id": "a370119d.88939",
                 "type": "debug",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "true",
                 "targetType": "full",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 2570,
                 "y": 3300,
                 "wires": []
             },
             {
                 "id": "696bb18f.c3732",
                 "type": "json",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "property": "payload",
                 "action": "",
                 "pretty": false,
                 "x": 2570,
                 "y": 3340,
                 "wires": [
                     [
                         "737c2aed.c930a4"
                     ]
                 ]
             },
             {
                 "id": "737c2aed.c930a4",
                 "type": "debug",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "true",
                 "targetType": "full",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 2710,
                 "y": 3340,
                 "wires": []
             }
          ]
          

          Wenn Dein Node Red Adapter nur Strings liefert, dann musst halt vorher noch in Zahlenwerte konvertieren. Ich empfehle das eh umzustellen - aber das bedeutet je nachdem was Du schon implementiert hast gehörigen Umstellungsaufwand.

          Hier noch eine elegantere Möglichkeit - ohne Flow Variable - dafür bekommst Du nur vollständige Objekte zurück - erst wenn alle 3 Nodes Werte geliefert haben:

          2a618835-eaee-43ba-a899-2860f98a0bca-image.png

          [
             {
                 "id": "4cf4c2be.b6899c",
                 "type": "inject",
                 "z": "6e170384.60c96c",
                 "name": "hue",
                 "props": [
                     {
                         "p": "payload"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "358",
                 "payloadType": "num",
                 "x": 1890,
                 "y": 3460,
                 "wires": [
                     [
                         "6db9d1aa.c3c81"
                     ]
                 ]
             },
             {
                 "id": "2217fcc6.5dd9b4",
                 "type": "inject",
                 "z": "6e170384.60c96c",
                 "name": "staturation",
                 "props": [
                     {
                         "p": "payload"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "358",
                 "payloadType": "num",
                 "x": 1880,
                 "y": 3500,
                 "wires": [
                     [
                         "a2b9e60e.263838"
                     ]
                 ]
             },
             {
                 "id": "9ab6b1e9.10bb2",
                 "type": "inject",
                 "z": "6e170384.60c96c",
                 "name": "brightness",
                 "props": [
                     {
                         "p": "payload"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "100",
                 "payloadType": "num",
                 "x": 1880,
                 "y": 3540,
                 "wires": [
                     [
                         "48711847.1c5d48"
                     ]
                 ]
             },
             {
                 "id": "6db9d1aa.c3c81",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "topic",
                         "pt": "msg",
                         "to": "hue",
                         "tot": "str"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2060,
                 "y": 3460,
                 "wires": [
                     [
                         "72cce25d.16a08c"
                     ]
                 ]
             },
             {
                 "id": "a2b9e60e.263838",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "topic",
                         "pt": "msg",
                         "to": "saturation",
                         "tot": "str"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2060,
                 "y": 3500,
                 "wires": [
                     [
                         "72cce25d.16a08c"
                     ]
                 ]
             },
             {
                 "id": "48711847.1c5d48",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "topic",
                         "pt": "msg",
                         "to": "brightness",
                         "tot": "str"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2060,
                 "y": 3540,
                 "wires": [
                     [
                         "72cce25d.16a08c"
                     ]
                 ]
             },
             {
                 "id": "72cce25d.16a08c",
                 "type": "join",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "mode": "custom",
                 "build": "object",
                 "property": "payload",
                 "propertyType": "msg",
                 "key": "topic",
                 "joiner": "\\n",
                 "joinerType": "str",
                 "accumulate": true,
                 "timeout": "",
                 "count": "3",
                 "reduceRight": false,
                 "reduceExp": "",
                 "reduceInit": "",
                 "reduceInitType": "",
                 "reduceFixup": "",
                 "x": 2260,
                 "y": 3500,
                 "wires": [
                     [
                         "5a9662a.438b29c"
                     ]
                 ]
             },
             {
                 "id": "d17d0760.b685c8",
                 "type": "debug",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "true",
                 "targetType": "full",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 2750,
                 "y": 3500,
                 "wires": []
             },
             {
                 "id": "5a9662a.438b29c",
                 "type": "change",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "rules": [
                     {
                         "t": "move",
                         "p": "payload",
                         "pt": "msg",
                         "to": "hsv",
                         "tot": "msg"
                     },
                     {
                         "t": "move",
                         "p": "hsv",
                         "pt": "msg",
                         "to": "payload.hsv",
                         "tot": "msg"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2420,
                 "y": 3500,
                 "wires": [
                     [
                         "4624a586.319bac"
                     ]
                 ]
             },
             {
                 "id": "4624a586.319bac",
                 "type": "json",
                 "z": "6e170384.60c96c",
                 "name": "",
                 "property": "payload",
                 "action": "",
                 "pretty": false,
                 "x": 2610,
                 "y": 3500,
                 "wires": [
                     [
                         "d17d0760.b685c8"
                     ]
                 ]
             }
          ]
          

          Im topic steht dann der letzte Wert, der geliefert hat. Falls Du das nicht willst - kannst natürlich in der letzten Change Node auch noch die msg.topic löschen.

          M Offline
          M Offline
          Matthias1234
          schrieb am zuletzt editiert von Matthias1234
          #4

          @mickym

          also das Ergebnis war das richtige hat aber leider nicht funktioniert.

          {"hue":230,"saturation":190,"brightness":70}
          

          den wert bekomme ich aus einem Alexa-flow und gebe ihn weiter an den Color-converter HSV->CSS das funktioniert super. Die Lampe spuckt aber über den iobroker die werte getrennt aus und deswegen möchte ich sie zusammenführen.

          mickymM 1 Antwort Letzte Antwort
          0
          • M Matthias1234

            @mickym

            also das Ergebnis war das richtige hat aber leider nicht funktioniert.

            {"hue":230,"saturation":190,"brightness":70}
            

            den wert bekomme ich aus einem Alexa-flow und gebe ihn weiter an den Color-converter HSV->CSS das funktioniert super. Die Lampe spuckt aber über den iobroker die werte getrennt aus und deswegen möchte ich sie zusammenführen.

            mickymM Online
            mickymM Online
            mickym
            Most Active
            schrieb am zuletzt editiert von
            #5

            @matthias1234 Na dann musst Du sagen warum? Vielleicht brauchst ein anderes Format? Hast Du ggf. in Zahlen konvertiert - kommt bei Dir auch das gleiche raus, wie in meinem Screenshot oder sind Deine Zahlen in Anführungszeichen? Beschreib doch mal die Quelle in der steht, was als Input erwartet wird ... usw.

            Sonst kann man Dir kaum helfen, wenn das Ergebnis das ist, was Du wolltest, aber das was Du wolltest nicht funktioniert. ;) ;)

            Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

            M 1 Antwort Letzte Antwort
            0
            • mickymM mickym

              @matthias1234 Na dann musst Du sagen warum? Vielleicht brauchst ein anderes Format? Hast Du ggf. in Zahlen konvertiert - kommt bei Dir auch das gleiche raus, wie in meinem Screenshot oder sind Deine Zahlen in Anführungszeichen? Beschreib doch mal die Quelle in der steht, was als Input erwartet wird ... usw.

              Sonst kann man Dir kaum helfen, wenn das Ergebnis das ist, was Du wolltest, aber das was Du wolltest nicht funktioniert. ;) ;)

              M Offline
              M Offline
              Matthias1234
              schrieb am zuletzt editiert von
              #6

              @mickym und ja meine zahlen stehen in Anführungszeichen.

              mickymM 1 Antwort Letzte Antwort
              0
              • M Matthias1234

                @mickym und ja meine zahlen stehen in Anführungszeichen.

                mickymM Online
                mickymM Online
                mickym
                Most Active
                schrieb am zuletzt editiert von mickym
                #7

                @matthias1234 Das ist wenn man diese unselige Option in dem Node Red Adapter angehakt hat - dann bekommst Du alles als Strings raus. Wie gesagt, wenn DU den Haken rausnimmst hast Du ggf. einen ziemlichen Umstellungsaufwand in Deinen Flows.

                Also einfach die Werte in Zahlen wandeln. Ich verstehe das aber schon richtig - dass Du die Werte aus den iobroker Datenpunkten wieder zusammenführen willst. Deine Alexa spukt ja ansonsten den JSON schon aus.

                Um den Input aus den iobroker in Nodes in Zahlen zu konvertieren hängst Du noch folgende Change Node dazwischen:

                f524eeca-8a31-4a4c-b6c3-57c61649b064-image.png

                cc71eab3-71a8-40b8-a5ad-4671f19a91fc-image.png

                Ausserdem wolltest Du ja die Werte als Eigenschaft des Objektes hsv. Vielleicht brauchst Du das ja nicht. Aus der Alexa-Node kommt kein Objekt hsv raus - sondern scheint einfacher JSON String zu sein (als payload). In dem Fall halt einfach in den letzten Change Nodes die Zuordnung zum hsv Objekt rausbehmen.

                Ausserdem, wenn das so aus einer Alexa Node rauskommt und Du es konvertierst - warum speicherst Du das Orginal aus der Alexa Nodes nicht einfach in einer Variablen und verwendest es erst später wieder.
                Oft bekommt man halt die Informationen immer noch bruchstückhaft.

                Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                1 Antwort Letzte Antwort
                0
                • M Offline
                  M Offline
                  Matthias1234
                  schrieb am zuletzt editiert von
                  #8

                  @mickym hab es heute morgen versucht und klappt jetzt genau richtig. Danke!!!

                  1 Antwort Letzte Antwort
                  0
                  Antworten
                  • In einem neuen Thema antworten
                  Anmelden zum Antworten
                  • Älteste zuerst
                  • Neuste zuerst
                  • Meiste Stimmen


                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  822

                  Online

                  32.4k

                  Benutzer

                  81.6k

                  Themen

                  1.3m

                  Beiträge
                  Community
                  Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                  ioBroker Community 2014-2025
                  logo
                  • Anmelden

                  • Du hast noch kein Konto? Registrieren

                  • Anmelden oder registrieren, um zu suchen
                  • Erster Beitrag
                    Letzter Beitrag
                  0
                  • Home
                  • Aktuell
                  • Tags
                  • Ungelesen 0
                  • Kategorien
                  • Unreplied
                  • Beliebt
                  • GitHub
                  • Docu
                  • Hilfe