Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    JSON oder JavaScript Objekt in iobroker Datenpunkte zerlegen

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

      Neue Version 8.4.2021:

      [
         {
             "id": "c3403a60.92fbb8",
             "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 no `msg.top` property is defined, then you will get an error in the following iobroker-out node (key or topic does not exist) - if you append a debug node to the subflow node you will get the message: \n> Please define msg.top as root for the object structure \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 in keine Angabe in msg.top definiert wurde, wird man in der darauffolgenden iobroker-out node den Fehler erhalten, dass kein key oder topic definiert ist. Falls eine debug Node an den Subflow angehängt wirde erhält man folgende Ausgabe:\n> Please define msg.top as root for the object structure ",
             "category": "",
             "in": [
                 {
                     "x": 60,
                     "y": 160,
                     "wires": [
                         {
                             "id": "94876630.f71748"
                         }
                     ]
                 }
             ],
             "out": [
                 {
                     "x": 2280,
                     "y": 260,
                     "wires": [
                         {
                             "id": "74b0b536.02371c",
                             "port": 0
                         },
                         {
                             "id": "ab9b1e85.eea2a",
                             "port": 0
                         }
                     ]
                 }
             ],
             "env": [],
             "color": "#E2D96E",
             "icon": "node-red/batch.svg"
         },
         {
             "id": "eea737e7.7e8fb8",
             "type": "split",
             "z": "c3403a60.92fbb8",
             "name": "split object",
             "splt": "\\n",
             "spltType": "str",
             "arraySplt": 1,
             "arraySpltType": "len",
             "stream": false,
             "addname": "key",
             "x": 1170,
             "y": 160,
             "wires": [
                 [
                     "dc473616.c2b508"
                 ]
             ]
         },
         {
             "id": "dc473616.c2b508",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "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"
                 },
                 {
                     "t": "change",
                     "p": "topic",
                     "pt": "msg",
                     "from": " ",
                     "fromt": "str",
                     "to": "_",
                     "tot": "str"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1360,
             "y": 160,
             "wires": [
                 [
                     "78697695.9a72c8"
                 ]
             ]
         },
         {
             "id": "78697695.9a72c8",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "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": 1540,
             "y": 160,
             "wires": [
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "eea737e7.7e8fb8"
                 ],
                 [
                     "bdfdae99.f4d9d"
                 ]
             ]
         },
         {
             "id": "d839cef8.577f1",
             "type": "split",
             "z": "c3403a60.92fbb8",
             "name": "split array",
             "splt": "\\n",
             "spltType": "str",
             "arraySplt": 1,
             "arraySpltType": "len",
             "stream": false,
             "addname": "",
             "x": 580,
             "y": 280,
             "wires": [
                 [
                     "36327f2d.8efc3"
                 ]
             ]
         },
         {
             "id": "36327f2d.8efc3",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "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": 770,
             "y": 280,
             "wires": [
                 [
                     "d8f58d9b.b6a1"
                 ]
             ]
         },
         {
             "id": "74b0b536.02371c",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "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": 1970,
             "y": 240,
             "wires": [
                 []
             ]
         },
         {
             "id": "4cdee7cb.910c38",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "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": 400,
             "y": 160,
             "wires": [
                 [
                     "c1c41535.17d3b8"
                 ],
                 [
                     "eea737e7.7e8fb8"
                 ],
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "d8f58d9b.b6a1"
                 ]
             ]
         },
         {
             "id": "c1c41535.17d3b8",
             "type": "json",
             "z": "c3403a60.92fbb8",
             "name": "",
             "property": "payload",
             "action": "",
             "pretty": false,
             "x": 570,
             "y": 120,
             "wires": [
                 [
                     "3ccd67db.375058"
                 ]
             ]
         },
         {
             "id": "bdfdae99.f4d9d",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "name": "is msg.top != null",
             "property": "top",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "nnull"
                 },
                 {
                     "t": "null"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 1750,
             "y": 280,
             "wires": [
                 [
                     "74b0b536.02371c"
                 ],
                 [
                     "7ba7dc21.fdb214"
                 ]
             ]
         },
         {
             "id": "7ba7dc21.fdb214",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "name": "payload = warning",
             "rules": [
                 {
                     "t": "set",
                     "p": "payload",
                     "pt": "msg",
                     "to": "Please define msg.top as root for the object structure",
                     "tot": "str"
                 },
                 {
                     "t": "delete",
                     "p": "topic",
                     "pt": "msg"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1970,
             "y": 300,
             "wires": [
                 [
                     "ab9b1e85.eea2a"
                 ]
             ]
         },
         {
             "id": "ab9b1e85.eea2a",
             "type": "rbe",
             "z": "c3403a60.92fbb8",
             "name": "",
             "func": "rbe",
             "gap": "",
             "start": "",
             "inout": "out",
             "septopics": true,
             "property": "payload",
             "x": 2130,
             "y": 300,
             "wires": [
                 []
             ]
         },
         {
             "id": "94876630.f71748",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "name": "",
             "rules": [
                 {
                     "t": "delete",
                     "p": "topic",
                     "pt": "msg"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 210,
             "y": 160,
             "wires": [
                 [
                     "4cdee7cb.910c38"
                 ]
             ]
         },
         {
             "id": "3ccd67db.375058",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "name": "is array?",
             "property": "payload",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "istype",
                     "v": "array",
                     "vt": "array"
                 },
                 {
                     "t": "else"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 700,
             "y": 120,
             "wires": [
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "eea737e7.7e8fb8"
                 ]
             ]
         },
         {
             "id": "80dde279.c28ec",
             "type": "comment",
             "z": "c3403a60.92fbb8",
             "name": "Array",
             "info": "",
             "x": 400,
             "y": 280,
             "wires": []
         },
         {
             "id": "95ee816e.68a16",
             "type": "comment",
             "z": "c3403a60.92fbb8",
             "name": "object",
             "info": "",
             "x": 1140,
             "y": 100,
             "wires": []
         },
         {
             "id": "d8f58d9b.b6a1",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "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": 960,
             "y": 280,
             "wires": [
                 [
                     "eea737e7.7e8fb8"
                 ],
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "bdfdae99.f4d9d"
                 ]
             ]
         },
         {
             "id": "ff5e1c47.969ce",
             "type": "subflow:c3403a60.92fbb8",
             "z": "6e170384.60c96c",
             "name": "",
             "env": [],
             "x": 2030,
             "y": 3940,
             "wires": [
                 [
                     "55508830.4f7648",
                     "d33d7111.87185"
                 ]
             ]
         }
      ]
      
      

      59082740-c25c-440d-b41b-621cd60c496a-image.png

      Hier nun die einzelnen Beispiele einmal als Gesamtflow - hier aber dann auch nochmal in Screenshots dargestellt:

      Erstmal zum Selbstausprobieren der Gesamtflow:

      [
         {
             "id": "c3403a60.92fbb8",
             "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 no `msg.top` property is defined, then you will get an error in the following iobroker-out node (key or topic does not exist) - if you append a debug node to the subflow node you will get the message: \n> Please define msg.top as root for the object structure \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 in keine Angabe in msg.top definiert wurde, wird man in der darauffolgenden iobroker-out node den Fehler erhalten, dass kein key oder topic definiert ist. Falls eine debug Node an den Subflow angehängt wirde erhält man folgende Ausgabe:\n> Please define msg.top as root for the object structure ",
             "category": "",
             "in": [
                 {
                     "x": 60,
                     "y": 160,
                     "wires": [
                         {
                             "id": "94876630.f71748"
                         }
                     ]
                 }
             ],
             "out": [
                 {
                     "x": 2280,
                     "y": 260,
                     "wires": [
                         {
                             "id": "74b0b536.02371c",
                             "port": 0
                         },
                         {
                             "id": "ab9b1e85.eea2a",
                             "port": 0
                         }
                     ]
                 }
             ],
             "env": [],
             "color": "#E2D96E",
             "icon": "node-red/batch.svg"
         },
         {
             "id": "eea737e7.7e8fb8",
             "type": "split",
             "z": "c3403a60.92fbb8",
             "name": "split object",
             "splt": "\\n",
             "spltType": "str",
             "arraySplt": 1,
             "arraySpltType": "len",
             "stream": false,
             "addname": "key",
             "x": 1170,
             "y": 160,
             "wires": [
                 [
                     "dc473616.c2b508"
                 ]
             ]
         },
         {
             "id": "dc473616.c2b508",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "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"
                 },
                 {
                     "t": "change",
                     "p": "topic",
                     "pt": "msg",
                     "from": " ",
                     "fromt": "str",
                     "to": "_",
                     "tot": "str"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1360,
             "y": 160,
             "wires": [
                 [
                     "78697695.9a72c8"
                 ]
             ]
         },
         {
             "id": "78697695.9a72c8",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "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": 1540,
             "y": 160,
             "wires": [
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "eea737e7.7e8fb8"
                 ],
                 [
                     "bdfdae99.f4d9d"
                 ]
             ]
         },
         {
             "id": "d839cef8.577f1",
             "type": "split",
             "z": "c3403a60.92fbb8",
             "name": "split array",
             "splt": "\\n",
             "spltType": "str",
             "arraySplt": 1,
             "arraySpltType": "len",
             "stream": false,
             "addname": "",
             "x": 580,
             "y": 280,
             "wires": [
                 [
                     "36327f2d.8efc3"
                 ]
             ]
         },
         {
             "id": "36327f2d.8efc3",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "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": 770,
             "y": 280,
             "wires": [
                 [
                     "d8f58d9b.b6a1"
                 ]
             ]
         },
         {
             "id": "74b0b536.02371c",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "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": 1970,
             "y": 240,
             "wires": [
                 []
             ]
         },
         {
             "id": "4cdee7cb.910c38",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "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": 400,
             "y": 160,
             "wires": [
                 [
                     "c1c41535.17d3b8"
                 ],
                 [
                     "eea737e7.7e8fb8"
                 ],
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "d8f58d9b.b6a1"
                 ]
             ]
         },
         {
             "id": "c1c41535.17d3b8",
             "type": "json",
             "z": "c3403a60.92fbb8",
             "name": "",
             "property": "payload",
             "action": "",
             "pretty": false,
             "x": 570,
             "y": 120,
             "wires": [
                 [
                     "3ccd67db.375058"
                 ]
             ]
         },
         {
             "id": "bdfdae99.f4d9d",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "name": "is msg.top != null",
             "property": "top",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "nnull"
                 },
                 {
                     "t": "null"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 1750,
             "y": 280,
             "wires": [
                 [
                     "74b0b536.02371c"
                 ],
                 [
                     "7ba7dc21.fdb214"
                 ]
             ]
         },
         {
             "id": "7ba7dc21.fdb214",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "name": "payload = warning",
             "rules": [
                 {
                     "t": "set",
                     "p": "payload",
                     "pt": "msg",
                     "to": "Please define msg.top as root for the object structure",
                     "tot": "str"
                 },
                 {
                     "t": "delete",
                     "p": "topic",
                     "pt": "msg"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1970,
             "y": 300,
             "wires": [
                 [
                     "ab9b1e85.eea2a"
                 ]
             ]
         },
         {
             "id": "ab9b1e85.eea2a",
             "type": "rbe",
             "z": "c3403a60.92fbb8",
             "name": "",
             "func": "rbe",
             "gap": "",
             "start": "",
             "inout": "out",
             "septopics": true,
             "property": "payload",
             "x": 2130,
             "y": 300,
             "wires": [
                 []
             ]
         },
         {
             "id": "94876630.f71748",
             "type": "change",
             "z": "c3403a60.92fbb8",
             "name": "",
             "rules": [
                 {
                     "t": "delete",
                     "p": "topic",
                     "pt": "msg"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 210,
             "y": 160,
             "wires": [
                 [
                     "4cdee7cb.910c38"
                 ]
             ]
         },
         {
             "id": "3ccd67db.375058",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "name": "is array?",
             "property": "payload",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "istype",
                     "v": "array",
                     "vt": "array"
                 },
                 {
                     "t": "else"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 2,
             "x": 700,
             "y": 120,
             "wires": [
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "eea737e7.7e8fb8"
                 ]
             ]
         },
         {
             "id": "80dde279.c28ec",
             "type": "comment",
             "z": "c3403a60.92fbb8",
             "name": "Array",
             "info": "",
             "x": 400,
             "y": 280,
             "wires": []
         },
         {
             "id": "95ee816e.68a16",
             "type": "comment",
             "z": "c3403a60.92fbb8",
             "name": "object",
             "info": "",
             "x": 1140,
             "y": 100,
             "wires": []
         },
         {
             "id": "d8f58d9b.b6a1",
             "type": "switch",
             "z": "c3403a60.92fbb8",
             "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": 960,
             "y": 280,
             "wires": [
                 [
                     "eea737e7.7e8fb8"
                 ],
                 [
                     "d839cef8.577f1"
                 ],
                 [
                     "bdfdae99.f4d9d"
                 ]
             ]
         },
         {
             "id": "39af146b.246efc",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "Example.Object",
             "props": [
                 {
                     "p": "payload"
                 },
                 {
                     "p": "top",
                     "v": "Example.Object",
                     "vt": "str"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "{\"Präsenz Wohnzimmer Essbereich\":true,\"Präsenz Bad\":true,\"Präsenz Schlafzimmer\":true,\"Thermometer Bad\":true,\"Präsenz Flur\":true,\"Würfel Wohnzimmer\":{\"1\":\"TV\"},\"Präsenz Küche\":true,\"Würfel Schlafzimmer\":true,\"Thermometer Küche\":true,\"Präsenz Diele\":true,\"Präsenz Wohnzimmer\":true,\"Präsenz Büro\":true}",
             "payloadType": "json",
             "x": 1740,
             "y": 3920,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "55508830.4f7648",
             "type": "ioBroker out",
             "z": "6e170384.60c96c",
             "name": "",
             "topic": "",
             "ack": "true",
             "autoCreate": "true",
             "stateName": "",
             "role": "",
             "payloadType": "",
             "readonly": "",
             "stateUnit": "",
             "stateMin": "",
             "stateMax": "",
             "x": 2260,
             "y": 3940,
             "wires": []
         },
         {
             "id": "ef13139d.f769b",
             "type": "comment",
             "z": "6e170384.60c96c",
             "name": "JSON String im iobroker abbilden",
             "info": "",
             "x": 1710,
             "y": 3660,
             "wires": []
         },
         {
             "id": "eb4a9e48.412dd",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "Example.JSON_String",
             "props": [
                 {
                     "p": "payload"
                 },
                 {
                     "p": "top",
                     "v": "Example.JSON_String",
                     "vt": "str"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "{\"squadName\":\"Super hero squad\",\"homeTown\":\"Metro City\",\"formed\":2016,\"secretBase\":\"Super tower\",\"active\":true,\"members\":[{\"name\":\"Molecule Man\",\"age\":29,\"secretIdentity\":\"Dan Jukes\",\"powers\":[\"Radiation resistance\",\"Turning tiny\",\"Radiation blast\"],\"dressed\":{\"head\":\"Kopfbedeckung\"}},{\"name\":\"Madame Uppercut\",\"age\":69,\"secretIdentity\":\"Jane Wilson\",\"powers\":[\"Million tonne punch\",\"Damage resistance\",\"Superhuman reflexes\"]},{\"name\":\"Eternal Flame\",\"age\":1000000,\"secretIdentity\":\"Unknown\",\"powers\":[\"Immortality\",\"Heat Immunity\",\"Inferno\",\"Teleportation\",\"Interdimensional travel\"]}]}",
             "payloadType": "str",
             "x": 1720,
             "y": 4000,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "e634a854.6906e8",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "missing msg.top",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "{\"Leaving\":\"288.700000\",\"Returning\":\"24.900000\"}",
             "payloadType": "str",
             "x": 1740,
             "y": 4040,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "ff5e1c47.969ce",
             "type": "subflow:c3403a60.92fbb8",
             "z": "6e170384.60c96c",
             "name": "",
             "env": [],
             "x": 2030,
             "y": 3940,
             "wires": [
                 [
                     "55508830.4f7648"
                 ]
             ]
         },
         {
             "id": "9ba223c1.87f48",
             "type": "change",
             "z": "6e170384.60c96c",
             "name": "Example.AddTopic",
             "rules": [
                 {
                     "t": "set",
                     "p": "top",
                     "pt": "msg",
                     "to": "Example.AddTopic",
                     "tot": "str"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1730,
             "y": 3760,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "5faa833d.62380c",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "Example.ObjectArray",
             "props": [
                 {
                     "p": "payload"
                 },
                 {
                     "p": "top",
                     "v": "Example.ObjectArray",
                     "vt": "str"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "[{\"start\":45,\"end\":100,\"date\":\"24.3.2021 18:44\",\"diff\":1,\"quantity\":0,\"price\":\"0.00\",\"basicPrice\":0,\"startDate\":\"24.3.2021 18:44\",\"duration\":1,\"perHour\":0},{\"start\":51,\"end\":52,\"date\":\"24.3.2021 15:59\",\"diff\":3,\"quantity\":0,\"price\":\"0.00\",\"basicPrice\":0,\"startDate\":\"24.3.2021 15:57\",\"duration\":3,\"perHour\":0},{\"start\":59,\"end\":100,\"date\":\"24.2.2021 14:27\",\"diff\":29,\"quantity\":0,\"price\":\"0.00\",\"basicPrice\":0,\"startDate\":\"24.2.2021 13:59\",\"duration\":29,\"perHour\":0}]",
             "payloadType": "json",
             "x": 1720,
             "y": 3960,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "cbaeed2b.bf7b4",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "Example.Skalar",
             "props": [
                 {
                     "p": "payload"
                 },
                 {
                     "p": "top",
                     "v": "Example.Skalar",
                     "vt": "str"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "Hello World",
             "payloadType": "str",
             "x": 1740,
             "y": 3880,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "ddd0a692.9d8f28",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "Example.ComplexArray",
             "props": [
                 {
                     "p": "payload"
                 },
                 {
                     "p": "top",
                     "v": "Example.ComplexArray",
                     "vt": "str"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "[1,2,[3,4,5],{\"Leaving\":\"288.700000\",\"Returning\":\"24.900000\"}]",
             "payloadType": "jsonata",
             "x": 1720,
             "y": 3840,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         },
         {
             "id": "55be416c.3246",
             "type": "inject",
             "z": "6e170384.60c96c",
             "name": "Example.SimpleArray",
             "props": [
                 {
                     "p": "payload"
                 },
                 {
                     "p": "top",
                     "v": "Example.SimpleArray",
                     "vt": "str"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "[1,5,6.2,2,3]",
             "payloadType": "jsonata",
             "x": 1720,
             "y": 3800,
             "wires": [
                 [
                     "ff5e1c47.969ce"
                 ]
             ]
         }
      ]
      

      befc4a14-483d-43fc-b4a5-23fefaf0fa09-image.png

      Nun zu den einzelnen Inputs in den Inject-Nodes:

      1. Example.SimpleArray

      [1,5,6.2,2,3]
      

      fd24d6d6-0979-4160-a519-8e1c973cf897-image.png
      Ergebnis

      309b4092-119c-4d58-b807-f868f9c7b637-image.png

      2. Example.ComplexArray

      [1,2,[3,4,5],{"Leaving":"288.700000","Returning":"24.900000"}]
      

      020f93df-4c30-4fab-8596-380ca60051cd-image.png
      Ergebnis

      1d21885e-c2e4-4d5c-a56c-1054d97cfad1-image.png

      3. Skalar (Input ist kein Objekt)

      d0f5c66f-ff51-4931-b5d2-2cf6f2b713a0-image.png

      Ergebnis

      3dc945e3-5539-44ef-891f-9fe6ab09f30d-image.png

      4. Objekt:

      {"Präsenz Wohnzimmer Essbereich":true,"Präsenz Bad":true,"Präsenz Schlafzimmer":true,"Thermometer Bad":true,"Präsenz Flur":true,"Würfel Wohnzimmer":{"1":"TV"},"Präsenz Küche":true,"Würfel Schlafzimmer":true,"Thermometer Küche":true,"Präsenz Diele":true,"Präsenz Wohnzimmer":true,"Präsenz Büro":true}
      

      89c6e1d7-b5f0-4dab-b137-b5775b4781ec-image.png
      Ergebnis:

      704546f2-3b16-4b2d-94d4-e4836c03550c-image.png

      5. ObjectArray:

      [
          {
              "start": 45,
              "end": 100,
              "date": "24.3.2021 18:44",
              "diff": 1,
              "quantity": 0,
              "price": "0.00",
              "basicPrice": 0,
              "startDate": "24.3.2021 18:44",
              "duration": 1,
              "perHour": 0
          },
          {
              "start": 51,
              "end": 52,
              "date": "24.3.2021 15:59",
              "diff": 3,
              "quantity": 0,
              "price": "0.00",
              "basicPrice": 0,
              "startDate": "24.3.2021 15:57",
              "duration": 3,
              "perHour": 0
          },
          {
              "start": 59,
              "end": 100,
              "date": "24.2.2021 14:27",
              "diff": 29,
              "quantity": 0,
              "price": "0.00",
              "basicPrice": 0,
              "startDate": "24.2.2021 13:59",
              "duration": 29,
              "perHour": 0
          }
      ]
      

      d2fe3518-677f-4ed1-864d-674c7806a35b-image.png

      Ergebnis:

      586d1ec2-d51c-4b58-97ba-8aa0c2bc370b-image.png

      6. JSON-String

      {"squadName":"Super hero squad","homeTown":"Metro City","formed":2016,"secretBase":"Super tower","active":true,"members":[{"name":"Molecule Man","age":29,"secretIdentity":"Dan Jukes","powers":["Radiation resistance","Turning tiny","Radiation blast"],"dressed":{"head":"Kopfbedeckung"}},{"name":"Madame Uppercut","age":69,"secretIdentity":"Jane Wilson","powers":["Million tonne punch","Damage resistance","Superhuman reflexes"]},{"name":"Eternal Flame","age":1000000,"secretIdentity":"Unknown","powers":["Immortality","Heat Immunity","Inferno","Teleportation","Interdimensional travel"]}]}
      

      4ae85b8b-85bf-4513-b701-6bdf1147808e-image.png
      Ergebnis:

      6e21154f-c8ce-4477-9633-926d2af2ebf1-image.png

      S 1 Reply Last reply Reply Quote 0
      • S
        schonpaule @mickym last edited by

        @mickym Hallo mickym ,

        irgendwie verstehe ich das mit dem msg.top als root nicht ..... Was bedeutet das für mich beim anlegen des DP ? Also Channel\Gerät ..... ?

        das Script wäre nämlich genau das was ich brauchen könnte !

        MfG.

        Jean

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

          @schonpaule

          Es muss als topic für den Objektbaum ein Name in der Eigenschaft msg.top mitgegeben werden, dann wird dieser Datenpunkt als Wurzel unter 0_userdata.0.top mit dem im Objekt oder JSON-String zugehörigen Objekten angelegt.

          Nein mit msg.top legst Du den Namen fest unter dem die Struktur unter 0_userdata.0 angelegt werden soll.

          Also wenn Du msg.top="meineStruktur", dann legt der Flow alles unter dem Punkt 0_userdata.0.meineStruktur an.

          Seit dem Admin5 musst Du dann aber nachträglich die Verzeichnispunkte leider wieder als Objektverzeichnisse nachlegen. Also dann das Script von @fastfoot drüberlaufen lassen. Wenn die Struktur mal steht, ist es kein Problem, da dann alle Punkte natürlich aktualisiert werden.

          Wenn Du Dir eigentlich das nächste Posting anschaust, da ist eigentlich auch alles mit Screenshots dokumentiert.

          1c6a2887-308f-4db9-b882-c28799c67f6a-image.png

          Also im Javascript noch die Erstellung von Objekten erlauben und dann dieses Script über 0_userdata.0 laufen lassen. Node-Red darf leider keine Objekte sondern nur states erstellen. Ich hab schon ein issue aufgemacht - aber ich befürchte, dass wird dauern ob und wann sich da jemand kümmert.

          /**
          * Zweck:       Korrigiert übergeordnete Ordnerstrukturen eines Datenpunkts
          * Datum:      07.08.2021
          * Autor:       @fastfoot
          */
           
          //              In den Settings der Javascript-Instanz muss setObject erlaubt sein!!!
           
          let arr = [],
             id = '';
           
          const ids = $('0_userdata.0.*');
          ids.each(idTmp => {
             arr=idTmp.split('.');
             arr.splice(arr.length-1);
             id=arr.join('.');
             if(arr[0] === '0_userdata' || arr[0] === 'alias' || arr[0] === 'mqtt' || arr[0] === 'javascript'){
                 correctObject(id, arr);
             }
          })
           
          function correctObject(id,arr){
             if(arr.length === 2) return;
             if(!existsObject(id)){
                 let obj = {};
                 obj = {
                     type: 'folder',
                     common:{
                         name: arr[arr.length - 1]
                     }
                 }
                 extendObject(id, obj, e => {
                     if (e) log('Fehler beim Schreiben des Objektes: '+ id + ' ' + e);
                 })
             }
             arr.splice(arr.length - 1);
             id = arr.join('.');
             correctObject(id, arr);
          }
           
          
          
          S 1 Reply Last reply Reply Quote 0
          • S
            schonpaule @mickym last edited by

            @mickym , Hi ..... auch schlaflos 😉 ?
            Und in welchem Node trage ich die msg.top ein ? Sorry bei dem Node Red bin ich ganz neu, und hab noch keinen so richtigen Plan ! Die einfacheren Dinge wie schalten etc. hatte ich gleich verstanden. Aber hier hab ich gerade einen Knoten im Hirn 🙂 Aber schonmal vielen Dank für die schnelle Antwort zu dieser späten Stunde !

            Ich probier mich mal durch !

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

              @schonpaule Ja ich bin inzwischen zur Nachteule mutiert.

              Wenn Dein JSON oder was weiß ich in der msg.payload ist - hängst einfach noch eine Change Node davor in dem msg.top festlegst.

              e4476603-e41a-4cce-bd08-3396c6a0637e-image.png

              3ec9f58f-5d01-469f-b646-179c0c77da8d-image.png

              6128976e-82d3-4725-92eb-6a08bfdf07f9-image.png

              Und wenn Du das in iobroker out Node jagst - werden diese Datenpunkte angelegt.

              7b7ffeef-3b26-4803-8b06-98d7c4f6ed90-image.png

              Die iobroker out Node erstellt die Stuktur sofern Du die Erstellung von Fremdobjekten im Adapter zulässt.

              Das ist dann das Ergebnis:

              72c2c5ec-156f-443a-9990-23f38b3ad89c-image.png

              Das Problem ist nur, dass das Verzeichnis mickym kein Objekt ist, deswegen musst Du das mit dem Javascript noch anlegen.

              S 1 Reply Last reply Reply Quote 0
              • S
                schonpaule @mickym last edited by

                @mickym ...... ja mit dem schlafen habe ich es auch nicht mehr so .......

                Ich probiere es gleich mal, mein Input ist von knx Ultimate die Gruppenadressen, NodeRed legt zwar welche an aber leider nur die reinen Nummern......

                Danke vielmals das du so Hilfsbereit bist 🙂 !

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

                  @schonpaule Kein Problem, solange das Gehirn noch funktioniert. 😉 - Wie sieht denn Deine Payload aus? Das Skript kann natürlich nicht mehr, als mit was Du es fütterst. Aber vielleicht bekommen wir ja zusammen hin, was Du willst. 😉

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    schonpaule @mickym last edited by

                    @mickym , also der Payload sind KNX Gruppenadressen die am Ende nur den Status true oder false beinhalten sollen. Ich will diese dann in VIS weiterverarbeiten und durch das schreiben auf den Bus auch an allen Visualisierungen aktuell halten. Nicht erschrecken das ist ein ziemlich großes Projekt was die Menge der DP´s angeht 😉

                    84047c10-5b06-4d99-a7f7-5466b9a9b9f0-image.png

                    9602b058-2312-4f42-adee-4f937edd8ea2-image.png

                    So sieht es ungefähr optisch aus als Text bekomme ich es gar nicht in einen Text wegen der 100000 Beschränkung 🙂

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

                      @schonpaule In der Change Node - setzt Du die msg.payload und nicht die msg.top. Und wie gesagt die Change Node hinter die KNX Node bzw. vor die Subflow-Node klemmen und nicht davor.

                      edf70468-c22d-4fae-becb-4dd7c3a2964d-image.png

                      1 Reply Last reply Reply Quote 0
                      • W
                        Waldmensch last edited by

                        @mickym Ich habe gerade mal Deinen Subflow getestet. Der läuft soweit 1A. Ich schreibe damit das Objekt, was mein PV Speicher liefert. Was seltsam ist, ist, das mein Log mit warnings geflutet wird. Das scheint daran zu liegen, das die Datenpunkte readonly angelegt werden

                        
                        node-red.0
                        2021-11-28 08:41:42.027	warn	Read-only state "0_userdata.0.Solarwatt.SData.ACS.U_L2" has been written without ack-flag with value "225"
                        
                        

                        Man kann das umgehen, indem man in der Ouot-Node unten bei "Readonly" einstellt "Object is writable".

                        iobroker.png

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

                          @waldmensch Ja das war mir bekannt - das sind alles Dinge seit dem admin5 - Du musst auch nachdem der Flow gelaufen ist, einmal das Skript von fastfoot drüber laufen lassen, damit die Objekte angelegt werden.

                          Da das ganze ja in userdata geschrieben wird - kann man man anstelle es auf writeable zu setzen das ACK -Flag setzen, also anstelle von command - ein value setzen. Das sollte ebenfalls gehen:

                          100f74bd-11d3-4a98-ab60-4a8d949e10fb-image.png

                          Es ist generelle so, dass man mit den Einstellungen in der iobroker-out Node - die Prüfung dieser Nodes ausschaltet . Der Subflow hat damit eigentlich gar nichts zu tun, der spaltet die Objekte ja nur in Einzelnachrichten auf und setzt die topics. 😉

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

                            @waldmensch Generell muss man seit dem Admin5 - einmal auch immer noch das Skript von @fastfoot drüberlaufen lassen - das automatische Erstellen von Objekten im Admin5 lässt wohl auf sich warten.

                            Also dieses Skript importieren - und einmal ausführen:

                            /**
                            * Zweck:       Korrigiert übergeordnete Ordnerstrukturen eines Datenpunkts
                            * Datum:      07.08.2021
                            * Autor:       @fastfoot
                            */
                            
                            //              In den Settings der Javascript-Instanz muss setObject erlaubt sein!!!
                            
                            let arr = [],
                              id = '';
                            
                            const ids = $('0_userdata.0.*');
                            ids.each(idTmp => {
                              arr=idTmp.split('.');
                              arr.splice(arr.length-1);
                              id=arr.join('.');
                              if(arr[0] === '0_userdata' || arr[0] === 'alias' || arr[0] === 'mqtt' || arr[0] === 'javascript'){
                                  correctObject(id, arr);
                              }
                            })
                            
                            function correctObject(id,arr){
                              if(arr.length === 2) return;
                              if(!existsObject(id)){
                                  let obj = {};
                                  obj = {
                                      type: 'folder',
                                      common:{
                                          name: arr[arr.length - 1]
                                      }
                                  }
                                  extendObject(id, obj, e => {
                                      if (e) log('Fehler beim Schreiben des Objektes: '+ id + ' ' + e);
                                  })
                              }
                              arr.splice(arr.length - 1);
                              id = arr.join('.');
                              correctObject(id, arr);
                            }
                            

                            Muss man nur einmal machen - wenn die Objekte angelegt sind - kann der Flow ungehindert weiter in die einzelnen Datenpunkte schreiben.

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

                              @mickym So ich habe die Node nochmals leicht überarbeitet. Die Bedeutung ist leider mit dem Admin 5 etwas verloren gegangen und man hat auch in den letzten 4 Monaten anscheinend immer noch keine Zeit gehabt den Admin oder NodeRed so anzupassen, dass ggf. Objekte selbst erstellt werden. Dennoch ist der Flow vielleicht noch hilfreich.

                              Die Node setzt nun nicht mehr zwingend das Füttern der Node mit msg.top voraus, um den Ausgangsdatenpunkt (objRoot) für den zu erstellenden Objektbaum festzulegen, sondern die Node kann nun auch mit Umgebungsvaribalen arbeiten. Endlich mal ein sinnvoller Einsatz für Umgebungsvariablen in Subflows. 😉

                              43d96699-8c8e-4c99-a76e-c7131fd930a4-image.png

                              Das heißt man kann nun direkt in der Node den Startpunkt eingeben. msg.top funktioniert aber weiterhin.

                              [
                                 {
                                     "id": "c3403a60.92fbb8",
                                     "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-value of the node (environment variable top) is used. \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# 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 (Umgebungsvariable top) der Node verwendet. <br>\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. ",
                                     "category": "parser",
                                     "in": [
                                         {
                                             "x": 60,
                                             "y": 160,
                                             "wires": [
                                                 {
                                                     "id": "94876630.f71748"
                                                 }
                                             ]
                                         }
                                     ],
                                     "out": [
                                         {
                                             "x": 2120,
                                             "y": 280,
                                             "wires": [
                                                 {
                                                     "id": "74b0b536.02371c",
                                                     "port": 0
                                                 },
                                                 {
                                                     "id": "ad539a91.237888",
                                                     "port": 0
                                                 }
                                             ]
                                         }
                                     ],
                                     "env": [
                                         {
                                             "name": "top",
                                             "type": "str",
                                             "value": "objRoot"
                                         }
                                     ],
                                     "meta": {},
                                     "color": "#E2D96E",
                                     "icon": "node-red/batch.svg"
                                 },
                                 {
                                     "id": "eea737e7.7e8fb8",
                                     "type": "split",
                                     "z": "c3403a60.92fbb8",
                                     "name": "split object",
                                     "splt": "\\n",
                                     "spltType": "str",
                                     "arraySplt": 1,
                                     "arraySpltType": "len",
                                     "stream": false,
                                     "addname": "key",
                                     "x": 1170,
                                     "y": 160,
                                     "wires": [
                                         [
                                             "dc473616.c2b508"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "dc473616.c2b508",
                                     "type": "change",
                                     "z": "c3403a60.92fbb8",
                                     "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"
                                         },
                                         {
                                             "t": "change",
                                             "p": "topic",
                                             "pt": "msg",
                                             "from": " ",
                                             "fromt": "str",
                                             "to": "_",
                                             "tot": "str"
                                         }
                                     ],
                                     "action": "",
                                     "property": "",
                                     "from": "",
                                     "to": "",
                                     "reg": false,
                                     "x": 1360,
                                     "y": 160,
                                     "wires": [
                                         [
                                             "78697695.9a72c8"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "78697695.9a72c8",
                                     "type": "switch",
                                     "z": "c3403a60.92fbb8",
                                     "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": 1540,
                                     "y": 160,
                                     "wires": [
                                         [
                                             "d839cef8.577f1"
                                         ],
                                         [
                                             "eea737e7.7e8fb8"
                                         ],
                                         [
                                             "bdfdae99.f4d9d"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "d839cef8.577f1",
                                     "type": "split",
                                     "z": "c3403a60.92fbb8",
                                     "name": "split array",
                                     "splt": "\\n",
                                     "spltType": "str",
                                     "arraySplt": 1,
                                     "arraySpltType": "len",
                                     "stream": false,
                                     "addname": "",
                                     "x": 580,
                                     "y": 280,
                                     "wires": [
                                         [
                                             "36327f2d.8efc3"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "36327f2d.8efc3",
                                     "type": "change",
                                     "z": "c3403a60.92fbb8",
                                     "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": 770,
                                     "y": 280,
                                     "wires": [
                                         [
                                             "d8f58d9b.b6a1"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "74b0b536.02371c",
                                     "type": "change",
                                     "z": "c3403a60.92fbb8",
                                     "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"
                                         },
                                         {
                                             "t": "change",
                                             "p": "topic",
                                             "pt": "msg",
                                             "from": "..",
                                             "fromt": "str",
                                             "to": ".",
                                             "tot": "str"
                                         }
                                     ],
                                     "action": "",
                                     "property": "",
                                     "from": "",
                                     "to": "",
                                     "reg": false,
                                     "x": 1970,
                                     "y": 240,
                                     "wires": [
                                         []
                                     ]
                                 },
                                 {
                                     "id": "4cdee7cb.910c38",
                                     "type": "switch",
                                     "z": "c3403a60.92fbb8",
                                     "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": 400,
                                     "y": 160,
                                     "wires": [
                                         [
                                             "c1c41535.17d3b8"
                                         ],
                                         [
                                             "eea737e7.7e8fb8"
                                         ],
                                         [
                                             "d839cef8.577f1"
                                         ],
                                         [
                                             "d8f58d9b.b6a1"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "c1c41535.17d3b8",
                                     "type": "json",
                                     "z": "c3403a60.92fbb8",
                                     "name": "",
                                     "property": "payload",
                                     "action": "",
                                     "pretty": false,
                                     "x": 570,
                                     "y": 120,
                                     "wires": [
                                         [
                                             "3ccd67db.375058"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "bdfdae99.f4d9d",
                                     "type": "switch",
                                     "z": "c3403a60.92fbb8",
                                     "name": "is msg.top != null",
                                     "property": "top",
                                     "propertyType": "msg",
                                     "rules": [
                                         {
                                             "t": "nnull"
                                         },
                                         {
                                             "t": "null"
                                         }
                                     ],
                                     "checkall": "true",
                                     "repair": false,
                                     "outputs": 2,
                                     "x": 1750,
                                     "y": 280,
                                     "wires": [
                                         [
                                             "74b0b536.02371c"
                                         ],
                                         [
                                             "ad539a91.237888"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "94876630.f71748",
                                     "type": "change",
                                     "z": "c3403a60.92fbb8",
                                     "name": "",
                                     "rules": [
                                         {
                                             "t": "delete",
                                             "p": "topic",
                                             "pt": "msg"
                                         }
                                     ],
                                     "action": "",
                                     "property": "",
                                     "from": "",
                                     "to": "",
                                     "reg": false,
                                     "x": 210,
                                     "y": 160,
                                     "wires": [
                                         [
                                             "4cdee7cb.910c38"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "3ccd67db.375058",
                                     "type": "switch",
                                     "z": "c3403a60.92fbb8",
                                     "name": "is array?",
                                     "property": "payload",
                                     "propertyType": "msg",
                                     "rules": [
                                         {
                                             "t": "istype",
                                             "v": "array",
                                             "vt": "array"
                                         },
                                         {
                                             "t": "else"
                                         }
                                     ],
                                     "checkall": "true",
                                     "repair": false,
                                     "outputs": 2,
                                     "x": 700,
                                     "y": 120,
                                     "wires": [
                                         [
                                             "d839cef8.577f1"
                                         ],
                                         [
                                             "eea737e7.7e8fb8"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "80dde279.c28ec",
                                     "type": "comment",
                                     "z": "c3403a60.92fbb8",
                                     "name": "Array",
                                     "info": "",
                                     "x": 400,
                                     "y": 280,
                                     "wires": []
                                 },
                                 {
                                     "id": "95ee816e.68a16",
                                     "type": "comment",
                                     "z": "c3403a60.92fbb8",
                                     "name": "object",
                                     "info": "",
                                     "x": 1140,
                                     "y": 100,
                                     "wires": []
                                 },
                                 {
                                     "id": "d8f58d9b.b6a1",
                                     "type": "switch",
                                     "z": "c3403a60.92fbb8",
                                     "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": 960,
                                     "y": 280,
                                     "wires": [
                                         [
                                             "eea737e7.7e8fb8"
                                         ],
                                         [
                                             "d839cef8.577f1"
                                         ],
                                         [
                                             "bdfdae99.f4d9d"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "ad539a91.237888",
                                     "type": "change",
                                     "z": "c3403a60.92fbb8",
                                     "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"
                                         },
                                         {
                                             "t": "change",
                                             "p": "topic",
                                             "pt": "msg",
                                             "from": "..",
                                             "fromt": "str",
                                             "to": ".",
                                             "tot": "str"
                                         }
                                     ],
                                     "action": "",
                                     "property": "",
                                     "from": "",
                                     "to": "",
                                     "reg": false,
                                     "x": 1970,
                                     "y": 320,
                                     "wires": [
                                         []
                                     ]
                                 },
                                 {
                                     "id": "eaa55be.3b517a8",
                                     "type": "subflow:c3403a60.92fbb8",
                                     "z": "73f6b143.7ca56",
                                     "name": "",
                                     "env": [],
                                     "x": 270,
                                     "y": 520,
                                     "wires": [
                                         []
                                     ]
                                 }
                              ]
                              

                              Wal 1 Reply Last reply Reply Quote 0
                              • Wal
                                Wal Developer @mickym last edited by

                                @mickym ,
                                danke das funktioniert mit dem LibreHardwareMonitor sehr gut.
                                Objekte werden jetzt selbst erstellt.

                                B 1 Reply Last reply Reply Quote 0
                                • B
                                  Bernd1967 @Wal last edited by Bernd1967

                                  @mickym
                                  Danke für dein Subflow, kann ich auch gerade sehr gut gebrauchen.

                                  Ich hab allerdings Schwierigkeiten die Daten in einen Json String zurück zu konvertieren.
                                  Hab es oben wie Du mit der Tasmota Steckdose es gemacht hast nachgebaut, nur mit einem anderen Pfad.
                                  Aber das klappt nicht, ich nehme an das es am Change Node liegt und dort bei den Regulären Ausdruck ?
                                  Ich möchte ganz einfach das was im IOBroker Pfad untet "0_userdata.0.objRoot" vorhanden ist als Datei speichern.

                                  Unbenannt.jpg

                                  1.jpg

                                  Struktur im IOBroker:
                                  2.jpg

                                  Ergebnis:
                                  {"version":3,"devices.554-6546532-36565-654654.Test":""}

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

                                    @bernd1967 Mal unabhängig davon, dass man so eine Struktur im iobroker auch einfach exportieren kann, aber was stimmt denn mit dem Ergebnis nicht? - Das schaut doch richtig aus?

                                    Das was Du vielleicht als Problem ansiehst - ist ggf. gar keines. Falls Du erwartet hast, dass Du unter devices eine hierarchische Struktur bekommst - kann nicht funktionieren, da das kein Objekt ist. Das Problem ist eher die list Node - die gibt auch wenn Du ANY als Filter hast nur die states aus. Da müsste man halt wieder ein Issue aufmachen.

                                    Für das Wiederherstellen der Struktur spielt das aber keine Rolle - diese wird, wenn Du meinen Subflow nimmst wieder 1:1 richtig hergestellt:

                                    45868363-176a-4f42-bc07-55e405f9f246-image.png

                                    Du siehst ja, dass Du aus der List node nur 2 Objekte rausbekommst:

                                    c8664fab-7997-4c08-8de8-b2a77251a259-image.png

                                    Auch wenn ich das im iobroker direkt exportiere bekommst Du nur 2 Objekte zurück:

                                    {
                                     "0_userdata.0.objRoot.devices.554-6546532-36565-654654.Test": {
                                       "common": {
                                         "read": true,
                                         "write": true,
                                         "desc": "Created by Node-Red",
                                         "role": "state",
                                         "name": "devices.554-6546532-36565-654654.Test",
                                         "type": "string"
                                       },
                                       "native": {},
                                       "type": "state",
                                       "from": "system.adapter.node-red.0",
                                       "user": "system.user.admin",
                                       "ts": 1646489307670,
                                       "_id": "0_userdata.0.objRoot.devices.554-6546532-36565-654654.Test",
                                       "acl": {
                                         "object": 1636,
                                         "state": 1636,
                                         "owner": "system.user.admin",
                                         "ownerGroup": "system.group.administrator"
                                       }
                                     },
                                     "0_userdata.0.objRoot.version": {
                                       "common": {
                                         "read": true,
                                         "write": true,
                                         "desc": "Created by Node-Red",
                                         "role": "state",
                                         "name": "version",
                                         "type": "number"
                                       },
                                       "native": {},
                                       "type": "state",
                                       "from": "system.adapter.node-red.0",
                                       "user": "system.user.admin",
                                       "ts": 1646489307667,
                                       "_id": "0_userdata.0.objRoot.version",
                                       "acl": {
                                         "object": 1636,
                                         "state": 1636,
                                         "owner": "system.user.admin",
                                         "ownerGroup": "system.group.administrator"
                                       }
                                     }
                                    }
                                    

                                    Falls Du eine Objekthierarchie in Deinem JSON wiederherstellen möchtest, dann ist da nicht banal und muss man quasi selbst programmieren.

                                    Mit einer Flow Variablen und einer function Node ist das dann sicher am Einfachsten. Hier mal eine Möglichkeit:

                                    0820c6f6-f5cc-435b-acbb-de46b5d1509a-image.png

                                    [
                                       {
                                           "id": "fe734f5c8eab6919",
                                           "type": "ioBroker list",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "topic": "0_userdata.0.objRoot.*",
                                           "objType": "",
                                           "regex": "",
                                           "asArray": "false",
                                           "onlyIDs": "true",
                                           "withValues": "true",
                                           "x": 340,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "6a6e0bcf573c21d2"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "81d74c3a4c8d8c69",
                                           "type": "inject",
                                           "z": "54b226bc.0793e8",
                                           "name": "Trigger",
                                           "props": [
                                               {
                                                   "p": "payload"
                                               }
                                           ],
                                           "repeat": "",
                                           "crontab": "",
                                           "once": false,
                                           "onceDelay": 0.1,
                                           "topic": "",
                                           "payload": "true",
                                           "payloadType": "bool",
                                           "x": 150,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "fe734f5c8eab6919"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "6a6e0bcf573c21d2",
                                           "type": "change",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "rules": [
                                               {
                                                   "t": "set",
                                                   "p": "payload",
                                                   "pt": "msg",
                                                   "to": "payload.val",
                                                   "tot": "msg"
                                               },
                                               {
                                                   "t": "change",
                                                   "p": "topic",
                                                   "pt": "msg",
                                                   "from": ".*objRoot\\.(.*)$",
                                                   "fromt": "re",
                                                   "to": "$1",
                                                   "tot": "str"
                                               }
                                           ],
                                           "action": "",
                                           "property": "",
                                           "from": "",
                                           "to": "",
                                           "reg": false,
                                           "x": 570,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "c54cee7f0f242594"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "c54cee7f0f242594",
                                           "type": "function",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "func": "flow.set (\"objRoot.\" + msg.topic, msg.payload);\nreturn msg;",
                                           "outputs": 1,
                                           "noerr": 0,
                                           "initialize": "",
                                           "finalize": "",
                                           "libs": [],
                                           "x": 760,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "1d53b3a03cb1e658"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "1d53b3a03cb1e658",
                                           "type": "change",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "rules": [
                                               {
                                                   "t": "set",
                                                   "p": "payload",
                                                   "pt": "msg",
                                                   "to": "objRoot",
                                                   "tot": "flow"
                                               }
                                           ],
                                           "action": "",
                                           "property": "",
                                           "from": "",
                                           "to": "",
                                           "reg": false,
                                           "x": 950,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "22c29b67c34b4b4f"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "eef15bb0d92eb826",
                                           "type": "debug",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "active": true,
                                           "tosidebar": true,
                                           "console": false,
                                           "tostatus": false,
                                           "complete": "false",
                                           "statusVal": "",
                                           "statusType": "auto",
                                           "x": 1490,
                                           "y": 2620,
                                           "wires": []
                                       },
                                       {
                                           "id": "22c29b67c34b4b4f",
                                           "type": "trigger",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "op1": "",
                                           "op2": "",
                                           "op1type": "nul",
                                           "op2type": "payl",
                                           "duration": "250",
                                           "extend": true,
                                           "overrideDelay": false,
                                           "units": "ms",
                                           "reset": "",
                                           "bytopic": "all",
                                           "topic": "topic",
                                           "outputs": 1,
                                           "x": 1160,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "90872318bacb6745"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "90872318bacb6745",
                                           "type": "json",
                                           "z": "54b226bc.0793e8",
                                           "name": "",
                                           "property": "payload",
                                           "action": "",
                                           "pretty": false,
                                           "x": 1330,
                                           "y": 2620,
                                           "wires": [
                                               [
                                                   "eef15bb0d92eb826"
                                               ]
                                           ]
                                       }
                                    ]
                                    

                                    damit bekommst dann dieses Ergebnis:

                                    {"version":3,"devices":{"554-6546532-36565-654654":{"Test":""}}}
                                    
                                    B 1 Reply Last reply Reply Quote 0
                                    • B
                                      Bernd1967 @mickym last edited by Bernd1967

                                      @mickym sagte in JSON String oder Java Object in IOBroker Struktur:

                                      hierarchische Struktur

                                      Ja genau 🙂 , das hat mich irritiert, die hierarchische Struktur......
                                      Mit deinem Beispiel klappte es
                                      Danke

                                      Nachtrag: bei komplexen Strukturen entstehen allerding viele Fehler 😞
                                      Ist doch wohl nicht so einfach.

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

                                        @bernd1967 Ja - entweder muss man das halt wirklich auflösen oder Du schickst mal ein Beispiel wo es Probleme gibt, dass man es nachvollziehen kann.

                                        Das Problem ist, dass nach der Aufsplittung halt bestimmte Originalinformationen für immer verloren sind, es werden ja Arrays und Objekte in gleicher Weise behandelt.

                                        Die Frage ist halt wirklich braucht man diese Hierarchie oder kann man nicht mit dem Original leben - wie Du es am Anfang gemacht hast. Ich habe allerdings eine recht komplexe Struktur durchlaufen lassen und das ging fehlerfrei.

                                        Also müsste man das wohl anhand Deines Beispiels, das nicht läuft nachvollziehen.
                                        Ich hab den Flow nochmal angepasst - sodass die function Node zum Aufbau der Objektstruktur ausreicht und diese nach jeder Ausgabe gelöscht wird - damit es da kein Durcheinander gibt.

                                        652774ca-03c7-4f1c-9d00-6eddad862acd-image.png

                                        [
                                           {
                                               "id": "d11089310692b73f",
                                               "type": "change",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "payload",
                                                       "pt": "msg",
                                                       "to": "payload.val",
                                                       "tot": "msg"
                                                   },
                                                   {
                                                       "t": "change",
                                                       "p": "topic",
                                                       "pt": "msg",
                                                       "from": ".*objRoot\\.(.*)$",
                                                       "fromt": "re",
                                                       "to": "$1",
                                                       "tot": "str"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 570,
                                               "y": 1980,
                                               "wires": [
                                                   [
                                                       "e4a1e5e5e9dc34ee"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "e4a1e5e5e9dc34ee",
                                               "type": "function",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "func": "if (msg.reset) {\n    context.set(\"objRoot\",undefined);\n    return null;\n}\ncontext.set (\"objRoot.\" + msg.topic, msg.payload);\nmsg.payload=context.get(\"objRoot\");\nreturn msg;",
                                               "outputs": 1,
                                               "noerr": 0,
                                               "initialize": "",
                                               "finalize": "",
                                               "libs": [],
                                               "x": 760,
                                               "y": 1980,
                                               "wires": [
                                                   [
                                                       "5200812ceca93736"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "a9d3e44f37652c2e",
                                               "type": "debug",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "active": false,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "false",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1270,
                                               "y": 2040,
                                               "wires": []
                                           },
                                           {
                                               "id": "5200812ceca93736",
                                               "type": "trigger",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "op1": "",
                                               "op2": "",
                                               "op1type": "nul",
                                               "op2type": "payl",
                                               "duration": "250",
                                               "extend": true,
                                               "overrideDelay": false,
                                               "units": "ms",
                                               "reset": "",
                                               "bytopic": "all",
                                               "topic": "topic",
                                               "outputs": 1,
                                               "x": 940,
                                               "y": 1980,
                                               "wires": [
                                                   [
                                                       "82c103eb2cf2057f",
                                                       "4aa8543b3675c7d1",
                                                       "0f757a3fa3b26e8f"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "82c103eb2cf2057f",
                                               "type": "json",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "property": "payload",
                                               "action": "str",
                                               "pretty": false,
                                               "x": 1130,
                                               "y": 1980,
                                               "wires": [
                                                   [
                                                       "a9d3e44f37652c2e",
                                                       "45d69ff41aed483a"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "0d87b95094bc6985",
                                               "type": "ioBroker list",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "topic": "0_userdata.0.objRoot.*",
                                               "objType": "",
                                               "regex": "",
                                               "asArray": "false",
                                               "onlyIDs": "true",
                                               "withValues": "true",
                                               "x": 340,
                                               "y": 1980,
                                               "wires": [
                                                   [
                                                       "d11089310692b73f"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "272ea867090d9156",
                                               "type": "inject",
                                               "z": "54b226bc.0793e8",
                                               "name": "Trigger",
                                               "props": [
                                                   {
                                                       "p": "payload"
                                                   }
                                               ],
                                               "repeat": "",
                                               "crontab": "",
                                               "once": false,
                                               "onceDelay": 0.1,
                                               "topic": "",
                                               "payload": "true",
                                               "payloadType": "bool",
                                               "x": 150,
                                               "y": 1980,
                                               "wires": [
                                                   [
                                                       "0d87b95094bc6985"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "4aa8543b3675c7d1",
                                               "type": "debug",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "active": true,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "false",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1170,
                                               "y": 1920,
                                               "wires": []
                                           },
                                           {
                                               "id": "45d69ff41aed483a",
                                               "type": "file",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "filename": "/home/iobroker/output.json",
                                               "appendNewline": true,
                                               "createDir": false,
                                               "overwriteFile": "true",
                                               "encoding": "none",
                                               "x": 1340,
                                               "y": 1980,
                                               "wires": [
                                                   []
                                               ]
                                           },
                                           {
                                               "id": "0f757a3fa3b26e8f",
                                               "type": "change",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "reset",
                                                       "pt": "msg",
                                                       "to": "true",
                                                       "tot": "bool"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 780,
                                               "y": 2060,
                                               "wires": [
                                                   [
                                                       "e4a1e5e5e9dc34ee"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "4420acc0840bbd1a",
                                               "type": "inject",
                                               "z": "54b226bc.0793e8",
                                               "name": "",
                                               "props": [
                                                   {
                                                       "p": "payload"
                                                   },
                                                   {
                                                       "p": "topic",
                                                       "vt": "str"
                                                   }
                                               ],
                                               "repeat": "",
                                               "crontab": "",
                                               "once": false,
                                               "onceDelay": 0.1,
                                               "topic": "reset",
                                               "payload": "true",
                                               "payloadType": "bool",
                                               "x": 560,
                                               "y": 2060,
                                               "wires": [
                                                   [
                                                       "0f757a3fa3b26e8f"
                                                   ]
                                               ]
                                           }
                                        ]
                                        

                                        B 1 Reply Last reply Reply Quote 0
                                        • B
                                          Bernd1967 @mickym last edited by

                                          @mickym
                                          Danke für deine Mühe, ich werde das später nochmal ausprobieren.

                                          Der Fehler der immer wieder auftaucht ist übrigens folgender:
                                          [error] [function:e4a1e5e5e9dc34ee] Error: Invalid property expression: unexpected { at position 67

                                          Ein Beispiel kann ich Dir jetzt nicht geben weil dort sensible Daten vorhanden sind.
                                          Die müßte ich erstmal rausfiltern und das ist aufwendig.
                                          Ich kopiere im Moment alles manuelle mit einem JSON Editor.

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

                                            @bernd1967 Warum speicherst Du den JSON String vor der Aufteilung eigentlich nicht gleich in eine Datei?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.0k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            node-red
                                            13
                                            114
                                            18487
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo