Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Wert aus Objekt auslesen und in Datenpunkt speichern

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Wert aus Objekt auslesen und in Datenpunkt speichern

    This topic has been deleted. Only users with topic management privileges can see it.
    • Homoran
      Homoran Global Moderator Administrators @toki1973 last edited by

      @toki1973 sagte in Wert aus Objekt auslesen und in Datenpunkt speichern:

      Zuvor hatte ich eine separate MQTT Instanz

      du kannst keine zwei MQTT Clients mit gleichem Port parallel betreiben

      T 1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @paul53 last edited by

        @paul53 sagte in Wert aus Objekt auslesen und in Datenpunkt speichern:

        Dann versuche es so:

        Auch das hatte nicht geklappt.

        @toki1973 sagte in Wert aus Objekt auslesen und in Datenpunkt speichern:

        Uns siehe da:

        Dann brauche ich ja nicht mehr versuchen den String zu zerlegen

        paul53 1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @Homoran last edited by

          @Homoran sagte:

          Auch das hatte nicht geklappt.

          @toki1973 hat uns mit {"val":" in die Irre geführt, denn das stammt aus dem state-JSON, das er nur unvollständig gepostet hat.

          Homoran 1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators @paul53 last edited by

            @paul53 sagte in Wert aus Objekt auslesen und in Datenpunkt speichern:

            das er nur unvollständig gepostet hat.

            deswegen das unexpected end of JSON

            OK - ich denke das Thema ist mit der Lösung über den Sonoff Adapter erledigt

            1 Reply Last reply Reply Quote 0
            • T
              toki1973 @Homoran last edited by

              @Homoran said in Wert aus Objekt auslesen und in Datenpunkt speichern:

              @toki1973 sagte in Wert aus Objekt auslesen und in Datenpunkt speichern:

              Zuvor hatte ich eine separate MQTT Instanz

              du kannst keine zwei MQTT Clients mit gleichem Port parallel betreiben

              Habe ja auch zwei unterschiedliche Ports 🙂

              Homoran 1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @toki1973 last edited by

                @toki1973 sagte in Wert aus Objekt auslesen und in Datenpunkt speichern:

                Habe ja auch zwei unterschiedliche Ports

                und die Clients sind auf beide ports konfiguriert?

                1 Reply Last reply Reply Quote 0
                • T
                  toki1973 @paul53 last edited by

                  @paul53
                  Danke jetzt habe ich auch der Wert gefunden.

                  @Homoran @paul53 Vielen Dank euch beide für die Hilfe!

                  Ich stelle meine Wemo MQTTs jetzt dann wohl alle auf den Sonoff MQQT Port um

                  Homoran 1 Reply Last reply Reply Quote 0
                  • Homoran
                    Homoran Global Moderator Administrators @toki1973 last edited by Homoran

                    @toki1973 nur nochmal zur Vollständigkeit:
                    ich habe es mit dem Wert des alten Datenpunkts hinbekommen, wie ich es bei einem reinen String angegangen wäre:
                    Pseudojson_parse.png
                    Das Blockly sucht die Position der Bezeichner in dem String und schneidet dann den Wert aus.
                    Hier wird es nur als debug ausgegeben. Die Werte müssten jetzt noch in den Typ Zahl gewandelt und in die entsprechenden States geschrieben werden.

                    <xml xmlns="https://developers.google.com/blockly/xml">
                     <variables>
                       <variable id="NO](LAkLZglctMb_$wO[">Quelle</variable>
                       <variable id="/upv]`?_EJ|!;*QbGDMR">Anfang1</variable>
                       <variable id="LVUM4CZi/9F;GNv}6msY">Anfang2</variable>
                       <variable id="$]!:a_6pW`bl}#7]?,U]">Ende2</variable>
                       <variable id="h1$9BViyu$roYbqeFFot">Laenge1</variable>
                       <variable id="PN!1RG(QH3oS4=8,_Uxz">Laenge2</variable>
                       <variable id="`0akL]F~?W5Y2EzEHlag">total</variable>
                       <variable id="jZ25is}JHrg29}QX!jW6">current</variable>
                     </variables>
                     <block type="variables_set" id="9Sdi^OmzX20RaVa~R;`W" x="38" y="-12">
                       <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                       <value name="VALUE">
                         <block type="text" id="vrV_n98?e?X{z04m0KTZ">
                           <field name="TEXT">{"val":"{\"Time\":\"2021-01-05T15:12:40\",\"SML\":{\"Meter_total\":3497.518,\"DJ_TPWRCURR\":590,\"Meter_number\":\"xxxxxxxxxxx\"}}</field>
                         </block>
                       </value>
                       <next>
                         <block type="variables_set" id="Y@XWEA,H,wHg5|}p[;bu">
                           <field name="VAR" id="/upv]`?_EJ|!;*QbGDMR">Anfang1</field>
                           <value name="VALUE">
                             <block type="text_indexOf" id="1^}JI2J`_BSKK9+x0V][">
                               <field name="END">FIRST</field>
                               <value name="VALUE">
                                 <block type="variables_get" id="z`vPzmrPQXNYIKNlg2U0">
                                   <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                                 </block>
                               </value>
                               <value name="FIND">
                                 <shadow type="text" id="cFGjl$lFC[.6Wl{[BB`v">
                                   <field name="TEXT">Meter_total</field>
                                 </shadow>
                               </value>
                             </block>
                           </value>
                           <next>
                             <block type="variables_set" id="sAju@OAi9W+]`2j@f7$(">
                               <field name="VAR" id="LVUM4CZi/9F;GNv}6msY">Anfang2</field>
                               <value name="VALUE">
                                 <block type="text_indexOf" id="T5+xxqyK:l:{i1wh[mfF">
                                   <field name="END">FIRST</field>
                                   <value name="VALUE">
                                     <block type="variables_get" id="*%s[:JfZOZnC!4~E9.v~">
                                       <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                                     </block>
                                   </value>
                                   <value name="FIND">
                                     <shadow type="text" id="guYVK[/L(0m0!DhO!H9s">
                                       <field name="TEXT">DJ_TPWRCURR</field>
                                     </shadow>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="variables_set" id="hHOHcxA:Y9S;@2:EvYhA">
                                   <field name="VAR" id="$]!:a_6pW`bl}#7]?,U]">Ende2</field>
                                   <value name="VALUE">
                                     <block type="text_indexOf" id="`1)z7|3`K~5XY`~GJfc7">
                                       <field name="END">FIRST</field>
                                       <value name="VALUE">
                                         <block type="variables_get" id="d+m_dZiGDVY0W#wxh)xr">
                                           <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                                         </block>
                                       </value>
                                       <value name="FIND">
                                         <shadow type="text" id="){Uri]V}a~W{YWLN(M:W">
                                           <field name="TEXT">Meter_number</field>
                                         </shadow>
                                       </value>
                                     </block>
                                   </value>
                                   <next>
                                     <block type="variables_set" id="WmJ1O6h|7v|y~hR*ojbM">
                                       <field name="VAR" id="h1$9BViyu$roYbqeFFot">Laenge1</field>
                                       <value name="VALUE">
                                         <block type="math_arithmetic" id="?{yYHLx2W#tu{ZZscgXf">
                                           <field name="OP">MINUS</field>
                                           <value name="A">
                                             <shadow type="math_number" id="+y0$sJ$Zs$V/wR+b=k8!">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="math_arithmetic" id="Wn,ovW|b6HA1mLNn:Io1">
                                               <field name="OP">MINUS</field>
                                               <value name="A">
                                                 <shadow type="math_number">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="variables_get" id="fj3y_r;Lj6{Ikb[4`OuL">
                                                   <field name="VAR" id="LVUM4CZi/9F;GNv}6msY">Anfang2</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number" id="Y+D#Zd+TdW:bdFyL*dxu">
                                                   <field name="NUM">3</field>
                                                 </shadow>
                                               </value>
                                             </block>
                                           </value>
                                           <value name="B">
                                             <shadow type="math_number" id=",rcpSOo+ixT{O_#?@x@}">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="math_arithmetic" id=",?WYV7.v?wzB(uTYo)a0">
                                               <field name="OP">ADD</field>
                                               <value name="A">
                                                 <shadow type="math_number" id="!/8fY!~8XvE]YvGm7`Xo">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="variables_get" id="*1Gi|vc%EKR!.)$h}U`q">
                                                   <field name="VAR" id="/upv]`?_EJ|!;*QbGDMR">Anfang1</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number" id="bb~jhfC/`.s=n/8}nxu*">
                                                   <field name="NUM">14</field>
                                                 </shadow>
                                               </value>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="variables_set" id="_$Kk:g0w1wVl:s-%j;ra">
                                           <field name="VAR" id="PN!1RG(QH3oS4=8,_Uxz">Laenge2</field>
                                           <value name="VALUE">
                                             <block type="math_arithmetic" id=":hocYWr5,vcD*!~QWlon">
                                               <field name="OP">MINUS</field>
                                               <value name="A">
                                                 <shadow type="math_number" id="@2*M)M2;axXd)%RI6K7H">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="math_arithmetic" id="mAvsB4QLuUHWS4$@nE9[">
                                                   <field name="OP">MINUS</field>
                                                   <value name="A">
                                                     <shadow type="math_number">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="variables_get" id="%5zC=*^x*6Rfi^nxWj(U">
                                                       <field name="VAR" id="$]!:a_6pW`bl}#7]?,U]">Ende2</field>
                                                     </block>
                                                   </value>
                                                   <value name="B">
                                                     <shadow type="math_number" id="J7@E~,R]P:SK+0hu[^.C">
                                                       <field name="NUM">3</field>
                                                     </shadow>
                                                   </value>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="math_arithmetic" id="}-_bRZ|!e87r~yt9Sw27">
                                                   <field name="OP">ADD</field>
                                                   <value name="A">
                                                     <shadow type="math_number">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="variables_get" id=",V;=M|eJuk.)/ramsxe@">
                                                       <field name="VAR" id="LVUM4CZi/9F;GNv}6msY">Anfang2</field>
                                                     </block>
                                                   </value>
                                                   <value name="B">
                                                     <shadow type="math_number" id="y[~{;2.MA=`Jno=$P;sc">
                                                       <field name="NUM">14</field>
                                                     </shadow>
                                                   </value>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id="_YEY=7%bKRIFkaJUG(qd">
                                               <field name="VAR" id="`0akL]F~?W5Y2EzEHlag">total</field>
                                               <value name="VALUE">
                                                 <block type="text_getSubstring" id="M}Yp.Lu^Gq0~Y2+y,am%">
                                                   <mutation at1="true" at2="true"></mutation>
                                                   <field name="WHERE1">FROM_START</field>
                                                   <field name="WHERE2">FROM_START</field>
                                                   <value name="STRING">
                                                     <block type="variables_get" id="vS0S:HzwO.+M*wc:Ka*H">
                                                       <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                                                     </block>
                                                   </value>
                                                   <value name="AT1">
                                                     <block type="math_arithmetic" id=",0imtnCRX/ykTcNUZa%5">
                                                       <field name="OP">ADD</field>
                                                       <value name="A">
                                                         <shadow type="math_number" id="ayn+{oF^1hNl!/s}L{@[">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="K;z7b9!SQp4Lb_X`aOTo">
                                                           <field name="VAR" id="/upv]`?_EJ|!;*QbGDMR">Anfang1</field>
                                                         </block>
                                                       </value>
                                                       <value name="B">
                                                         <shadow type="math_number" id="U?5e=Jjlz=XbARWm5se`">
                                                           <field name="NUM">14</field>
                                                         </shadow>
                                                       </value>
                                                     </block>
                                                   </value>
                                                   <value name="AT2">
                                                     <block type="math_arithmetic" id="QD~bLT=BgqmS0T~SLLn2">
                                                       <field name="OP">ADD</field>
                                                       <value name="A">
                                                         <shadow type="math_number" id="ZhUE?0D*Q!CrF[Y$L0@H">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="math_arithmetic" id=".%rv!C`w,qc~L;;CP`%}">
                                                           <field name="OP">ADD</field>
                                                           <value name="A">
                                                             <shadow type="math_number">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="variables_get" id="+J,8N0351?-tp?zz,%Aw">
                                                               <field name="VAR" id="/upv]`?_EJ|!;*QbGDMR">Anfang1</field>
                                                             </block>
                                                           </value>
                                                           <value name="B">
                                                             <shadow type="math_number" id="faY~#g3k+)t@_V:GE[!m">
                                                               <field name="NUM">14</field>
                                                             </shadow>
                                                           </value>
                                                         </block>
                                                       </value>
                                                       <value name="B">
                                                         <shadow type="math_number" id=".}KSg55;JRgf|m7(lAJ1">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="!QIlWtyT9ga?EWO+AUb?">
                                                           <field name="VAR" id="h1$9BViyu$roYbqeFFot">Laenge1</field>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="variables_set" id="}cx2Z/OF;wLq#OlB_k!z">
                                                   <field name="VAR" id="jZ25is}JHrg29}QX!jW6">current</field>
                                                   <value name="VALUE">
                                                     <block type="text_getSubstring" id="L[oK$#/=l;-sjYGMVfJ{">
                                                       <mutation at1="true" at2="true"></mutation>
                                                       <field name="WHERE1">FROM_START</field>
                                                       <field name="WHERE2">FROM_START</field>
                                                       <value name="STRING">
                                                         <block type="variables_get" id="gY:_44QqYEyfW$,iDy.N">
                                                           <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                                                         </block>
                                                       </value>
                                                       <value name="AT1">
                                                         <block type="math_arithmetic" id="R*U41`gvYWArYTwr$Xlq">
                                                           <field name="OP">ADD</field>
                                                           <value name="A">
                                                             <shadow type="math_number">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="variables_get" id="1t%DxvoPyA;=q-u|||6c">
                                                               <field name="VAR" id="LVUM4CZi/9F;GNv}6msY">Anfang2</field>
                                                             </block>
                                                           </value>
                                                           <value name="B">
                                                             <shadow type="math_number" id="3xf;1l`m/q+S!@v8^qpO">
                                                               <field name="NUM">14</field>
                                                             </shadow>
                                                           </value>
                                                         </block>
                                                       </value>
                                                       <value name="AT2">
                                                         <block type="math_arithmetic" id="EMyN%UrsyEVN4U#aO*4]">
                                                           <field name="OP">ADD</field>
                                                           <value name="A">
                                                             <shadow type="math_number">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="math_arithmetic" id="SoU7CM/a_Q#X+1oj/ZU!">
                                                               <field name="OP">ADD</field>
                                                               <value name="A">
                                                                 <shadow type="math_number">
                                                                   <field name="NUM">1</field>
                                                                 </shadow>
                                                                 <block type="variables_get" id="^|=l+AK0%).)%|[KF,9q">
                                                                   <field name="VAR" id="LVUM4CZi/9F;GNv}6msY">Anfang2</field>
                                                                 </block>
                                                               </value>
                                                               <value name="B">
                                                                 <shadow type="math_number" id="=hWVa`OB-+vs8P{,T1O8">
                                                                   <field name="NUM">14</field>
                                                                 </shadow>
                                                               </value>
                                                             </block>
                                                           </value>
                                                           <value name="B">
                                                             <shadow type="math_number">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="variables_get" id="6};%U#?s}iCt[GK)L*=+">
                                                               <field name="VAR" id="PN!1RG(QH3oS4=8,_Uxz">Laenge2</field>
                                                             </block>
                                                           </value>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                   <next>
                                                     <block type="debug" id="YpW%?F+@JJsP6BGMe)I|">
                                                       <field name="Severity">log</field>
                                                       <value name="TEXT">
                                                         <shadow type="text" id="R[,B:YUhtqw}NY{wus+,">
                                                           <field name="TEXT">test</field>
                                                         </shadow>
                                                         <block type="text_join" id="LwDwj(VU6Aw4}L,7Nk!v">
                                                           <mutation items="9"></mutation>
                                                           <value name="ADD0">
                                                             <block type="variables_get" id=")|ecykB1Go}{M,3nY|}F">
                                                               <field name="VAR" id="NO](LAkLZglctMb_$wO[">Quelle</field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD1">
                                                             <block type="text" id=")FZIQtY[CN_5ax7Yl)+O">
                                                               <field name="TEXT">Start1</field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD2">
                                                             <block type="variables_get" id="Z7iEOioN4NSvP}H-_vic">
                                                               <field name="VAR" id="/upv]`?_EJ|!;*QbGDMR">Anfang1</field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD3">
                                                             <block type="text" id="0h^MKS8M5rtCr=RNV-!%">
                                                               <field name="TEXT">Länge 1</field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD4">
                                                             <block type="variables_get" id="#R`SuIKMZ(C/0(WO~VJA">
                                                               <field name="VAR" id="h1$9BViyu$roYbqeFFot">Laenge1</field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD5">
                                                             <block type="text" id="w^OA7_7y,b%,$c;Y#f!P">
                                                               <field name="TEXT">total: </field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD6">
                                                             <block type="variables_get" id="]L.BjJlB%DE:npKa`M?j">
                                                               <field name="VAR" id="`0akL]F~?W5Y2EzEHlag">total</field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD7">
                                                             <block type="text" id="1htsdTF)CaIK0[zIS^1-">
                                                               <field name="TEXT">; aktuell: </field>
                                                             </block>
                                                           </value>
                                                           <value name="ADD8">
                                                             <block type="variables_get" id="MgusBvAdEvnb@-0(o6.a">
                                                               <field name="VAR" id="jZ25is}JHrg29}QX!jW6">current</field>
                                                             </block>
                                                           </value>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </next>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                    </xml>
                    

                    T K 2 Replies Last reply Reply Quote 1
                    • T
                      toki1973 @Homoran last edited by

                      @Homoran
                      Danke für das Blockly. Jetzt habe ich zumindest die Grundlage zum zerlegen eines Strings verstanden!

                      1 Reply Last reply Reply Quote 0
                      • K
                        Kusi @Homoran last edited by

                        Vielen Dank für das Blockly.
                        Auch mir hat dies geholfen. Ich habe es in Verbindung mit meinem iRobot Roomba und Braava genutzt.
                        Ziel war es, dass ich die Region_ID auslesen konnte, ohne den ganzen Text des Objekts in ein Textprogramm zu kopieren und die Region_ID zu suchen.

                        4a1ddd01-a620-44d5-83c4-2b3c6b4080d6-image.png

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        912
                        Online

                        32.0k
                        Users

                        80.4k
                        Topics

                        1.3m
                        Posts

                        4
                        29
                        5571
                        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