Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. iobroker, MQTT und Shelly - Was geht wie?

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    iobroker, MQTT und Shelly - Was geht wie?

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

      @mickym boah super DANKE, ich schaue mir das später richtig an und versuche das so umzusetzen.

      Hat geklappt , nochmals DANKE !

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

        @mickym noch eine Frage, der Wert wird normal angezeigt, im log steht aber :

        Invalid read function for "alias.0.WP_Leistung": "JSON.parse(val).params['em:0'].total_act_power" => Cannot read properties of undefined (reading 'total_act_power')
        

        Muss ich da noch etwas definieren ?

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

          @hal Nein - ausser es kommt zu diesem Zeitpunkt ein Wert rein, der nicht das ganze Objekt enthält. Ich weiß aber auch nicht, wie man das unterdrückt.

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

            @hal wenn es zu sehr nervt, dann nimm deine Logikmaschine und schreib Dir selbst einen Datenpunkt unter 0_userdata.0

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

              @mickym Alles klar, Danke

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

                @mickym
                Hallo mickym, leider wird mein log jetzt massive von den Alias Fehlern vollgeschrieben und ich muß einen anderen Weg finden. Mit Blockly habe ich es versucht, bin aber auch nicht erfolgreich gewesen:
                Boklyjpg.jpg

                Du hast von einem NoteRed Flow geschrieben, der die einzelnen DP erzeugt. Kannst Du mir den zur Verfügung stellen ?

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

                  @hal sagte in iobroker, MQTT und Shelly - Was geht wie?:

                  Du hast von einem NoteRed Flow geschrieben, der die einzelnen DP erzeugt. Kannst Du mir den zur Verfügung stellen ?

                  Klar - Du musst den nur importieren:

                  https://forum.iobroker.net/topic/43856/json-oder-javascript-objekt-in-iobroker-datenpunkte-zerlegen

                  Ich habs gerade auch nochmal getestet, funktioniert ohne Fehler:

                  Kannst auch direkt importieren:

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

                  386ad48e-13b7-43ea-88d1-570edb18e46e-image.png

                  Du musst nur im Node-Red Adapter das Erstellen von Fremdobjekten zulassen:

                  Diese Node erzeugt Dir dann folgenden Ast aus einzelnen Datenpunkten:

                  18cbfd51-2c60-4c75-b70a-5f51bf8f616f-image.png

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

                    @hal Ich habs aber gerade auch nochmal im Blockly für Dich probiert und so funktioniert es meines Erachtens:
                    Du musst Dich halt den Pfad lang schlängeln:

                    c2e3b2ad-7a28-460d-994b-6b0a45c09998-image.png

                    Hier der Import:

                    <block xmlns="https://developers.google.com/blockly/xml" type="on_ext" id="E*czRNU^;|WT7M_=cYae" x="-1737" y="463">
                     <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                     <field name="CONDITION">any</field>
                     <field name="ACK_CONDITION"></field>
                     <value name="OID0">
                       <shadow type="field_oid" id="X0ITe}G?iHN{Mlk}rS51">
                         <field name="oid">0_userdata.0.Test.JSON</field>
                       </shadow>
                     </value>
                     <statement name="STATEMENT">
                       <block type="debug" id="r#l.6_r`,`t3OLRi1P,@">
                         <field name="Severity">info</field>
                         <value name="TEXT">
                           <shadow type="text" id="YwBItJ!/xQm)vr;=rqmL">
                             <field name="TEXT">test</field>
                           </shadow>
                           <block type="on_source" id="EzQCd/P7Fcp%CGF%RAt[">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                         <next>
                           <block type="debug" id=".}fMRI6e#r17$M-q-{Rh">
                             <field name="Severity">info</field>
                             <value name="TEXT">
                               <shadow type="text" id="Yf0zcAkAxF8-SyEKK^cK">
                                 <field name="TEXT">test</field>
                               </shadow>
                               <block type="get_attr" id="b-D}:xxh56c@uB{]#:CD">
                                 <value name="PATH">
                                   <shadow type="text" id="weFzz)3j7+x!nyA.-rUT">
                                     <field name="TEXT">params.em:0.total_act_power</field>
                                   </shadow>
                                 </value>
                                 <value name="OBJECT">
                                   <shadow type="get_object" id="+ppRPt.ZepjN7en4JsF}">
                                     <field name="OID">0_userdata.0.Test.JSON</field>
                                   </shadow>
                                   <block type="on_source" id="r^`9Q86YJ}0+,!SlQ)x{">
                                     <field name="ATTR">state.val</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </next>
                       </block>
                     </statement>
                    </block>
                    

                    Aber wie gesagt, wenn Du meinen NodeRed Flow nehmen und wenn Du den ganzen Shelly triggerst und keepTopic gleich true verwendest, wird Dir auch der ganze Baum zerlegt.

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

                      9@mickym Jetzt habe ich die Qual der Wahl 😉
                      Sowohl RedNote als auch Blockly funktionert .
                      DANKE .

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

                        @hal Wenn Du mit dem Flow den ganzen Baum exportierst, dann sieht das so aus:

                        37b33dbf-e935-408e-a969-058b44ddacc8-image.png

                        Da kannst Du den 1. Teil dann wieder mit einer Text Node kürzen, dass dan mqtt.1.shellies zum Beispiel nicht mitkommt.

                        Also das gleiche Beispiel nur der Anfang des Topics weggekürzt:
                        31cef0fc-8889-403c-ba18-fca6e0ae862a-image.png

                        In diesem Fall, lässt Du bei keepTopic einfach den Teil des topic durch einen Leerstring ersetzen:
                        cee19a26-9c08-4f5b-b7a3-f7d912107a4e-image.png

                        Wichtig ist halt dass Du über Wildcard Deinen ganzen Ast bzw. alle Datenpunkte Deines Shellies triggern lässt.

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


                        Aber wenn beides funktioniert, dann hast Du ja nun wieder alle Möglichkeiten.

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

                          @hal Falls Du übrigens auch in Node-Red nur EINEN Wert und nicht das ganze JSON Objekt extrahieren willst, geht das genauso einfach wie in Blockly. Du musst das ganze mit einer JSON NOde nur in ein Objekt verwandeln:

                          40a200be-c141-4f67-a4e0-d80f3431e37f-image.png

                          Hier auch zum Ausprobieren:

                          [
                             {
                                 "id": "98506a0e2e306264",
                                 "type": "debug",
                                 "z": "5c4848b5cbcb4807",
                                 "name": "Ausgabe",
                                 "active": true,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "payload",
                                 "targetType": "msg",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 660,
                                 "y": 1260,
                                 "wires": []
                             },
                             {
                                 "id": "04e1a9ed0c65c110",
                                 "type": "ioBroker in",
                                 "z": "5c4848b5cbcb4807",
                                 "name": "JSON",
                                 "attrname": "payload",
                                 "topic": "0_userdata.0.Test.JSON",
                                 "payloadType": "value",
                                 "onlyack": "",
                                 "func": "all",
                                 "gap": "",
                                 "fireOnStart": "false",
                                 "outFormat": "MQTT",
                                 "x": 110,
                                 "y": 1260,
                                 "wires": [
                                     [
                                         "5c729f438b311692"
                                     ]
                                 ]
                             },
                             {
                                 "id": "5c729f438b311692",
                                 "type": "json",
                                 "z": "5c4848b5cbcb4807",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 270,
                                 "y": 1260,
                                 "wires": [
                                     [
                                         "c3d5bc332b9c2797"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c3d5bc332b9c2797",
                                 "type": "change",
                                 "z": "5c4848b5cbcb4807",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "payload.params.em:0.total_act_power",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 450,
                                 "y": 1260,
                                 "wires": [
                                     [
                                         "98506a0e2e306264"
                                     ]
                                 ]
                             }
                          ]
                          

                          HAL 1 Reply Last reply Reply Quote 1
                          • HAL
                            HAL @mickym last edited by

                            @mickym Du bist genial !

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

                              @hal sagte in iobroker, MQTT und Shelly - Was geht wie?:

                              @mickym Du bist genial !

                              Danke für die Blumen! - Ich würde an Deiner Stelle halt vielleicht ein Issue erstellen, wegen dem Alias und diesen Fehlermeldungen.

                              Übrigens wenn Dein Objekt getriggert hat, kannst Du natürlich sowohl im NodeRed als auch im Blockly auch Deine Werte, die für Dich von Interessen sind auf einmal extrahieren (wenn Du nicht mit dem Flow alle Werte brauchst). In NodeRed machst Du dann einfach für jeden Wert, den Du extrahieren willst, hinter die JSON Node eine ChangeNode bzw. halt im Blockly jeweils ein Attribut Puzzlestück.

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

                                @mickym btw, ich habe noch ein (für mich ) etwas komplexes Blockly im Kopf, kann ich bei Problemen ggf. auch auf Deine Expertise hoffen ?

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

                                  @hal Grundsätzlich gerne - wobei ich ja kein Blockly Spezialist oder Puzzle-Fan bin. Aber ich versuche es gerne (da lerne ich ja auch meist dazu) - aber ansonsten sind ja für Blockly auch noch die Koryphäen wie @paul53 hier an Board.

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

                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate
                                  FAQ Cloud / IOT
                                  HowTo: Node.js-Update
                                  HowTo: Backup/Restore
                                  Downloads
                                  BLOG

                                  963
                                  Online

                                  31.6k
                                  Users

                                  79.5k
                                  Topics

                                  1.3m
                                  Posts

                                  10
                                  167
                                  28695
                                  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