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. JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen

NEWS

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    22
    1
    1.1k

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

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    14
    1
    2.4k

JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen

Scheduled Pinned Locked Moved Node-Red
node-red
114 Posts 13 Posters 27.0k Views 12 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.
  • mickymM mickym

    @frank579

    Hallo erstmal - ist immer bissi schwierig das herauszufinden, das herauszufinden.

    Habe jetzt den Flow mal soweit eingerichtet, läuft auch fast gut. Als Topic habe ich erstmal nur # genommen, macht das sinn?

    Vielleicht solltest Du auch nicht gleich mit # anfangen, um nicht gleich alles zu laden. Aber das nur am Rande.

    Ich gehe mal davon aus, dass Du einen mit # das Subscribe Pattern des mqtt Adapters mit einem externen Broker meinst? Oder nutzt Du die mqtt-Nodes ...

    Bekomme einige Fehler im Log da er alle States als readonly anlegt, das muss ich bestimmt irgendwo ändern, nur wo ?

    Nun das machst Du nur in der iobroker-Out Node - hat mit dem Flow selbst nichts zu tun.
    Einfach da fix eintragen. - Ich hätte das zwar auch in dem Flow machen können, aber so ist man ggf. flexibler:

    d81f0b2e-0500-4e02-91d4-0f363ca98f31-image.png

    dann habe ich bei den shellys ein komisches verhalten, da legt er 2 Ordner für jeden shelly an habe mal ein par Bilder angefügt wie es unter Userdata.0 aussieht und im MQTT Adapter.

    Ich hab den Flow überarbeitet, damit sollte der Fehler nicht mehr auftreten. Bitte die Node aus dem nachfolgenden Post importieren und den Subflow wie beschrieben ersetzen.

    @frank579 - also vielen Dank - für das Beschreiben des Bugs - das mit dem 2. Ordner sollte nicht mehr auftreten. So wird der Flow immer besser. ;) - Ich empfehle Dir nochmal den ganzen Objektbaum unter 0_userdata.0 zu löschen, der von dem Flow angelegt wurde und neu zu erstellen - auch wegen den Schreibrechten - ich werde solche Einstellungen aber nicht in dem Flow festlegen, so dass man selbst entscheiden kann über die iobroker-Out Node.

    F Offline
    F Offline
    Frank579
    wrote on last edited by
    #66

    @mickym sagte in JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen:

    Ich gehe mal davon aus, dass Du einen mit # das Subscribe Pattern des mqtt Adapters mit einem externen Broker meinst? Oder nutzt Du die mqtt-Nodes ...

    Ja genau habe einen Mosquitto server laufen, da laufen aktuell aber erst mal zum testen nur die drei Geräte.
    Aber hier komme ich jetzt erst mal weiter die Json zu zerlegen und ich alle Infos schon mal in eigenen Datenpunkten habe.
    Muss jetzt mal schauen wie ich das alles umsetze, auch nachher mit der Ansteuerung der Datenpunkte.

    1 Reply Last reply
    0
    • mickymM mickym

      @mickym So ich habe es nun selbst getestet und die Änderung durchgeführt.

      Hier ist nun eine neue Version des Subflows:

      090dce7d-22fb-4ee4-8f6f-61a0ad8e9227-image.png

      [
         {
             "id": "6e802f1553b18149",
             "type": "subflow",
             "name": "JSON or Obj to IOBroker",
             "info": "# Creates an IOBroker tree\n\nThis node creates an IOBroker tree out of an Java-Object or JSON String.\n\nThe object tree will be created under 0_userdata.0\nIn addition to the JSON-String or Java Object as `msg.payload` it is necessary to specify a `msg.top` properity in addition to the msg-Object.\n\nThe object tree will be created under 0_userdata.0\n\nExisting `msg.topic` entries will be deleted.\nAn iobroker-out node has to be appended to this subflow node. It is not part of the subflow itself. No topic should be specified in the iobroker out node.\n\nIs `msg.top` property isn't defined, the `top` property of the subflow-node is used. \n\nIn the properties of the subflow node a new property `keepTopic` has been added. Default is _false_ to keep the current behaviour. If set to _true_ then the originial topic will be placed between the `top` property of the subflow node and the property of the analyzed JSON object.\n\n**Attention:**\nIf msg.top and top is empty, all msg.topics (msg.topic) will be directly prefixed with 0_userdata.0. . \n\n**Update 13.09.2022:**\nSpaces in topics of objects are no longer replaced with underscores in objects. No differences between all data types.\n\n# Erstellt einen Objektbaum im ioBroker\n\nDiese Node erstellt einen Objektbaum im ioBroker aus einem JAVA Objekt bzw. einem JSON String. \n\nDer Baum wird in jedem Fall unter 0_userdata.0 erstellt und zwar unter dem Topic der in` msg.top` mitgegeben wurde. In der `msg.payload` befindet sich dann der JSON String oder das entsprechende Objekt.\n\nExistierende `msg.topic `Einträge werden gelöscht.\nEin entsprechende iobroker-out Node muss an den Flow angehängt werden. Sie ist nicht Bestandteil des Subflows. In dieser iobroker-out Node darf kein Topic angegeben werden. \n\nFalls msg.top nicht definiert wurde, wird der `top`-Wert der Subflow-Node verwendet.\n\nIn den Eigenschaften der Subflow-Node wurde ein neuer Parameter `keepTopic` hinzugefügt. Standardwert ist _false_, um das bisherige Verhalten beizubehalten. Setzt man die Eigenschaft auf _true_, dann wird das originale Topic zwischen der `top` Eigenschaft der Subflow-Node und Eigenschaft des analysierten JSON Objektes eingefügt.\n\n**Achtung:**\nWenn top und msg.top leer ist, werden alle msg.topics (msg.topic) direkt unter dem Präfix 0_userdata.0., angelegt bzw. ausgegeben. \n\n**Update 13.09.2022:**\nLeerzeichen werden in Topics von Objekten nicht mehr durch Unterstriche ersetzt. Es gibt keine Unterschiede mehr zwischen den Datentypen.",
             "category": "",
             "in": [
                 {
                     "x": 60,
                     "y": 160,
                     "wires": [
                         {
                             "id": "554b8c663bcb46c2"
                         }
                     ]
                 }
             ],
             "out": [
                 {
                     "x": 2620,
                     "y": 280,
                     "wires": [
                         {
                             "id": "0962842ebd23e0d7",
                             "port": 0
                         }
                     ]
                 }
             ],
             "env": [
                 {
                     "name": "top",
                     "type": "str",
                     "value": "objRoot"
                 },
                 {
                     "name": "keepTopic",
                     "type": "bool",
                     "value": "false"
                 }
             ],
             "meta": {},
             "color": "#E2D96E",
             "icon": "node-red/batch.svg"
         },
         {
             "id": "3e11e8338f694832",
             "type": "split",
             "z": "6e802f1553b18149",
             "name": "split object",
             "splt": "\\n",
             "spltType": "str",
             "arraySplt": 1,
             "arraySpltType": "len",
             "stream": false,
             "addname": "key",
             "x": 1370,
             "y": 160,
             "wires": [
                 [
                     "0562a4249c8b856b"
                 ]
             ]
         },
         {
             "id": "0562a4249c8b856b",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "add key to topic",
             "rules": [
                 {
                     "t": "set",
                     "p": "stateName",
                     "pt": "msg",
                     "to": "key",
                     "tot": "msg"
                 },
                 {
                     "t": "set",
                     "p": "topic",
                     "pt": "msg",
                     "to": "topic  & '.' & key",
                     "tot": "jsonata"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1560,
             "y": 160,
             "wires": [
                 [
                     "ddc90985bef0fafa"
                 ]
             ]
         },
         {
             "id": "ddc90985bef0fafa",
             "type": "switch",
             "z": "6e802f1553b18149",
             "name": "is type?",
             "property": "payload",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "istype",
                     "v": "array",
                     "vt": "array"
                 },
                 {
                     "t": "istype",
                     "v": "object",
                     "vt": "object"
                 },
                 {
                     "t": "else"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 3,
             "x": 1740,
             "y": 160,
             "wires": [
                 [
                     "bfce19b206660fbe"
                 ],
                 [
                     "3e11e8338f694832"
                 ],
                 [
                     "1a8c03d866b85b12"
                 ]
             ]
         },
         {
             "id": "bfce19b206660fbe",
             "type": "split",
             "z": "6e802f1553b18149",
             "name": "split array",
             "splt": "\\n",
             "spltType": "str",
             "arraySplt": 1,
             "arraySpltType": "len",
             "stream": false,
             "addname": "",
             "x": 780,
             "y": 280,
             "wires": [
                 [
                     "e89927810c6d75ec"
                 ]
             ]
         },
         {
             "id": "e89927810c6d75ec",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "add index to topic",
             "rules": [
                 {
                     "t": "set",
                     "p": "topic",
                     "pt": "msg",
                     "to": "topic  & '.' & parts.index",
                     "tot": "jsonata"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 970,
             "y": 280,
             "wires": [
                 [
                     "a4d1a5d04564dc77"
                 ]
             ]
         },
         {
             "id": "f5d52c6a57d08904",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "finalize msg.topic",
             "rules": [
                 {
                     "t": "set",
                     "p": "top",
                     "pt": "msg",
                     "to": "'0_userdata.0.' & top",
                     "tot": "jsonata"
                 },
                 {
                     "t": "set",
                     "p": "topic",
                     "pt": "msg",
                     "to": "top & '.' & topic",
                     "tot": "jsonata"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 2170,
             "y": 240,
             "wires": [
                 [
                     "0962842ebd23e0d7"
                 ]
             ]
         },
         {
             "id": "c863dd7d651b2272",
             "type": "switch",
             "z": "6e802f1553b18149",
             "name": "is type?",
             "property": "payload",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "istype",
                     "v": "json",
                     "vt": "json"
                 },
                 {
                     "t": "istype",
                     "v": "object",
                     "vt": "object"
                 },
                 {
                     "t": "istype",
                     "v": "array",
                     "vt": "array"
                 },
                 {
                     "t": "else"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 4,
             "x": 580,
             "y": 160,
             "wires": [
                 [
                     "158930afddd0780b"
                 ],
                 [
                     "3e11e8338f694832"
                 ],
                 [
                     "bfce19b206660fbe"
                 ],
                 [
                     "a4d1a5d04564dc77"
                 ]
             ]
         },
         {
             "id": "158930afddd0780b",
             "type": "json",
             "z": "6e802f1553b18149",
             "name": "",
             "property": "payload",
             "action": "",
             "pretty": false,
             "x": 770,
             "y": 120,
             "wires": [
                 [
                     "3649300b4c233b10"
                 ]
             ]
         },
         {
             "id": "1a8c03d866b85b12",
             "type": "switch",
             "z": "6e802f1553b18149",
             "name": "is msg.top != null",
             "property": "top",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "nnull"
                 },
                 {
                     "t": "null"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 1950,
             "y": 280,
             "wires": [
                 [
                     "f5d52c6a57d08904"
                 ],
                 [
                     "74c895ce724750de"
                 ]
             ]
         },
         {
             "id": "e023fe88445ce43e",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "",
             "rules": [
                 {
                     "t": "delete",
                     "p": "topic",
                     "pt": "msg"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 350,
             "y": 200,
             "wires": [
                 [
                     "c863dd7d651b2272"
                 ]
             ]
         },
         {
             "id": "3649300b4c233b10",
             "type": "switch",
             "z": "6e802f1553b18149",
             "name": "is array?",
             "property": "payload",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "istype",
                     "v": "array",
                     "vt": "array"
                 },
                 {
                     "t": "else"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 900,
             "y": 120,
             "wires": [
                 [
                     "bfce19b206660fbe"
                 ],
                 [
                     "3e11e8338f694832"
                 ]
             ]
         },
         {
             "id": "1b8480cd2df7ba3f",
             "type": "comment",
             "z": "6e802f1553b18149",
             "name": "Array",
             "info": "",
             "x": 600,
             "y": 280,
             "wires": []
         },
         {
             "id": "b3541807672be040",
             "type": "comment",
             "z": "6e802f1553b18149",
             "name": "object",
             "info": "",
             "x": 1340,
             "y": 100,
             "wires": []
         },
         {
             "id": "a4d1a5d04564dc77",
             "type": "switch",
             "z": "6e802f1553b18149",
             "name": "is type?",
             "property": "payload",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "istype",
                     "v": "object",
                     "vt": "object"
                 },
                 {
                     "t": "istype",
                     "v": "array",
                     "vt": "array"
                 },
                 {
                     "t": "else"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 3,
             "x": 1160,
             "y": 280,
             "wires": [
                 [
                     "3e11e8338f694832"
                 ],
                 [
                     "bfce19b206660fbe"
                 ],
                 [
                     "1a8c03d866b85b12"
                 ]
             ]
         },
         {
             "id": "74c895ce724750de",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "finalize msg.topic",
             "rules": [
                 {
                     "t": "set",
                     "p": "top",
                     "pt": "msg",
                     "to": "top",
                     "tot": "env"
                 },
                 {
                     "t": "set",
                     "p": "top",
                     "pt": "msg",
                     "to": "'0_userdata.0.' & top",
                     "tot": "jsonata"
                 },
                 {
                     "t": "set",
                     "p": "topic",
                     "pt": "msg",
                     "to": "top & '.' & topic",
                     "tot": "jsonata"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 2170,
             "y": 320,
             "wires": [
                 [
                     "0962842ebd23e0d7"
                 ]
             ]
         },
         {
             "id": "554b8c663bcb46c2",
             "type": "switch",
             "z": "6e802f1553b18149",
             "name": "",
             "property": "keepTopic",
             "propertyType": "env",
             "rules": [
                 {
                     "t": "true"
                 },
                 {
                     "t": "false"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 170,
             "y": 160,
             "wires": [
                 [
                     "e30ba9f0483285e4"
                 ],
                 [
                     "e023fe88445ce43e"
                 ]
             ]
         },
         {
             "id": "e30ba9f0483285e4",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "",
             "rules": [
                 {
                     "t": "change",
                     "p": "topic",
                     "pt": "msg",
                     "from": "/",
                     "fromt": "str",
                     "to": ".",
                     "tot": "str"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 350,
             "y": 120,
             "wires": [
                 [
                     "c863dd7d651b2272"
                 ]
             ]
         },
         {
             "id": "0962842ebd23e0d7",
             "type": "change",
             "z": "6e802f1553b18149",
             "name": "translate invalid chars in topic",
             "rules": [
                 {
                     "t": "change",
                     "p": "topic",
                     "pt": "msg",
                     "from": "..",
                     "fromt": "str",
                     "to": ".",
                     "tot": "str"
                 },
                 {
                     "t": "change",
                     "p": "topic",
                     "pt": "msg",
                     "from": "€",
                     "fromt": "str",
                     "to": "EUR",
                     "tot": "str"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 2430,
             "y": 280,
             "wires": [
                 []
             ]
         },
         {
             "id": "df544262fde22aca",
             "type": "subflow:6e802f1553b18149",
             "z": "393214410c8f2f15",
             "name": "",
             "x": 910,
             "y": 580,
             "wires": [
                 []
             ]
         }
      ]
      

      Für alle die, die Node bereits benutzen - wie folgt vorgehen.

      1. Den Code normal in die Zwischenablage kopieren und dann importieren.
      2. Da das System erkennst, dass es diesen Subflow/Nodes bereits gibt - bitte auf "Zeige Nodes ... " gehen.

      07910a9e-986e-4d20-aa8a-694cf1a0a62e-image.png

      1. Anschließend braucht man nur den Subflow ersetzen.

      0861d7e5-b997-4960-b83c-309033d5015b-image.png

      1. Nach dem man auf "Importiere Auswahl" geklickt hat, wird einem angezeigt, wieviele Nodes ersetzt wurden. Dann noch auf Deploy.
      F Offline
      F Offline
      Frank579
      wrote on last edited by
      #67

      Hallo @mickym,

      bin endlich mal dazu gekommen hier weiter zu machen, mit Tasmota funktioniert es seit damals einwandfrei.
      Jetzt habe ich gerade mal versucht das gleiche mit meinem Shelly 3EM zu testen, da wirft er mir aber das log voll für jeden datenpunkt des 3EM.

      node-red.0
      2022-11-01 11:35:37.209	error	The id "0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.0.total_returned." is invalid. Ids are not allowed to end in "."
      node-red.0
      2022-11-01 11:35:37.209	error	Error: The id "0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.0.total_returned." is invalid. Ids are not allowed to end in "." at Utils.validateId (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/utils.js:148:23) at Adapter.setForeignState (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:6030:23) at /opt/iobroker/node_modules/@iobroker/js-controller-common/lib/common/tools.js:2116:16 at new Promise (<anonymous>) at Adapter.setForeignStateAsync (/opt/iobroker/node_modules/@iobroker/js-controller-common/lib/common/tools.js:2115:16) at Immediate.<anonymous> (/opt/iobroker/node_modules/iobroker.node-red/nodes/ioBroker.js:252:59)
      node-red.0
      2022-11-01 11:35:37.209	error	unhandled promise rejection: The id "0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.0.total_returned." is invalid. Ids are not allowed to end in "."
      node-red.0
      2022-11-01 11:35:37.209	error	Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
      

      aus der debug node:

      1.11.2022, 13:01:42node: debug 1
      0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.2.power. : msg.payload : string[5]
      "47.54"
      

      der "." ist also wirklich Zuviel wie bekomme ich den weg? :face_with_rolling_eyes:

      Gruß Frank

      mickymM 1 Reply Last reply
      0
      • F Frank579

        Hallo @mickym,

        bin endlich mal dazu gekommen hier weiter zu machen, mit Tasmota funktioniert es seit damals einwandfrei.
        Jetzt habe ich gerade mal versucht das gleiche mit meinem Shelly 3EM zu testen, da wirft er mir aber das log voll für jeden datenpunkt des 3EM.

        node-red.0
        2022-11-01 11:35:37.209	error	The id "0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.0.total_returned." is invalid. Ids are not allowed to end in "."
        node-red.0
        2022-11-01 11:35:37.209	error	Error: The id "0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.0.total_returned." is invalid. Ids are not allowed to end in "." at Utils.validateId (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/utils.js:148:23) at Adapter.setForeignState (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:6030:23) at /opt/iobroker/node_modules/@iobroker/js-controller-common/lib/common/tools.js:2116:16 at new Promise (<anonymous>) at Adapter.setForeignStateAsync (/opt/iobroker/node_modules/@iobroker/js-controller-common/lib/common/tools.js:2115:16) at Immediate.<anonymous> (/opt/iobroker/node_modules/iobroker.node-red/nodes/ioBroker.js:252:59)
        node-red.0
        2022-11-01 11:35:37.209	error	unhandled promise rejection: The id "0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.0.total_returned." is invalid. Ids are not allowed to end in "."
        node-red.0
        2022-11-01 11:35:37.209	error	Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
        

        aus der debug node:

        1.11.2022, 13:01:42node: debug 1
        0_userdata.0.MQTT.shellies.3EM_Hauptverteiler.emeter.2.power. : msg.payload : string[5]
        "47.54"
        

        der "." ist also wirklich Zuviel wie bekomme ich den weg? :face_with_rolling_eyes:

        Gruß Frank

        mickymM Online
        mickymM Online
        mickym
        Most Active
        wrote on last edited by
        #68

        @frank579 Kannst Du mal den JSON des kompletten Datenpunktes posten und hier in CodeTags einbetten?

        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.

        F 1 Reply Last reply
        0
        • mickymM mickym

          @frank579 Kannst Du mal den JSON des kompletten Datenpunktes posten und hier in CodeTags einbetten?

          F Offline
          F Offline
          Frank579
          wrote on last edited by
          #69

          @mickym
          sorry lag an mir hatte das ganze Topic drin wenn ich nur den /Info nehme klappte es bei den anderen ist es ja auch kein JSON :man-facepalming: :man-facepalming:

          Trotzdem danke :+1:

          mickymM 1 Reply Last reply
          0
          • F Frank579

            @mickym
            sorry lag an mir hatte das ganze Topic drin wenn ich nur den /Info nehme klappte es bei den anderen ist es ja auch kein JSON :man-facepalming: :man-facepalming:

            Trotzdem danke :+1:

            mickymM Online
            mickymM Online
            mickym
            Most Active
            wrote on last edited by
            #70

            @frank579 sagte in JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen:

            @mickym
            sorry lag an mir hatte das ganze Topic drin wenn ich nur den /Info nehme klappte es bei den anderen ist es ja auch kein JSON :man-facepalming: :man-facepalming:

            Trotzdem danke :+1:

            Hmm aber eigentlich darf es gar keine topics geben, die mit . enden. Was meinst Du mit ganzem topic?

            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.

            F 1 Reply Last reply
            0
            • mickymM mickym

              @frank579 sagte in JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen:

              @mickym
              sorry lag an mir hatte das ganze Topic drin wenn ich nur den /Info nehme klappte es bei den anderen ist es ja auch kein JSON :man-facepalming: :man-facepalming:

              Trotzdem danke :+1:

              Hmm aber eigentlich darf es gar keine topics geben, die mit . enden. Was meinst Du mit ganzem topic?

              F Offline
              F Offline
              Frank579
              wrote on last edited by
              #71

              @mickym
              Ich hatte in er node shellies/3EM/# eingetragen teilweise legt der mqtt Adapter die aber selbst schon als datenpunkt an, dacht es läge daran.
              so siehts im MQTT aus
              mqtt 3em.PNG

              mickymM 1 Reply Last reply
              0
              • F Frank579

                @mickym
                Ich hatte in er node shellies/3EM/# eingetragen teilweise legt der mqtt Adapter die aber selbst schon als datenpunkt an, dacht es läge daran.
                so siehts im MQTT aus
                mqtt 3em.PNG

                mickymM Online
                mickymM Online
                mickym
                Most Active
                wrote on last edited by
                #72

                @frank579 Ich hab den Fehler schon gefunden - ich werkle gerade an einer neuen Version. ;)

                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 Reply Last reply
                1
                • mickymM Online
                  mickymM Online
                  mickym
                  Most Active
                  wrote on last edited by mickym
                  #73

                  So einen neue Version des Subflows - hat sich sogar vereinfacht.

                  Einfach mal testen:

                  [
                     {
                         "id": "6e802f1553b18149",
                         "type": "subflow",
                         "name": "JSON or Obj to IOBroker",
                         "info": "# Creates an IOBroker tree\n\nThis node creates an IOBroker tree out of an Java-Object or JSON String.\n\nThe object tree will be created under 0_userdata.0\nIn addition to the JSON-String or Java Object as `msg.payload` it is necessary to specify a `msg.top` properity in addition to the msg-Object.\n\nThe object tree will be created under 0_userdata.0\n\nExisting `msg.topic` entries will be deleted.\nAn iobroker-out node has to be appended to this subflow node. It is not part of the subflow itself. No topic should be specified in the iobroker out node.\n\nIs `msg.top` property isn't defined, the `top` property of the subflow-node is used. \n\nIn the properties of the subflow node a new property `keepTopic` has been added. Default is _false_ to keep the current behaviour. If set to _true_ then the originial topic will be placed between the `top` property of the subflow node and the property of the analyzed JSON object.\n\n**Attention:**\nIf msg.top and top is empty, all msg.topics (msg.topic) will be directly prefixed with 0_userdata.0. . \n\n**Update 13.09.2022:**\nSpaces in topics of objects are no longer replaced with underscores in objects. No differences between all data types.\n\n# Erstellt einen Objektbaum im ioBroker\n\nDiese Node erstellt einen Objektbaum im ioBroker aus einem JAVA Objekt bzw. einem JSON String. \n\nDer Baum wird in jedem Fall unter 0_userdata.0 erstellt und zwar unter dem Topic der in` msg.top` mitgegeben wurde. In der `msg.payload` befindet sich dann der JSON String oder das entsprechende Objekt.\n\nExistierende `msg.topic `Einträge werden gelöscht.\nEin entsprechende iobroker-out Node muss an den Flow angehängt werden. Sie ist nicht Bestandteil des Subflows. In dieser iobroker-out Node darf kein Topic angegeben werden. \n\nFalls msg.top nicht definiert wurde, wird der `top`-Wert der Subflow-Node verwendet.\n\nIn den Eigenschaften der Subflow-Node wurde ein neuer Parameter `keepTopic` hinzugefügt. Standardwert ist _false_, um das bisherige Verhalten beizubehalten. Setzt man die Eigenschaft auf _true_, dann wird das originale Topic zwischen der `top` Eigenschaft der Subflow-Node und Eigenschaft des analysierten JSON Objektes eingefügt.\n\n**Achtung:**\nWenn top und msg.top leer ist, werden alle msg.topics (msg.topic) direkt unter dem Präfix 0_userdata.0., angelegt bzw. ausgegeben. \n\n**Update 13.09.2022:**\nLeerzeichen werden in Topics von Objekten nicht mehr durch Unterstriche ersetzt. Es gibt keine Unterschiede mehr zwischen den Datentypen.",
                         "category": "",
                         "in": [
                             {
                                 "x": 60,
                                 "y": 160,
                                 "wires": [
                                     {
                                         "id": "554b8c663bcb46c2"
                                     }
                                 ]
                             }
                         ],
                         "out": [
                             {
                                 "x": 2620,
                                 "y": 280,
                                 "wires": [
                                     {
                                         "id": "0962842ebd23e0d7",
                                         "port": 0
                                     }
                                 ]
                             }
                         ],
                         "env": [
                             {
                                 "name": "top",
                                 "type": "str",
                                 "value": "objRoot"
                             },
                             {
                                 "name": "keepTopic",
                                 "type": "bool",
                                 "value": "false"
                             }
                         ],
                         "meta": {},
                         "color": "#E2D96E",
                         "icon": "node-red/batch.svg"
                     },
                     {
                         "id": "3e11e8338f694832",
                         "type": "split",
                         "z": "6e802f1553b18149",
                         "name": "split object",
                         "splt": "\\n",
                         "spltType": "str",
                         "arraySplt": 1,
                         "arraySpltType": "len",
                         "stream": false,
                         "addname": "key",
                         "x": 1370,
                         "y": 160,
                         "wires": [
                             [
                                 "0562a4249c8b856b"
                             ]
                         ]
                     },
                     {
                         "id": "0562a4249c8b856b",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "add key to topic",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "stateName",
                                 "pt": "msg",
                                 "to": "key",
                                 "tot": "msg"
                             },
                             {
                                 "t": "set",
                                 "p": "topic",
                                 "pt": "msg",
                                 "to": "topic  & '.' & key",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 1560,
                         "y": 160,
                         "wires": [
                             [
                                 "ddc90985bef0fafa"
                             ]
                         ]
                     },
                     {
                         "id": "ddc90985bef0fafa",
                         "type": "switch",
                         "z": "6e802f1553b18149",
                         "name": "is type?",
                         "property": "payload",
                         "propertyType": "msg",
                         "rules": [
                             {
                                 "t": "istype",
                                 "v": "array",
                                 "vt": "array"
                             },
                             {
                                 "t": "istype",
                                 "v": "object",
                                 "vt": "object"
                             },
                             {
                                 "t": "else"
                             }
                         ],
                         "checkall": "true",
                         "repair": false,
                         "outputs": 3,
                         "x": 1740,
                         "y": 160,
                         "wires": [
                             [
                                 "bfce19b206660fbe"
                             ],
                             [
                                 "3e11e8338f694832"
                             ],
                             [
                                 "1a8c03d866b85b12"
                             ]
                         ]
                     },
                     {
                         "id": "bfce19b206660fbe",
                         "type": "split",
                         "z": "6e802f1553b18149",
                         "name": "split array",
                         "splt": "\\n",
                         "spltType": "str",
                         "arraySplt": 1,
                         "arraySpltType": "len",
                         "stream": false,
                         "addname": "",
                         "x": 780,
                         "y": 280,
                         "wires": [
                             [
                                 "e89927810c6d75ec"
                             ]
                         ]
                     },
                     {
                         "id": "e89927810c6d75ec",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "add index to topic",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "topic",
                                 "pt": "msg",
                                 "to": "topic  & '.' & parts.index",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 970,
                         "y": 280,
                         "wires": [
                             [
                                 "a4d1a5d04564dc77"
                             ]
                         ]
                     },
                     {
                         "id": "f5d52c6a57d08904",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "finalize msg.topic",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "top",
                                 "pt": "msg",
                                 "to": "'0_userdata.0.' & top",
                                 "tot": "jsonata"
                             },
                             {
                                 "t": "set",
                                 "p": "topic",
                                 "pt": "msg",
                                 "to": "top & '.' & topic",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 2170,
                         "y": 240,
                         "wires": [
                             [
                                 "0962842ebd23e0d7"
                             ]
                         ]
                     },
                     {
                         "id": "158930afddd0780b",
                         "type": "json",
                         "z": "6e802f1553b18149",
                         "name": "",
                         "property": "payload",
                         "action": "obj",
                         "pretty": false,
                         "x": 550,
                         "y": 160,
                         "wires": [
                             [
                                 "3649300b4c233b10"
                             ]
                         ]
                     },
                     {
                         "id": "1a8c03d866b85b12",
                         "type": "switch",
                         "z": "6e802f1553b18149",
                         "name": "is msg.top != null",
                         "property": "top",
                         "propertyType": "msg",
                         "rules": [
                             {
                                 "t": "nnull"
                             },
                             {
                                 "t": "null"
                             }
                         ],
                         "checkall": "true",
                         "repair": false,
                         "outputs": 2,
                         "x": 1950,
                         "y": 280,
                         "wires": [
                             [
                                 "f5d52c6a57d08904"
                             ],
                             [
                                 "74c895ce724750de"
                             ]
                         ]
                     },
                     {
                         "id": "e023fe88445ce43e",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "",
                         "rules": [
                             {
                                 "t": "delete",
                                 "p": "topic",
                                 "pt": "msg"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 350,
                         "y": 200,
                         "wires": [
                             [
                                 "158930afddd0780b"
                             ]
                         ]
                     },
                     {
                         "id": "3649300b4c233b10",
                         "type": "switch",
                         "z": "6e802f1553b18149",
                         "name": "is type?",
                         "property": "payload",
                         "propertyType": "msg",
                         "rules": [
                             {
                                 "t": "istype",
                                 "v": "array",
                                 "vt": "array"
                             },
                             {
                                 "t": "istype",
                                 "v": "object",
                                 "vt": "object"
                             },
                             {
                                 "t": "else"
                             }
                         ],
                         "checkall": "true",
                         "repair": false,
                         "outputs": 3,
                         "x": 720,
                         "y": 160,
                         "wires": [
                             [
                                 "bfce19b206660fbe"
                             ],
                             [
                                 "3e11e8338f694832"
                             ],
                             [
                                 "a096a93bb82b7a93"
                             ]
                         ]
                     },
                     {
                         "id": "1b8480cd2df7ba3f",
                         "type": "comment",
                         "z": "6e802f1553b18149",
                         "name": "Array",
                         "info": "",
                         "x": 600,
                         "y": 280,
                         "wires": []
                     },
                     {
                         "id": "b3541807672be040",
                         "type": "comment",
                         "z": "6e802f1553b18149",
                         "name": "object",
                         "info": "",
                         "x": 1340,
                         "y": 100,
                         "wires": []
                     },
                     {
                         "id": "a4d1a5d04564dc77",
                         "type": "switch",
                         "z": "6e802f1553b18149",
                         "name": "is type?",
                         "property": "payload",
                         "propertyType": "msg",
                         "rules": [
                             {
                                 "t": "istype",
                                 "v": "object",
                                 "vt": "object"
                             },
                             {
                                 "t": "istype",
                                 "v": "array",
                                 "vt": "array"
                             },
                             {
                                 "t": "else"
                             }
                         ],
                         "checkall": "true",
                         "repair": false,
                         "outputs": 3,
                         "x": 1160,
                         "y": 280,
                         "wires": [
                             [
                                 "3e11e8338f694832"
                             ],
                             [
                                 "bfce19b206660fbe"
                             ],
                             [
                                 "a096a93bb82b7a93"
                             ]
                         ]
                     },
                     {
                         "id": "74c895ce724750de",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "finalize msg.topic",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "top",
                                 "pt": "msg",
                                 "to": "top",
                                 "tot": "env"
                             },
                             {
                                 "t": "set",
                                 "p": "top",
                                 "pt": "msg",
                                 "to": "'0_userdata.0.' & top",
                                 "tot": "jsonata"
                             },
                             {
                                 "t": "set",
                                 "p": "topic",
                                 "pt": "msg",
                                 "to": "top & '.' & topic",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 2170,
                         "y": 320,
                         "wires": [
                             [
                                 "0962842ebd23e0d7"
                             ]
                         ]
                     },
                     {
                         "id": "554b8c663bcb46c2",
                         "type": "switch",
                         "z": "6e802f1553b18149",
                         "name": "",
                         "property": "keepTopic",
                         "propertyType": "env",
                         "rules": [
                             {
                                 "t": "true"
                             },
                             {
                                 "t": "false"
                             }
                         ],
                         "checkall": "true",
                         "repair": false,
                         "outputs": 2,
                         "x": 170,
                         "y": 160,
                         "wires": [
                             [
                                 "e30ba9f0483285e4"
                             ],
                             [
                                 "e023fe88445ce43e"
                             ]
                         ]
                     },
                     {
                         "id": "e30ba9f0483285e4",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "",
                         "rules": [
                             {
                                 "t": "change",
                                 "p": "topic",
                                 "pt": "msg",
                                 "from": "/",
                                 "fromt": "str",
                                 "to": ".",
                                 "tot": "str"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 350,
                         "y": 120,
                         "wires": [
                             [
                                 "158930afddd0780b"
                             ]
                         ]
                     },
                     {
                         "id": "0962842ebd23e0d7",
                         "type": "change",
                         "z": "6e802f1553b18149",
                         "name": "translate invalid chars in topic",
                         "rules": [
                             {
                                 "t": "change",
                                 "p": "topic",
                                 "pt": "msg",
                                 "from": "..",
                                 "fromt": "str",
                                 "to": ".",
                                 "tot": "str"
                             },
                             {
                                 "t": "change",
                                 "p": "topic",
                                 "pt": "msg",
                                 "from": "€",
                                 "fromt": "str",
                                 "to": "EUR",
                                 "tot": "str"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 2430,
                         "y": 280,
                         "wires": [
                             []
                         ]
                     },
                     {
                         "id": "a096a93bb82b7a93",
                         "type": "junction",
                         "z": "6e802f1553b18149",
                         "x": 1380,
                         "y": 280,
                         "wires": [
                             [
                                 "1a8c03d866b85b12"
                             ]
                         ]
                     },
                     {
                         "id": "436b84bced4aeddd",
                         "type": "subflow:6e802f1553b18149",
                         "z": "393214410c8f2f15",
                         "name": "",
                         "x": 590,
                         "y": 840,
                         "wires": [
                             []
                         ]
                     }
                  ]
                  

                  Dann wie unten vorgehen: https://forum.iobroker.net/post/856928

                  Dort ist ja auch noch die bisherige Version vorhanden.

                  EDIT: Sorry waren die Debug Nodes noch drin.

                  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.

                  F 1 Reply Last reply
                  0
                  • mickymM mickym

                    So einen neue Version des Subflows - hat sich sogar vereinfacht.

                    Einfach mal testen:

                    [
                       {
                           "id": "6e802f1553b18149",
                           "type": "subflow",
                           "name": "JSON or Obj to IOBroker",
                           "info": "# Creates an IOBroker tree\n\nThis node creates an IOBroker tree out of an Java-Object or JSON String.\n\nThe object tree will be created under 0_userdata.0\nIn addition to the JSON-String or Java Object as `msg.payload` it is necessary to specify a `msg.top` properity in addition to the msg-Object.\n\nThe object tree will be created under 0_userdata.0\n\nExisting `msg.topic` entries will be deleted.\nAn iobroker-out node has to be appended to this subflow node. It is not part of the subflow itself. No topic should be specified in the iobroker out node.\n\nIs `msg.top` property isn't defined, the `top` property of the subflow-node is used. \n\nIn the properties of the subflow node a new property `keepTopic` has been added. Default is _false_ to keep the current behaviour. If set to _true_ then the originial topic will be placed between the `top` property of the subflow node and the property of the analyzed JSON object.\n\n**Attention:**\nIf msg.top and top is empty, all msg.topics (msg.topic) will be directly prefixed with 0_userdata.0. . \n\n**Update 13.09.2022:**\nSpaces in topics of objects are no longer replaced with underscores in objects. No differences between all data types.\n\n# Erstellt einen Objektbaum im ioBroker\n\nDiese Node erstellt einen Objektbaum im ioBroker aus einem JAVA Objekt bzw. einem JSON String. \n\nDer Baum wird in jedem Fall unter 0_userdata.0 erstellt und zwar unter dem Topic der in` msg.top` mitgegeben wurde. In der `msg.payload` befindet sich dann der JSON String oder das entsprechende Objekt.\n\nExistierende `msg.topic `Einträge werden gelöscht.\nEin entsprechende iobroker-out Node muss an den Flow angehängt werden. Sie ist nicht Bestandteil des Subflows. In dieser iobroker-out Node darf kein Topic angegeben werden. \n\nFalls msg.top nicht definiert wurde, wird der `top`-Wert der Subflow-Node verwendet.\n\nIn den Eigenschaften der Subflow-Node wurde ein neuer Parameter `keepTopic` hinzugefügt. Standardwert ist _false_, um das bisherige Verhalten beizubehalten. Setzt man die Eigenschaft auf _true_, dann wird das originale Topic zwischen der `top` Eigenschaft der Subflow-Node und Eigenschaft des analysierten JSON Objektes eingefügt.\n\n**Achtung:**\nWenn top und msg.top leer ist, werden alle msg.topics (msg.topic) direkt unter dem Präfix 0_userdata.0., angelegt bzw. ausgegeben. \n\n**Update 13.09.2022:**\nLeerzeichen werden in Topics von Objekten nicht mehr durch Unterstriche ersetzt. Es gibt keine Unterschiede mehr zwischen den Datentypen.",
                           "category": "",
                           "in": [
                               {
                                   "x": 60,
                                   "y": 160,
                                   "wires": [
                                       {
                                           "id": "554b8c663bcb46c2"
                                       }
                                   ]
                               }
                           ],
                           "out": [
                               {
                                   "x": 2620,
                                   "y": 280,
                                   "wires": [
                                       {
                                           "id": "0962842ebd23e0d7",
                                           "port": 0
                                       }
                                   ]
                               }
                           ],
                           "env": [
                               {
                                   "name": "top",
                                   "type": "str",
                                   "value": "objRoot"
                               },
                               {
                                   "name": "keepTopic",
                                   "type": "bool",
                                   "value": "false"
                               }
                           ],
                           "meta": {},
                           "color": "#E2D96E",
                           "icon": "node-red/batch.svg"
                       },
                       {
                           "id": "3e11e8338f694832",
                           "type": "split",
                           "z": "6e802f1553b18149",
                           "name": "split object",
                           "splt": "\\n",
                           "spltType": "str",
                           "arraySplt": 1,
                           "arraySpltType": "len",
                           "stream": false,
                           "addname": "key",
                           "x": 1370,
                           "y": 160,
                           "wires": [
                               [
                                   "0562a4249c8b856b"
                               ]
                           ]
                       },
                       {
                           "id": "0562a4249c8b856b",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "add key to topic",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "stateName",
                                   "pt": "msg",
                                   "to": "key",
                                   "tot": "msg"
                               },
                               {
                                   "t": "set",
                                   "p": "topic",
                                   "pt": "msg",
                                   "to": "topic  & '.' & key",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1560,
                           "y": 160,
                           "wires": [
                               [
                                   "ddc90985bef0fafa"
                               ]
                           ]
                       },
                       {
                           "id": "ddc90985bef0fafa",
                           "type": "switch",
                           "z": "6e802f1553b18149",
                           "name": "is type?",
                           "property": "payload",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "istype",
                                   "v": "array",
                                   "vt": "array"
                               },
                               {
                                   "t": "istype",
                                   "v": "object",
                                   "vt": "object"
                               },
                               {
                                   "t": "else"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 3,
                           "x": 1740,
                           "y": 160,
                           "wires": [
                               [
                                   "bfce19b206660fbe"
                               ],
                               [
                                   "3e11e8338f694832"
                               ],
                               [
                                   "1a8c03d866b85b12"
                               ]
                           ]
                       },
                       {
                           "id": "bfce19b206660fbe",
                           "type": "split",
                           "z": "6e802f1553b18149",
                           "name": "split array",
                           "splt": "\\n",
                           "spltType": "str",
                           "arraySplt": 1,
                           "arraySpltType": "len",
                           "stream": false,
                           "addname": "",
                           "x": 780,
                           "y": 280,
                           "wires": [
                               [
                                   "e89927810c6d75ec"
                               ]
                           ]
                       },
                       {
                           "id": "e89927810c6d75ec",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "add index to topic",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "topic",
                                   "pt": "msg",
                                   "to": "topic  & '.' & parts.index",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 970,
                           "y": 280,
                           "wires": [
                               [
                                   "a4d1a5d04564dc77"
                               ]
                           ]
                       },
                       {
                           "id": "f5d52c6a57d08904",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "finalize msg.topic",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "top",
                                   "pt": "msg",
                                   "to": "'0_userdata.0.' & top",
                                   "tot": "jsonata"
                               },
                               {
                                   "t": "set",
                                   "p": "topic",
                                   "pt": "msg",
                                   "to": "top & '.' & topic",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 2170,
                           "y": 240,
                           "wires": [
                               [
                                   "0962842ebd23e0d7"
                               ]
                           ]
                       },
                       {
                           "id": "158930afddd0780b",
                           "type": "json",
                           "z": "6e802f1553b18149",
                           "name": "",
                           "property": "payload",
                           "action": "obj",
                           "pretty": false,
                           "x": 550,
                           "y": 160,
                           "wires": [
                               [
                                   "3649300b4c233b10"
                               ]
                           ]
                       },
                       {
                           "id": "1a8c03d866b85b12",
                           "type": "switch",
                           "z": "6e802f1553b18149",
                           "name": "is msg.top != null",
                           "property": "top",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "nnull"
                               },
                               {
                                   "t": "null"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 2,
                           "x": 1950,
                           "y": 280,
                           "wires": [
                               [
                                   "f5d52c6a57d08904"
                               ],
                               [
                                   "74c895ce724750de"
                               ]
                           ]
                       },
                       {
                           "id": "e023fe88445ce43e",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "",
                           "rules": [
                               {
                                   "t": "delete",
                                   "p": "topic",
                                   "pt": "msg"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 350,
                           "y": 200,
                           "wires": [
                               [
                                   "158930afddd0780b"
                               ]
                           ]
                       },
                       {
                           "id": "3649300b4c233b10",
                           "type": "switch",
                           "z": "6e802f1553b18149",
                           "name": "is type?",
                           "property": "payload",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "istype",
                                   "v": "array",
                                   "vt": "array"
                               },
                               {
                                   "t": "istype",
                                   "v": "object",
                                   "vt": "object"
                               },
                               {
                                   "t": "else"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 3,
                           "x": 720,
                           "y": 160,
                           "wires": [
                               [
                                   "bfce19b206660fbe"
                               ],
                               [
                                   "3e11e8338f694832"
                               ],
                               [
                                   "a096a93bb82b7a93"
                               ]
                           ]
                       },
                       {
                           "id": "1b8480cd2df7ba3f",
                           "type": "comment",
                           "z": "6e802f1553b18149",
                           "name": "Array",
                           "info": "",
                           "x": 600,
                           "y": 280,
                           "wires": []
                       },
                       {
                           "id": "b3541807672be040",
                           "type": "comment",
                           "z": "6e802f1553b18149",
                           "name": "object",
                           "info": "",
                           "x": 1340,
                           "y": 100,
                           "wires": []
                       },
                       {
                           "id": "a4d1a5d04564dc77",
                           "type": "switch",
                           "z": "6e802f1553b18149",
                           "name": "is type?",
                           "property": "payload",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "istype",
                                   "v": "object",
                                   "vt": "object"
                               },
                               {
                                   "t": "istype",
                                   "v": "array",
                                   "vt": "array"
                               },
                               {
                                   "t": "else"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 3,
                           "x": 1160,
                           "y": 280,
                           "wires": [
                               [
                                   "3e11e8338f694832"
                               ],
                               [
                                   "bfce19b206660fbe"
                               ],
                               [
                                   "a096a93bb82b7a93"
                               ]
                           ]
                       },
                       {
                           "id": "74c895ce724750de",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "finalize msg.topic",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "top",
                                   "pt": "msg",
                                   "to": "top",
                                   "tot": "env"
                               },
                               {
                                   "t": "set",
                                   "p": "top",
                                   "pt": "msg",
                                   "to": "'0_userdata.0.' & top",
                                   "tot": "jsonata"
                               },
                               {
                                   "t": "set",
                                   "p": "topic",
                                   "pt": "msg",
                                   "to": "top & '.' & topic",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 2170,
                           "y": 320,
                           "wires": [
                               [
                                   "0962842ebd23e0d7"
                               ]
                           ]
                       },
                       {
                           "id": "554b8c663bcb46c2",
                           "type": "switch",
                           "z": "6e802f1553b18149",
                           "name": "",
                           "property": "keepTopic",
                           "propertyType": "env",
                           "rules": [
                               {
                                   "t": "true"
                               },
                               {
                                   "t": "false"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 2,
                           "x": 170,
                           "y": 160,
                           "wires": [
                               [
                                   "e30ba9f0483285e4"
                               ],
                               [
                                   "e023fe88445ce43e"
                               ]
                           ]
                       },
                       {
                           "id": "e30ba9f0483285e4",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "",
                           "rules": [
                               {
                                   "t": "change",
                                   "p": "topic",
                                   "pt": "msg",
                                   "from": "/",
                                   "fromt": "str",
                                   "to": ".",
                                   "tot": "str"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 350,
                           "y": 120,
                           "wires": [
                               [
                                   "158930afddd0780b"
                               ]
                           ]
                       },
                       {
                           "id": "0962842ebd23e0d7",
                           "type": "change",
                           "z": "6e802f1553b18149",
                           "name": "translate invalid chars in topic",
                           "rules": [
                               {
                                   "t": "change",
                                   "p": "topic",
                                   "pt": "msg",
                                   "from": "..",
                                   "fromt": "str",
                                   "to": ".",
                                   "tot": "str"
                               },
                               {
                                   "t": "change",
                                   "p": "topic",
                                   "pt": "msg",
                                   "from": "€",
                                   "fromt": "str",
                                   "to": "EUR",
                                   "tot": "str"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 2430,
                           "y": 280,
                           "wires": [
                               []
                           ]
                       },
                       {
                           "id": "a096a93bb82b7a93",
                           "type": "junction",
                           "z": "6e802f1553b18149",
                           "x": 1380,
                           "y": 280,
                           "wires": [
                               [
                                   "1a8c03d866b85b12"
                               ]
                           ]
                       },
                       {
                           "id": "436b84bced4aeddd",
                           "type": "subflow:6e802f1553b18149",
                           "z": "393214410c8f2f15",
                           "name": "",
                           "x": 590,
                           "y": 840,
                           "wires": [
                               []
                           ]
                       }
                    ]
                    

                    Dann wie unten vorgehen: https://forum.iobroker.net/post/856928

                    Dort ist ja auch noch die bisherige Version vorhanden.

                    EDIT: Sorry waren die Debug Nodes noch drin.

                    F Offline
                    F Offline
                    Frank579
                    wrote on last edited by
                    #74

                    @mickym
                    Habe es mal schnell getestet irgend was passt jetzt nicht mehr, kann natürlich auch bei mir sein die Werte der Tasmota Steckdose werden nicht mehr aktualisiert...
                    aus der debug Node kommt

                    0_userdata.0.objRoot.ENERGY.Total : msg.payload : number
                    2.689
                    

                    ist das objRoot richtig da stand vorher der Name vom gerät ...

                    mickymM 1 Reply Last reply
                    0
                    • F Frank579

                      @mickym
                      Habe es mal schnell getestet irgend was passt jetzt nicht mehr, kann natürlich auch bei mir sein die Werte der Tasmota Steckdose werden nicht mehr aktualisiert...
                      aus der debug Node kommt

                      0_userdata.0.objRoot.ENERGY.Total : msg.payload : number
                      2.689
                      

                      ist das objRoot richtig da stand vorher der Name vom gerät ...

                      mickymM Online
                      mickymM Online
                      mickym
                      Most Active
                      wrote on last edited by
                      #75

                      @frank579 Na dann hast Du leider Deine ganze Node ersetzt - Du solltest eigentlich nur wie unter beschrieben den Subflow nehmen.

                      2f7f5dd2-198e-4a7f-8a55-c2e3f431860e-image.png

                      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.

                      F 1 Reply Last reply
                      0
                      • mickymM mickym

                        @frank579 Na dann hast Du leider Deine ganze Node ersetzt - Du solltest eigentlich nur wie unter beschrieben den Subflow nehmen.

                        2f7f5dd2-198e-4a7f-8a55-c2e3f431860e-image.png

                        F Offline
                        F Offline
                        Frank579
                        wrote on last edited by
                        #76

                        @mickym hatte ich auch so gemacht, dacht ich ... :) schaue ich direkt mal nach

                        mickymM 1 Reply Last reply
                        0
                        • F Frank579

                          @mickym hatte ich auch so gemacht, dacht ich ... :) schaue ich direkt mal nach

                          mickymM Online
                          mickymM Online
                          mickym
                          Most Active
                          wrote on last edited by mickym
                          #77

                          @frank579 sagte in JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen:

                          @mickym hatte ich auch so gemacht, dacht ich ... :) schaue ich direkt mal nach

                          Standardmässig steht in der Node

                          665e4a8d-64c4-43af-b044-e5aa4ed78211-image.png

                          Daher das objRoot.

                          Da musst Du wieder den eigenen Namen eintragen unter dem das unter 0_userdata.0 auftauchen soll und wenn Du einen ganzen Baum schreiben willst, muss das keepTopic auf true.

                          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 Reply Last reply
                          0
                          • F Offline
                            F Offline
                            Frank579
                            wrote on last edited by
                            #78

                            @mickym genau so war es.
                            wenn ich jetzt wieder den ganzen baum vom 3EM haben möchte bekomme ich immer den im log :

                            	1 Nov 15:55:58 - [error] [json:6908c423c0496cdd] Unexpected token o in JSON at position 0
                            

                            hast du eine idee was das sein könnte komme aber auch so klar benötige ja eigentlich nicht den ganzen Baum ist ja in den Mqtt-Adapter Datenpunkten schon drin, aber evtl. käme ich dann ohne den für die shellies klar nur mit node red, evtl. nehme ich mir auch was viel vor :face_with_rolling_eyes:

                            mickymM 2 Replies Last reply
                            0
                            • F Frank579

                              @mickym genau so war es.
                              wenn ich jetzt wieder den ganzen baum vom 3EM haben möchte bekomme ich immer den im log :

                              	1 Nov 15:55:58 - [error] [json:6908c423c0496cdd] Unexpected token o in JSON at position 0
                              

                              hast du eine idee was das sein könnte komme aber auch so klar benötige ja eigentlich nicht den ganzen Baum ist ja in den Mqtt-Adapter Datenpunkten schon drin, aber evtl. käme ich dann ohne den für die shellies klar nur mit node red, evtl. nehme ich mir auch was viel vor :face_with_rolling_eyes:

                              mickymM Online
                              mickymM Online
                              mickym
                              Most Active
                              wrote on last edited by
                              #79

                              @frank579 Ja hab noch einen Fehler gefunden - das Problem ist, dass er Zahlen als JSON Objekte erkennt, Strings aber nicht, da kommt dann dieser Fehler. Nächste Version folgt. ;)

                              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 Reply Last reply
                              1
                              • F Frank579

                                @mickym genau so war es.
                                wenn ich jetzt wieder den ganzen baum vom 3EM haben möchte bekomme ich immer den im log :

                                	1 Nov 15:55:58 - [error] [json:6908c423c0496cdd] Unexpected token o in JSON at position 0
                                

                                hast du eine idee was das sein könnte komme aber auch so klar benötige ja eigentlich nicht den ganzen Baum ist ja in den Mqtt-Adapter Datenpunkten schon drin, aber evtl. käme ich dann ohne den für die shellies klar nur mit node red, evtl. nehme ich mir auch was viel vor :face_with_rolling_eyes:

                                mickymM Online
                                mickymM Online
                                mickym
                                Most Active
                                wrote on last edited by mickym
                                #80

                                @frank579 So nächste Version. ;) - Ist wieder etwas komplexer, aber ich hoffe jetzt passt es:

                                [
                                   {
                                       "id": "6e802f1553b18149",
                                       "type": "subflow",
                                       "name": "JSON or Obj to IOBroker",
                                       "info": "# Creates an IOBroker tree\n\nThis node creates an IOBroker tree out of an Java-Object or JSON String.\n\nThe object tree will be created under 0_userdata.0\nIn addition to the JSON-String or Java Object as `msg.payload` it is necessary to specify a `msg.top` properity in addition to the msg-Object.\n\nThe object tree will be created under 0_userdata.0\n\nExisting `msg.topic` entries will be deleted.\nAn iobroker-out node has to be appended to this subflow node. It is not part of the subflow itself. No topic should be specified in the iobroker out node.\n\nIs `msg.top` property isn't defined, the `top` property of the subflow-node is used. \n\nIn the properties of the subflow node a new property `keepTopic` has been added. Default is _false_ to keep the current behaviour. If set to _true_ then the originial topic will be placed between the `top` property of the subflow node and the property of the analyzed JSON object.\n\n**Attention:**\nIf msg.top and top is empty, all msg.topics (msg.topic) will be directly prefixed with 0_userdata.0. . \n\n**Update 13.09.2022:**\nSpaces in topics of objects are no longer replaced with underscores in objects. No differences between all data types.\n\n# Erstellt einen Objektbaum im ioBroker\n\nDiese Node erstellt einen Objektbaum im ioBroker aus einem JAVA Objekt bzw. einem JSON String. \n\nDer Baum wird in jedem Fall unter 0_userdata.0 erstellt und zwar unter dem Topic der in` msg.top` mitgegeben wurde. In der `msg.payload` befindet sich dann der JSON String oder das entsprechende Objekt.\n\nExistierende `msg.topic `Einträge werden gelöscht.\nEin entsprechende iobroker-out Node muss an den Flow angehängt werden. Sie ist nicht Bestandteil des Subflows. In dieser iobroker-out Node darf kein Topic angegeben werden. \n\nFalls msg.top nicht definiert wurde, wird der `top`-Wert der Subflow-Node verwendet.\n\nIn den Eigenschaften der Subflow-Node wurde ein neuer Parameter `keepTopic` hinzugefügt. Standardwert ist _false_, um das bisherige Verhalten beizubehalten. Setzt man die Eigenschaft auf _true_, dann wird das originale Topic zwischen der `top` Eigenschaft der Subflow-Node und Eigenschaft des analysierten JSON Objektes eingefügt.\n\n**Achtung:**\nWenn top und msg.top leer ist, werden alle msg.topics (msg.topic) direkt unter dem Präfix 0_userdata.0., angelegt bzw. ausgegeben. \n\n**Update 13.09.2022:**\nLeerzeichen werden in Topics von Objekten nicht mehr durch Unterstriche ersetzt. Es gibt keine Unterschiede mehr zwischen den Datentypen.",
                                       "category": "",
                                       "in": [
                                           {
                                               "x": 60,
                                               "y": 160,
                                               "wires": [
                                                   {
                                                       "id": "554b8c663bcb46c2"
                                                   }
                                               ]
                                           }
                                       ],
                                       "out": [
                                           {
                                               "x": 2620,
                                               "y": 280,
                                               "wires": [
                                                   {
                                                       "id": "0962842ebd23e0d7",
                                                       "port": 0
                                                   }
                                               ]
                                           }
                                       ],
                                       "env": [
                                           {
                                               "name": "top",
                                               "type": "str",
                                               "value": "objRoot"
                                           },
                                           {
                                               "name": "keepTopic",
                                               "type": "bool",
                                               "value": "false"
                                           }
                                       ],
                                       "meta": {},
                                       "color": "#E2D96E",
                                       "icon": "node-red/batch.svg"
                                   },
                                   {
                                       "id": "3e11e8338f694832",
                                       "type": "split",
                                       "z": "6e802f1553b18149",
                                       "name": "split object",
                                       "splt": "\\n",
                                       "spltType": "str",
                                       "arraySplt": 1,
                                       "arraySpltType": "len",
                                       "stream": false,
                                       "addname": "key",
                                       "x": 1370,
                                       "y": 160,
                                       "wires": [
                                           [
                                               "0562a4249c8b856b"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "0562a4249c8b856b",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "add key to topic",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "stateName",
                                               "pt": "msg",
                                               "to": "key",
                                               "tot": "msg"
                                           },
                                           {
                                               "t": "set",
                                               "p": "topic",
                                               "pt": "msg",
                                               "to": "topic  & '.' & key",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 1560,
                                       "y": 160,
                                       "wires": [
                                           [
                                               "ddc90985bef0fafa"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "ddc90985bef0fafa",
                                       "type": "switch",
                                       "z": "6e802f1553b18149",
                                       "name": "is type?",
                                       "property": "payload",
                                       "propertyType": "msg",
                                       "rules": [
                                           {
                                               "t": "istype",
                                               "v": "array",
                                               "vt": "array"
                                           },
                                           {
                                               "t": "istype",
                                               "v": "object",
                                               "vt": "object"
                                           },
                                           {
                                               "t": "else"
                                           }
                                       ],
                                       "checkall": "true",
                                       "repair": false,
                                       "outputs": 3,
                                       "x": 1740,
                                       "y": 160,
                                       "wires": [
                                           [
                                               "bfce19b206660fbe"
                                           ],
                                           [
                                               "3e11e8338f694832"
                                           ],
                                           [
                                               "1a8c03d866b85b12"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "bfce19b206660fbe",
                                       "type": "split",
                                       "z": "6e802f1553b18149",
                                       "name": "split array",
                                       "splt": "\\n",
                                       "spltType": "str",
                                       "arraySplt": 1,
                                       "arraySpltType": "len",
                                       "stream": false,
                                       "addname": "",
                                       "x": 780,
                                       "y": 280,
                                       "wires": [
                                           [
                                               "e89927810c6d75ec"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "e89927810c6d75ec",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "add index to topic",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "topic",
                                               "pt": "msg",
                                               "to": "topic  & '.' & parts.index",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 970,
                                       "y": 280,
                                       "wires": [
                                           [
                                               "a4d1a5d04564dc77"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "f5d52c6a57d08904",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "finalize msg.topic",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "top",
                                               "pt": "msg",
                                               "to": "'0_userdata.0.' & top",
                                               "tot": "jsonata"
                                           },
                                           {
                                               "t": "set",
                                               "p": "topic",
                                               "pt": "msg",
                                               "to": "top & '.' & topic",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 2170,
                                       "y": 240,
                                       "wires": [
                                           [
                                               "0962842ebd23e0d7"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "1a8c03d866b85b12",
                                       "type": "switch",
                                       "z": "6e802f1553b18149",
                                       "name": "is msg.top != null",
                                       "property": "top",
                                       "propertyType": "msg",
                                       "rules": [
                                           {
                                               "t": "nnull"
                                           },
                                           {
                                               "t": "null"
                                           }
                                       ],
                                       "checkall": "true",
                                       "repair": false,
                                       "outputs": 2,
                                       "x": 1950,
                                       "y": 280,
                                       "wires": [
                                           [
                                               "f5d52c6a57d08904"
                                           ],
                                           [
                                               "74c895ce724750de"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "e023fe88445ce43e",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "",
                                       "rules": [
                                           {
                                               "t": "delete",
                                               "p": "topic",
                                               "pt": "msg"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 350,
                                       "y": 200,
                                       "wires": [
                                           [
                                               "3649300b4c233b10"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "3649300b4c233b10",
                                       "type": "switch",
                                       "z": "6e802f1553b18149",
                                       "name": "is type?",
                                       "property": "payload",
                                       "propertyType": "msg",
                                       "rules": [
                                           {
                                               "t": "istype",
                                               "v": "json",
                                               "vt": "json"
                                           },
                                           {
                                               "t": "istype",
                                               "v": "array",
                                               "vt": "array"
                                           },
                                           {
                                               "t": "istype",
                                               "v": "object",
                                               "vt": "object"
                                           },
                                           {
                                               "t": "else"
                                           }
                                       ],
                                       "checkall": "true",
                                       "repair": false,
                                       "outputs": 4,
                                       "x": 600,
                                       "y": 160,
                                       "wires": [
                                           [
                                               "fc7913a8524badb7"
                                           ],
                                           [
                                               "bfce19b206660fbe"
                                           ],
                                           [
                                               "3e11e8338f694832"
                                           ],
                                           [
                                               "9ac3cc3681e8b6c6"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "1b8480cd2df7ba3f",
                                       "type": "comment",
                                       "z": "6e802f1553b18149",
                                       "name": "Array",
                                       "info": "",
                                       "x": 600,
                                       "y": 280,
                                       "wires": []
                                   },
                                   {
                                       "id": "b3541807672be040",
                                       "type": "comment",
                                       "z": "6e802f1553b18149",
                                       "name": "object",
                                       "info": "",
                                       "x": 1340,
                                       "y": 100,
                                       "wires": []
                                   },
                                   {
                                       "id": "a4d1a5d04564dc77",
                                       "type": "switch",
                                       "z": "6e802f1553b18149",
                                       "name": "is type?",
                                       "property": "payload",
                                       "propertyType": "msg",
                                       "rules": [
                                           {
                                               "t": "istype",
                                               "v": "object",
                                               "vt": "object"
                                           },
                                           {
                                               "t": "istype",
                                               "v": "array",
                                               "vt": "array"
                                           },
                                           {
                                               "t": "else"
                                           }
                                       ],
                                       "checkall": "true",
                                       "repair": false,
                                       "outputs": 3,
                                       "x": 1160,
                                       "y": 280,
                                       "wires": [
                                           [
                                               "3e11e8338f694832"
                                           ],
                                           [
                                               "bfce19b206660fbe"
                                           ],
                                           [
                                               "a096a93bb82b7a93"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "74c895ce724750de",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "finalize msg.topic",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "top",
                                               "pt": "msg",
                                               "to": "top",
                                               "tot": "env"
                                           },
                                           {
                                               "t": "set",
                                               "p": "top",
                                               "pt": "msg",
                                               "to": "'0_userdata.0.' & top",
                                               "tot": "jsonata"
                                           },
                                           {
                                               "t": "set",
                                               "p": "topic",
                                               "pt": "msg",
                                               "to": "top & '.' & topic",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 2170,
                                       "y": 320,
                                       "wires": [
                                           [
                                               "0962842ebd23e0d7"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "554b8c663bcb46c2",
                                       "type": "switch",
                                       "z": "6e802f1553b18149",
                                       "name": "",
                                       "property": "keepTopic",
                                       "propertyType": "env",
                                       "rules": [
                                           {
                                               "t": "true"
                                           },
                                           {
                                               "t": "false"
                                           }
                                       ],
                                       "checkall": "true",
                                       "repair": false,
                                       "outputs": 2,
                                       "x": 170,
                                       "y": 160,
                                       "wires": [
                                           [
                                               "e30ba9f0483285e4"
                                           ],
                                           [
                                               "e023fe88445ce43e"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "e30ba9f0483285e4",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "",
                                       "rules": [
                                           {
                                               "t": "change",
                                               "p": "topic",
                                               "pt": "msg",
                                               "from": "/",
                                               "fromt": "str",
                                               "to": ".",
                                               "tot": "str"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 350,
                                       "y": 120,
                                       "wires": [
                                           [
                                               "3649300b4c233b10"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "0962842ebd23e0d7",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "translate invalid chars in topic",
                                       "rules": [
                                           {
                                               "t": "change",
                                               "p": "topic",
                                               "pt": "msg",
                                               "from": "..",
                                               "fromt": "str",
                                               "to": ".",
                                               "tot": "str"
                                           },
                                           {
                                               "t": "change",
                                               "p": "topic",
                                               "pt": "msg",
                                               "from": "€",
                                               "fromt": "str",
                                               "to": "EUR",
                                               "tot": "str"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 2430,
                                       "y": 280,
                                       "wires": [
                                           []
                                       ]
                                   },
                                   {
                                       "id": "9ac3cc3681e8b6c6",
                                       "type": "change",
                                       "z": "6e802f1553b18149",
                                       "name": "set topic, if empty",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "topic",
                                               "pt": "msg",
                                               "to": "topic ? topic : $type(payload)\t",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 950,
                                       "y": 200,
                                       "wires": [
                                           [
                                               "a096a93bb82b7a93"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "fc7913a8524badb7",
                                       "type": "json",
                                       "z": "6e802f1553b18149",
                                       "name": "",
                                       "property": "payload",
                                       "action": "obj",
                                       "pretty": false,
                                       "x": 750,
                                       "y": 100,
                                       "wires": [
                                           [
                                               "d9e7bdd4c48a8aa1"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "d9e7bdd4c48a8aa1",
                                       "type": "switch",
                                       "z": "6e802f1553b18149",
                                       "name": "is type?",
                                       "property": "payload",
                                       "propertyType": "msg",
                                       "rules": [
                                           {
                                               "t": "istype",
                                               "v": "array",
                                               "vt": "array"
                                           },
                                           {
                                               "t": "istype",
                                               "v": "object",
                                               "vt": "object"
                                           },
                                           {
                                               "t": "else"
                                           }
                                       ],
                                       "checkall": "true",
                                       "repair": false,
                                       "outputs": 3,
                                       "x": 900,
                                       "y": 100,
                                       "wires": [
                                           [
                                               "1520be42bcc2145e"
                                           ],
                                           [
                                               "1520be42bcc2145e"
                                           ],
                                           [
                                               "9ac3cc3681e8b6c6"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "a096a93bb82b7a93",
                                       "type": "junction",
                                       "z": "6e802f1553b18149",
                                       "x": 1380,
                                       "y": 280,
                                       "wires": [
                                           [
                                               "1a8c03d866b85b12"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "1520be42bcc2145e",
                                       "type": "junction",
                                       "z": "6e802f1553b18149",
                                       "x": 480,
                                       "y": 20,
                                       "wires": [
                                           [
                                               "3649300b4c233b10"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "436b84bced4aeddd",
                                       "type": "subflow:6e802f1553b18149",
                                       "z": "393214410c8f2f15",
                                       "name": "",
                                       "x": 590,
                                       "y": 840,
                                       "wires": [
                                           [
                                               "624a03b2c28140de"
                                           ]
                                       ]
                                   }
                                ]
                                

                                Außerdem werden jetzt (!!!) wenn gar kein topic gesetzt ist, das topic gelöscht werden soll und von Anfang an skalare Werte übergeben werden, einfach als topic der Datentyp gesetzt. Damit sollte das mit dem . am Ende nicht mehr vorkommen. Das lag an skalaren Typen ohne topic.

                                6a1af9c8-a604-4ba1-800a-cb9b3d07a2a5-image.png

                                Ich hoffe passt jetzt.

                                @Frank579 - eine kurze Rückmeldung wäre Klasse, dann ändere ich den Flow im 1. Post wieder.

                                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.

                                F 1 Reply Last reply
                                1
                                • mickymM mickym

                                  @frank579 So nächste Version. ;) - Ist wieder etwas komplexer, aber ich hoffe jetzt passt es:

                                  [
                                     {
                                         "id": "6e802f1553b18149",
                                         "type": "subflow",
                                         "name": "JSON or Obj to IOBroker",
                                         "info": "# Creates an IOBroker tree\n\nThis node creates an IOBroker tree out of an Java-Object or JSON String.\n\nThe object tree will be created under 0_userdata.0\nIn addition to the JSON-String or Java Object as `msg.payload` it is necessary to specify a `msg.top` properity in addition to the msg-Object.\n\nThe object tree will be created under 0_userdata.0\n\nExisting `msg.topic` entries will be deleted.\nAn iobroker-out node has to be appended to this subflow node. It is not part of the subflow itself. No topic should be specified in the iobroker out node.\n\nIs `msg.top` property isn't defined, the `top` property of the subflow-node is used. \n\nIn the properties of the subflow node a new property `keepTopic` has been added. Default is _false_ to keep the current behaviour. If set to _true_ then the originial topic will be placed between the `top` property of the subflow node and the property of the analyzed JSON object.\n\n**Attention:**\nIf msg.top and top is empty, all msg.topics (msg.topic) will be directly prefixed with 0_userdata.0. . \n\n**Update 13.09.2022:**\nSpaces in topics of objects are no longer replaced with underscores in objects. No differences between all data types.\n\n# Erstellt einen Objektbaum im ioBroker\n\nDiese Node erstellt einen Objektbaum im ioBroker aus einem JAVA Objekt bzw. einem JSON String. \n\nDer Baum wird in jedem Fall unter 0_userdata.0 erstellt und zwar unter dem Topic der in` msg.top` mitgegeben wurde. In der `msg.payload` befindet sich dann der JSON String oder das entsprechende Objekt.\n\nExistierende `msg.topic `Einträge werden gelöscht.\nEin entsprechende iobroker-out Node muss an den Flow angehängt werden. Sie ist nicht Bestandteil des Subflows. In dieser iobroker-out Node darf kein Topic angegeben werden. \n\nFalls msg.top nicht definiert wurde, wird der `top`-Wert der Subflow-Node verwendet.\n\nIn den Eigenschaften der Subflow-Node wurde ein neuer Parameter `keepTopic` hinzugefügt. Standardwert ist _false_, um das bisherige Verhalten beizubehalten. Setzt man die Eigenschaft auf _true_, dann wird das originale Topic zwischen der `top` Eigenschaft der Subflow-Node und Eigenschaft des analysierten JSON Objektes eingefügt.\n\n**Achtung:**\nWenn top und msg.top leer ist, werden alle msg.topics (msg.topic) direkt unter dem Präfix 0_userdata.0., angelegt bzw. ausgegeben. \n\n**Update 13.09.2022:**\nLeerzeichen werden in Topics von Objekten nicht mehr durch Unterstriche ersetzt. Es gibt keine Unterschiede mehr zwischen den Datentypen.",
                                         "category": "",
                                         "in": [
                                             {
                                                 "x": 60,
                                                 "y": 160,
                                                 "wires": [
                                                     {
                                                         "id": "554b8c663bcb46c2"
                                                     }
                                                 ]
                                             }
                                         ],
                                         "out": [
                                             {
                                                 "x": 2620,
                                                 "y": 280,
                                                 "wires": [
                                                     {
                                                         "id": "0962842ebd23e0d7",
                                                         "port": 0
                                                     }
                                                 ]
                                             }
                                         ],
                                         "env": [
                                             {
                                                 "name": "top",
                                                 "type": "str",
                                                 "value": "objRoot"
                                             },
                                             {
                                                 "name": "keepTopic",
                                                 "type": "bool",
                                                 "value": "false"
                                             }
                                         ],
                                         "meta": {},
                                         "color": "#E2D96E",
                                         "icon": "node-red/batch.svg"
                                     },
                                     {
                                         "id": "3e11e8338f694832",
                                         "type": "split",
                                         "z": "6e802f1553b18149",
                                         "name": "split object",
                                         "splt": "\\n",
                                         "spltType": "str",
                                         "arraySplt": 1,
                                         "arraySpltType": "len",
                                         "stream": false,
                                         "addname": "key",
                                         "x": 1370,
                                         "y": 160,
                                         "wires": [
                                             [
                                                 "0562a4249c8b856b"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "0562a4249c8b856b",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "add key to topic",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "stateName",
                                                 "pt": "msg",
                                                 "to": "key",
                                                 "tot": "msg"
                                             },
                                             {
                                                 "t": "set",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "to": "topic  & '.' & key",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 1560,
                                         "y": 160,
                                         "wires": [
                                             [
                                                 "ddc90985bef0fafa"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "ddc90985bef0fafa",
                                         "type": "switch",
                                         "z": "6e802f1553b18149",
                                         "name": "is type?",
                                         "property": "payload",
                                         "propertyType": "msg",
                                         "rules": [
                                             {
                                                 "t": "istype",
                                                 "v": "array",
                                                 "vt": "array"
                                             },
                                             {
                                                 "t": "istype",
                                                 "v": "object",
                                                 "vt": "object"
                                             },
                                             {
                                                 "t": "else"
                                             }
                                         ],
                                         "checkall": "true",
                                         "repair": false,
                                         "outputs": 3,
                                         "x": 1740,
                                         "y": 160,
                                         "wires": [
                                             [
                                                 "bfce19b206660fbe"
                                             ],
                                             [
                                                 "3e11e8338f694832"
                                             ],
                                             [
                                                 "1a8c03d866b85b12"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "bfce19b206660fbe",
                                         "type": "split",
                                         "z": "6e802f1553b18149",
                                         "name": "split array",
                                         "splt": "\\n",
                                         "spltType": "str",
                                         "arraySplt": 1,
                                         "arraySpltType": "len",
                                         "stream": false,
                                         "addname": "",
                                         "x": 780,
                                         "y": 280,
                                         "wires": [
                                             [
                                                 "e89927810c6d75ec"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "e89927810c6d75ec",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "add index to topic",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "to": "topic  & '.' & parts.index",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 970,
                                         "y": 280,
                                         "wires": [
                                             [
                                                 "a4d1a5d04564dc77"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "f5d52c6a57d08904",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "finalize msg.topic",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "top",
                                                 "pt": "msg",
                                                 "to": "'0_userdata.0.' & top",
                                                 "tot": "jsonata"
                                             },
                                             {
                                                 "t": "set",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "to": "top & '.' & topic",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 2170,
                                         "y": 240,
                                         "wires": [
                                             [
                                                 "0962842ebd23e0d7"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "1a8c03d866b85b12",
                                         "type": "switch",
                                         "z": "6e802f1553b18149",
                                         "name": "is msg.top != null",
                                         "property": "top",
                                         "propertyType": "msg",
                                         "rules": [
                                             {
                                                 "t": "nnull"
                                             },
                                             {
                                                 "t": "null"
                                             }
                                         ],
                                         "checkall": "true",
                                         "repair": false,
                                         "outputs": 2,
                                         "x": 1950,
                                         "y": 280,
                                         "wires": [
                                             [
                                                 "f5d52c6a57d08904"
                                             ],
                                             [
                                                 "74c895ce724750de"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "e023fe88445ce43e",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "",
                                         "rules": [
                                             {
                                                 "t": "delete",
                                                 "p": "topic",
                                                 "pt": "msg"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 350,
                                         "y": 200,
                                         "wires": [
                                             [
                                                 "3649300b4c233b10"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "3649300b4c233b10",
                                         "type": "switch",
                                         "z": "6e802f1553b18149",
                                         "name": "is type?",
                                         "property": "payload",
                                         "propertyType": "msg",
                                         "rules": [
                                             {
                                                 "t": "istype",
                                                 "v": "json",
                                                 "vt": "json"
                                             },
                                             {
                                                 "t": "istype",
                                                 "v": "array",
                                                 "vt": "array"
                                             },
                                             {
                                                 "t": "istype",
                                                 "v": "object",
                                                 "vt": "object"
                                             },
                                             {
                                                 "t": "else"
                                             }
                                         ],
                                         "checkall": "true",
                                         "repair": false,
                                         "outputs": 4,
                                         "x": 600,
                                         "y": 160,
                                         "wires": [
                                             [
                                                 "fc7913a8524badb7"
                                             ],
                                             [
                                                 "bfce19b206660fbe"
                                             ],
                                             [
                                                 "3e11e8338f694832"
                                             ],
                                             [
                                                 "9ac3cc3681e8b6c6"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "1b8480cd2df7ba3f",
                                         "type": "comment",
                                         "z": "6e802f1553b18149",
                                         "name": "Array",
                                         "info": "",
                                         "x": 600,
                                         "y": 280,
                                         "wires": []
                                     },
                                     {
                                         "id": "b3541807672be040",
                                         "type": "comment",
                                         "z": "6e802f1553b18149",
                                         "name": "object",
                                         "info": "",
                                         "x": 1340,
                                         "y": 100,
                                         "wires": []
                                     },
                                     {
                                         "id": "a4d1a5d04564dc77",
                                         "type": "switch",
                                         "z": "6e802f1553b18149",
                                         "name": "is type?",
                                         "property": "payload",
                                         "propertyType": "msg",
                                         "rules": [
                                             {
                                                 "t": "istype",
                                                 "v": "object",
                                                 "vt": "object"
                                             },
                                             {
                                                 "t": "istype",
                                                 "v": "array",
                                                 "vt": "array"
                                             },
                                             {
                                                 "t": "else"
                                             }
                                         ],
                                         "checkall": "true",
                                         "repair": false,
                                         "outputs": 3,
                                         "x": 1160,
                                         "y": 280,
                                         "wires": [
                                             [
                                                 "3e11e8338f694832"
                                             ],
                                             [
                                                 "bfce19b206660fbe"
                                             ],
                                             [
                                                 "a096a93bb82b7a93"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "74c895ce724750de",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "finalize msg.topic",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "top",
                                                 "pt": "msg",
                                                 "to": "top",
                                                 "tot": "env"
                                             },
                                             {
                                                 "t": "set",
                                                 "p": "top",
                                                 "pt": "msg",
                                                 "to": "'0_userdata.0.' & top",
                                                 "tot": "jsonata"
                                             },
                                             {
                                                 "t": "set",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "to": "top & '.' & topic",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 2170,
                                         "y": 320,
                                         "wires": [
                                             [
                                                 "0962842ebd23e0d7"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "554b8c663bcb46c2",
                                         "type": "switch",
                                         "z": "6e802f1553b18149",
                                         "name": "",
                                         "property": "keepTopic",
                                         "propertyType": "env",
                                         "rules": [
                                             {
                                                 "t": "true"
                                             },
                                             {
                                                 "t": "false"
                                             }
                                         ],
                                         "checkall": "true",
                                         "repair": false,
                                         "outputs": 2,
                                         "x": 170,
                                         "y": 160,
                                         "wires": [
                                             [
                                                 "e30ba9f0483285e4"
                                             ],
                                             [
                                                 "e023fe88445ce43e"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "e30ba9f0483285e4",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "",
                                         "rules": [
                                             {
                                                 "t": "change",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "from": "/",
                                                 "fromt": "str",
                                                 "to": ".",
                                                 "tot": "str"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 350,
                                         "y": 120,
                                         "wires": [
                                             [
                                                 "3649300b4c233b10"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "0962842ebd23e0d7",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "translate invalid chars in topic",
                                         "rules": [
                                             {
                                                 "t": "change",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "from": "..",
                                                 "fromt": "str",
                                                 "to": ".",
                                                 "tot": "str"
                                             },
                                             {
                                                 "t": "change",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "from": "€",
                                                 "fromt": "str",
                                                 "to": "EUR",
                                                 "tot": "str"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 2430,
                                         "y": 280,
                                         "wires": [
                                             []
                                         ]
                                     },
                                     {
                                         "id": "9ac3cc3681e8b6c6",
                                         "type": "change",
                                         "z": "6e802f1553b18149",
                                         "name": "set topic, if empty",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "topic",
                                                 "pt": "msg",
                                                 "to": "topic ? topic : $type(payload)\t",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 950,
                                         "y": 200,
                                         "wires": [
                                             [
                                                 "a096a93bb82b7a93"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "fc7913a8524badb7",
                                         "type": "json",
                                         "z": "6e802f1553b18149",
                                         "name": "",
                                         "property": "payload",
                                         "action": "obj",
                                         "pretty": false,
                                         "x": 750,
                                         "y": 100,
                                         "wires": [
                                             [
                                                 "d9e7bdd4c48a8aa1"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "d9e7bdd4c48a8aa1",
                                         "type": "switch",
                                         "z": "6e802f1553b18149",
                                         "name": "is type?",
                                         "property": "payload",
                                         "propertyType": "msg",
                                         "rules": [
                                             {
                                                 "t": "istype",
                                                 "v": "array",
                                                 "vt": "array"
                                             },
                                             {
                                                 "t": "istype",
                                                 "v": "object",
                                                 "vt": "object"
                                             },
                                             {
                                                 "t": "else"
                                             }
                                         ],
                                         "checkall": "true",
                                         "repair": false,
                                         "outputs": 3,
                                         "x": 900,
                                         "y": 100,
                                         "wires": [
                                             [
                                                 "1520be42bcc2145e"
                                             ],
                                             [
                                                 "1520be42bcc2145e"
                                             ],
                                             [
                                                 "9ac3cc3681e8b6c6"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "a096a93bb82b7a93",
                                         "type": "junction",
                                         "z": "6e802f1553b18149",
                                         "x": 1380,
                                         "y": 280,
                                         "wires": [
                                             [
                                                 "1a8c03d866b85b12"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "1520be42bcc2145e",
                                         "type": "junction",
                                         "z": "6e802f1553b18149",
                                         "x": 480,
                                         "y": 20,
                                         "wires": [
                                             [
                                                 "3649300b4c233b10"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "436b84bced4aeddd",
                                         "type": "subflow:6e802f1553b18149",
                                         "z": "393214410c8f2f15",
                                         "name": "",
                                         "x": 590,
                                         "y": 840,
                                         "wires": [
                                             [
                                                 "624a03b2c28140de"
                                             ]
                                         ]
                                     }
                                  ]
                                  

                                  Außerdem werden jetzt (!!!) wenn gar kein topic gesetzt ist, das topic gelöscht werden soll und von Anfang an skalare Werte übergeben werden, einfach als topic der Datentyp gesetzt. Damit sollte das mit dem . am Ende nicht mehr vorkommen. Das lag an skalaren Typen ohne topic.

                                  6a1af9c8-a604-4ba1-800a-cb9b3d07a2a5-image.png

                                  Ich hoffe passt jetzt.

                                  @Frank579 - eine kurze Rückmeldung wäre Klasse, dann ändere ich den Flow im 1. Post wieder.

                                  F Offline
                                  F Offline
                                  Frank579
                                  wrote on last edited by
                                  #81

                                  @mickym
                                  Auf den ersten Blick sieht alles gut aus, log bleibt sauber :)
                                  Top Arbeit von dir :+1:

                                  mickymM 1 Reply Last reply
                                  1
                                  • F Frank579

                                    @mickym
                                    Auf den ersten Blick sieht alles gut aus, log bleibt sauber :)
                                    Top Arbeit von dir :+1:

                                    mickymM Online
                                    mickymM Online
                                    mickym
                                    Most Active
                                    wrote on last edited by
                                    #82

                                    @frank579 Gut, dann übernehm ich diese Version mal in den ersten Post - Historie hab ich schon geändert.

                                    Danke für Rückmeldung.

                                    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 Reply Last reply
                                    0
                                    • mickymM mickym

                                      @noah3112 Das ist Deine mqtt-IN Node - da hast wahrscheinlich angegeben, dass es sich um ein analysiertes JSON Objekt handelt.

                                      bc3bbca0-c313-4237-9707-082a99708bd3-image.png

                                      Du musst das nur wieder auf String und Buffer umstellen - der Subflow wandelt Strings automatisch um. Das Problem mit der Analyse eines analysierten JSON Objektes der mqtt-In Node schmeisst den Fehler bei Analyse des Objekts bei normalen Strings. Ich hab das im Node Red Forum schon moniert und hoffe, dass es in der Version 3 behoben wird. Also einfach wieder auf String und Buffer umstellen.

                                      Falls es Dich interessiert habe ich das Problem hier beschrieben.
                                      https://discourse.nodered.org/t/improvement-of-mqtt-in-nodes/55445/17

                                      Falls Du in anderen Situationen trotzdem die Funktion des analysierten JSON Objektes in Deiner mqtt-IN Node nutzen willst und aber auch teilweise Strings hast, dann kann man dass auch mit einer Catch NOde abfangen. In dem Fall kann aber der Subflow damit umgehen, da die erste Switch Node sogar den Typ JSON String kennt. ;)

                                      Grundsätzlich kannst Du dich schon verlassen, welche Node einen Fehler verursacht:

                                      f73f675a-df9b-4fc3-9a50-1c811db3e033-image.png

                                      Also die Node "zigbee2mqtt to iobroker"

                                      Also lange Rede - kurzer Sinn - einfach wieder auf Auto-Erkennung (string or buffer) umstellen.

                                      mickymM Online
                                      mickymM Online
                                      mickym
                                      Most Active
                                      wrote on last edited by
                                      #83

                                      @mickym sagte in JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen:

                                      @noah3112 Das ist Deine mqtt-IN Node - da hast wahrscheinlich angegeben, dass es sich um ein analysiertes JSON Objekt handelt.

                                      bc3bbca0-c313-4237-9707-082a99708bd3-image.png

                                      Du musst das nur wieder auf String und Buffer umstellen - der Subflow wandelt Strings automatisch um. Das Problem mit der Analyse eines analysierten JSON Objektes der mqtt-In Node schmeisst den Fehler bei Analyse des Objekts bei normalen Strings. Ich hab das im Node Red Forum schon moniert und hoffe, dass es in der Version 3 behoben wird. Also einfach wieder auf String und Buffer umstellen.

                                      Falls es Dich interessiert habe ich das Problem hier beschrieben.
                                      https://discourse.nodered.org/t/improvement-of-mqtt-in-nodes/55445/17

                                      Falls Du in anderen Situationen trotzdem die Funktion des analysierten JSON Objektes in Deiner mqtt-IN Node nutzen willst und aber auch teilweise Strings hast, dann kann man dass auch mit einer Catch NOde abfangen. In dem Fall kann aber der Subflow damit umgehen, da die erste Switch Node sogar den Typ JSON String kennt. ;)

                                      Grundsätzlich kannst Du dich schon verlassen, welche Node einen Fehler verursacht:

                                      f73f675a-df9b-4fc3-9a50-1c811db3e033-image.png

                                      Also die Node "zigbee2mqtt to iobroker"

                                      Also lange Rede - kurzer Sinn - einfach wieder auf Auto-Erkennung (string or buffer) umstellen.

                                      Dieses Thema ist übrigens seit der neuest Node-Red Version (also NodeRed Adapter 4.0.0) nicht mehr relevant. Das JSON-Objekt wird nun auch bei Strings und skalaren Werten von der mqtt-IN Node richtig interpretiert:

                                      61b8dcbd-57cf-464b-ba68-d46ab62b46d2-image.png

                                      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 Reply Last reply
                                      0
                                      • mickymM Online
                                        mickymM Online
                                        mickym
                                        Most Active
                                        wrote on last edited by
                                        #84

                                        So ich habe die Eingangsanleitung aktualisiert, damit man sich die Änderungen nicht alle aus dem Thread zusammensuchen muss. ;)

                                        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.

                                        W 2 Replies Last reply
                                        1
                                        • mickymM mickym

                                          So ich habe die Eingangsanleitung aktualisiert, damit man sich die Änderungen nicht alle aus dem Thread zusammensuchen muss. ;)

                                          W Offline
                                          W Offline
                                          warp-it
                                          wrote on last edited by
                                          #85

                                          @mickym said in JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen:

                                          So ich habe die Eingangsanleitung aktualisiert, damit man sich die Änderungen nicht alle aus dem Thread zusammensuchen muss. ;)

                                          Extrem cool, vielen Dank!

                                          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

                                          674

                                          Online

                                          32.5k

                                          Users

                                          81.6k

                                          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