Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [Gelößt] Hilfe brauche ein Script

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Gelößt] Hilfe brauche ein Script

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

      @arteck sagte in Hilfe brauche ein Script:

      wie währe es ein wenig Eigeninitiative.. es gibt genügent tutorials und eine doku....

      Du hast ja grundsätzlich recht. Trotzdem finde ich Deine Antwort nicht gut.
      Wenn sich schon ein "Helfender" eingeschaltet hat, sollte man ihm die Entscheidung überlassen.
      Und wenn schon der Hinweis auf die Doku, dann wäre ein kleiner Tip schön gewesen. Jemanden, der nicht weis wonach er suchen soll, bringt die Doku auch nichts.

      Grüße

      1 Reply Last reply Reply Quote 0
      • rantanplan
        rantanplan last edited by rantanplan

        Wie Paul53 schon eindrucksvoll gezeigt hat, sind das in JS nur ein paar Zeilen.
        In Blockly geht das "von hinten durch die Brust ins Auge".

        Zum Verständnis (und lernen☺ ) zeige ich mal eine "etwas" ausführliche Lösung.

        (Über eine Antwort von Paul53 würde ich mich auch freuen. Vielleicht hat er ja die "JSON-Bausteine" enträtselt.)

        Beispiel_001.png

        Export:

        <xml xmlns="http://www.w3.org/1999/xhtml">
          <variables>
            <variable type="" id="2R99*+!(ovfD$?Z+Ri@~">Text</variable>
            <variable type="" id="2|TCE*#nEGA2s*%j+z.F">TextLaenge</variable>
            <variable type="" id="8CRYYEX+JaTUV-o=C]7}">suchText</variable>
            <variable type="" id="=4O:50b6Ek/vo;[8*[mN">Fundstelle</variable>
            <variable type="" id="exHs?NUXv!N%lId*IJsx">TextTeilstueck</variable>
            <variable type="" id="`Q/:wkC*Z([8-mYvl,5i">Liste</variable>
            <variable type="" id="mFFbNq?Vt.;s{*c!I5@p">ListeAnzahlElemente</variable>
            <variable type="" id="A=oFX+JV^E?Ne=R/e_N[">i</variable>
          </variables>
          <block type="comment" id="cvvkT(U,(S0VRy%~swI|" x="38" y="37">
            <field name="COMMENT">Das ist der Datenpunkt</field>
            <next>
              <block type="variables_set" id="p}Tn=!F58r/0+nkLRd/C">
                <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                <value name="VALUE">
                  <block type="text" id="`,#4Zm)6$9qhBMwkjY`4">
                    <field name="TEXT">{"idx":1,"svalue:1":"14.8;61,6;0"}</field>
                  </block>
                </value>
                <next>
                  <block type="comment" id="86;q.v0U]b:}(e,)w@8L">
                    <field name="COMMENT">Die Länge von Text</field>
                    <next>
                      <block type="variables_set" id="D;EuQi2_tpig^2PzA+ot">
                        <field name="VAR" id="2|TCE*#nEGA2s*%j+z.F" variabletype="">TextLaenge</field>
                        <value name="VALUE">
                          <block type="text_length" id="L$gbucr|-LK5S8agn]H8">
                            <value name="VALUE">
                              <shadow type="text" id="GVmpY^BTOM,NNRHY%dcA">
                                <field name="TEXT">abc</field>
                              </shadow>
                              <block type="variables_get" id="zq*aMp!t;4UTUM3g[-K(">
                                <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <next>
                          <block type="comment" id="n}7[oVCRftF5}ja:Je2E">
                            <field name="COMMENT">Das soll in dem Text gesucht werden</field>
                            <next>
                              <block type="variables_set" id="s#suM%c7/}ZIZP|mFS[n">
                                <field name="VAR" id="8CRYYEX+JaTUV-o=C]7}" variabletype="">suchText</field>
                                <value name="VALUE">
                                  <block type="text" id="ctT2W(utrBX$}{gx;f^#">
                                    <field name="TEXT">:"</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="comment" id="Dr7d00{INN3f!qfTY4YT">
                                    <field name="COMMENT">Hier wurde der Text gefunden (Suche von hinten)</field>
                                    <next>
                                      <block type="variables_set" id="6-mJ?tSo?LSU[i3y(H+e">
                                        <field name="VAR" id="=4O:50b6Ek/vo;[8*[mN" variabletype="">Fundstelle</field>
                                        <value name="VALUE">
                                          <block type="text_indexOf" id="vRI?C1*DtjT7nj{lEFZ(" inline="false">
                                            <field name="END">LAST</field>
                                            <value name="VALUE">
                                              <block type="variables_get" id="x)nC303{RsT7HoNAAxWI">
                                                <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                                              </block>
                                            </value>
                                            <value name="FIND">
                                              <shadow type="text" id="uV*DTVf/!P@N=6In~c.V">
                                                <field name="TEXT"></field>
                                              </shadow>
                                              <block type="variables_get" id="na3`C8![:Ca[xjS*gzQU">
                                                <field name="VAR" id="8CRYYEX+JaTUV-o=C]7}" variabletype="">suchText</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="comment" id="yoySoy5sdmr=YYv`I]zE">
                                            <field name="COMMENT">der interessante Teil vom Datenpunkt</field>
                                            <next>
                                              <block type="variables_set" id="C{@Fm({M.}eH`U/;#f,[">
                                                <field name="VAR" id="exHs?NUXv!N%lId*IJsx" variabletype="">TextTeilstueck</field>
                                                <value name="VALUE">
                                                  <block type="text_getSubstring" id="F#KAY6uw#c+{=*.oXI%y" inline="false">
                                                    <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="IVdD`%5}{8TbHW0p0e_z">
                                                        <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                                                      </block>
                                                    </value>
                                                    <value name="AT1">
                                                      <block type="math_arithmetic" id=":H30puv$~3+t[?MAK*U5">
                                                        <field name="OP">ADD</field>
                                                        <value name="A">
                                                          <shadow type="math_number" id="gx]rsLxD~nL#-~Dn^`mp">
                                                            <field name="NUM">1</field>
                                                          </shadow>
                                                          <block type="variables_get" id="[DW(~aPCD2b.94t$5o#?">
                                                            <field name="VAR" id="=4O:50b6Ek/vo;[8*[mN" variabletype="">Fundstelle</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <shadow type="math_number" id="@XWBM*.T5Bn`.H)Kx7jP">
                                                            <field name="NUM">2</field>
                                                          </shadow>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="AT2">
                                                      <block type="math_arithmetic" id="gd?A.QRMbwlJDg1pi~F,">
                                                        <field name="OP">MINUS</field>
                                                        <value name="A">
                                                          <shadow type="math_number" id="k-/*$gp2Ne;hGtsn(kO:">
                                                            <field name="NUM">1</field>
                                                          </shadow>
                                                          <block type="variables_get" id="XP3ociH9,hIc-YQoJ!A%">
                                                            <field name="VAR" id="2|TCE*#nEGA2s*%j+z.F" variabletype="">TextLaenge</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <shadow type="math_number" id="MSq3N9]@/;|0NI?MBfHi">
                                                            <field name="NUM">2</field>
                                                          </shadow>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="debug" id="mH6Na/53l](,qLkK:l5D">
                                                    <field name="Severity">log</field>
                                                    <value name="TEXT">
                                                      <shadow type="text" id="Lt?(z4E|?_kq/U#h9P7-">
                                                        <field name="TEXT">test</field>
                                                      </shadow>
                                                      <block type="variables_get" id="B,{HJt:LS#R$8xFa%c;R">
                                                        <field name="VAR" id="exHs?NUXv!N%lId*IJsx" variabletype="">TextTeilstueck</field>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="comment" id="mqk1HfPp7N/Qb`*/:BLo">
                                                        <field name="COMMENT">Eine Liste aus dem Teilstück</field>
                                                        <next>
                                                          <block type="variables_set" id="dVIP@h_MG9yz*UL6NL).">
                                                            <field name="VAR" id="`Q/:wkC*Z([8-mYvl,5i" variabletype="">Liste</field>
                                                            <value name="VALUE">
                                                              <block type="lists_split" id="(7yd*61IIl-[J=k0p(r9">
                                                                <mutation mode="SPLIT"></mutation>
                                                                <field name="MODE">SPLIT</field>
                                                                <value name="INPUT">
                                                                  <block type="variables_get" id="yf))S%kc21#`E09kX5R(">
                                                                    <field name="VAR" id="exHs?NUXv!N%lId*IJsx" variabletype="">TextTeilstueck</field>
                                                                  </block>
                                                                </value>
                                                                <value name="DELIM">
                                                                  <shadow type="text" id="j_:ESd1QYrR(gT=GbKD_">
                                                                    <field name="TEXT">;</field>
                                                                  </shadow>
                                                                </value>
                                                              </block>
                                                            </value>
                                                            <next>
                                                              <block type="comment" id="gCP1_V%YWpnK*^da#L|^">
                                                                <field name="COMMENT">Anzahl der erstellen Elemente in der Liste</field>
                                                                <next>
                                                                  <block type="variables_set" id="sKX_Ir@hwNvZM]0oRH|8">
                                                                    <field name="VAR" id="mFFbNq?Vt.;s{*c!I5@p" variabletype="">ListeAnzahlElemente</field>
                                                                    <value name="VALUE">
                                                                      <block type="lists_length" id="+^RGW_$?RaD#A*weO_Z0">
                                                                        <value name="VALUE">
                                                                          <block type="variables_get" id="=wN?MH.da[X^cwa)jfSC">
                                                                            <field name="VAR" id="`Q/:wkC*Z([8-mYvl,5i" variabletype="">Liste</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <next>
                                                                      <block type="debug" id="x=fvm$zuZzf1pK#MJCWS">
                                                                        <field name="Severity">log</field>
                                                                        <value name="TEXT">
                                                                          <shadow type="text" id=".]Ih{:Fq*!1zTJ#Ck5^$">
                                                                            <field name="TEXT">test</field>
                                                                          </shadow>
                                                                          <block type="variables_get" id="fYR_10YMqyY*=hu_x{7~">
                                                                            <field name="VAR" id="mFFbNq?Vt.;s{*c!I5@p" variabletype="">ListeAnzahlElemente</field>
                                                                          </block>
                                                                        </value>
                                                                        <next>
                                                                          <block type="comment" id="%rzt#pYr7#Q*?6rPFe+^">
                                                                            <field name="COMMENT">Ausgeben der Elemente</field>
                                                                            <next>
                                                                              <block type="controls_for" id="lO$x3?Q)WT[uQ7ai5O]T">
                                                                                <field name="VAR" id="A=oFX+JV^E?Ne=R/e_N[" variabletype="">i</field>
                                                                                <value name="FROM">
                                                                                  <shadow type="math_number" id="/knKj6=7j^t[j^^Wtt1s">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                </value>
                                                                                <value name="TO">
                                                                                  <shadow type="math_number" id="Z?o_jrxs]8/^p;y[Pb_(">
                                                                                    <field name="NUM">10</field>
                                                                                  </shadow>
                                                                                  <block type="variables_get" id="s{L-]Ojj:V(JCu)@CA!B">
                                                                                    <field name="VAR" id="mFFbNq?Vt.;s{*c!I5@p" variabletype="">ListeAnzahlElemente</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="BY">
                                                                                  <shadow type="math_number" id="-jF$^h,PPl74u`usV)kh">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                </value>
                                                                                <statement name="DO">
                                                                                  <block type="debug" id="-+R?qVY8OHyn~xx@8ToU">
                                                                                    <field name="Severity">log</field>
                                                                                    <value name="TEXT">
                                                                                      <shadow type="text" id="XyhwTo6F?DK)#u|}nN]T">
                                                                                        <field name="TEXT">test</field>
                                                                                      </shadow>
                                                                                      <block type="lists_getIndex" id="Ur#l[;ZM%ZhNT7a=jik6">
                                                                                        <mutation statement="false" at="true"></mutation>
                                                                                        <field name="MODE">GET</field>
                                                                                        <field name="WHERE">FROM_START</field>
                                                                                        <value name="VALUE">
                                                                                          <block type="variables_get" id="he.hEu8SPO9wBS:Py6QI">
                                                                                            <field name="VAR" id="`Q/:wkC*Z([8-mYvl,5i" variabletype="">Liste</field>
                                                                                          </block>
                                                                                        </value>
                                                                                        <value name="AT">
                                                                                          <block type="variables_get" id="BeYIjC%X6Cv2M*sPV+m+">
                                                                                            <field name="VAR" id="A=oFX+JV^E?Ne=R/e_N[" variabletype="">i</field>
                                                                                          </block>
                                                                                        </value>
                                                                                      </block>
                                                                                    </value>
                                                                                  </block>
                                                                                </statement>
                                                                                <next>
                                                                                  <block type="comment" id="T{IH*//7)ZocWo(VtWL*">
                                                                                    <field name="COMMENT">Element 1 und 2 sind hier die gesuchten Werte</field>
                                                                                  </block>
                                                                                </next>
                                                                              </block>
                                                                            </next>
                                                                          </block>
                                                                        </next>
                                                                      </block>
                                                                    </next>
                                                                  </block>
                                                                </next>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </xml>
        
        <xml xmlns="http://www.w3.org/1999/xhtml">
          <variables>
            <variable type="" id="2R99*+!(ovfD$?Z+Ri@~">Text</variable>
            <variable type="" id="2|TCE*#nEGA2s*%j+z.F">TextLaenge</variable>
            <variable type="" id="8CRYYEX+JaTUV-o=C]7}">suchText</variable>
            <variable type="" id="=4O:50b6Ek/vo;[8*[mN">Fundstelle</variable>
            <variable type="" id="exHs?NUXv!N%lId*IJsx">TextTeilstueck</variable>
            <variable type="" id="`Q/:wkC*Z([8-mYvl,5i">Liste</variable>
            <variable type="" id="mFFbNq?Vt.;s{*c!I5@p">ListeAnzahlElemente</variable>
            <variable type="" id="A=oFX+JV^E?Ne=R/e_N[">i</variable>
          </variables>
          <block type="comment" id="cvvkT(U,(S0VRy%~swI|" x="38" y="37">
            <field name="COMMENT">Das ist der Datenpunkt</field>
            <next>
              <block type="variables_set" id="p}Tn=!F58r/0+nkLRd/C">
                <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                <value name="VALUE">
                  <block type="text" id="`,#4Zm)6$9qhBMwkjY`4">
                    <field name="TEXT">{"idx":1,"svalue:1":"14.8;61,6;0"}</field>
                  </block>
                </value>
                <next>
                  <block type="comment" id="86;q.v0U]b:}(e,)w@8L">
                    <field name="COMMENT">Die Länge von Text</field>
                    <next>
                      <block type="variables_set" id="D;EuQi2_tpig^2PzA+ot">
                        <field name="VAR" id="2|TCE*#nEGA2s*%j+z.F" variabletype="">TextLaenge</field>
                        <value name="VALUE">
                          <block type="text_length" id="L$gbucr|-LK5S8agn]H8">
                            <value name="VALUE">
                              <shadow type="text" id="GVmpY^BTOM,NNRHY%dcA">
                                <field name="TEXT">abc</field>
                              </shadow>
                              <block type="variables_get" id="zq*aMp!t;4UTUM3g[-K(">
                                <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <next>
                          <block type="comment" id="n}7[oVCRftF5}ja:Je2E">
                            <field name="COMMENT">Das soll in dem Text gesucht werden</field>
                            <next>
                              <block type="variables_set" id="s#suM%c7/}ZIZP|mFS[n">
                                <field name="VAR" id="8CRYYEX+JaTUV-o=C]7}" variabletype="">suchText</field>
                                <value name="VALUE">
                                  <block type="text" id="ctT2W(utrBX$}{gx;f^#">
                                    <field name="TEXT">:"</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="comment" id="Dr7d00{INN3f!qfTY4YT">
                                    <field name="COMMENT">Hier wurde der Text gefunden (Suche von hinten)</field>
                                    <next>
                                      <block type="variables_set" id="6-mJ?tSo?LSU[i3y(H+e">
                                        <field name="VAR" id="=4O:50b6Ek/vo;[8*[mN" variabletype="">Fundstelle</field>
                                        <value name="VALUE">
                                          <block type="text_indexOf" id="vRI?C1*DtjT7nj{lEFZ(" inline="false">
                                            <field name="END">LAST</field>
                                            <value name="VALUE">
                                              <block type="variables_get" id="x)nC303{RsT7HoNAAxWI">
                                                <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                                              </block>
                                            </value>
                                            <value name="FIND">
                                              <shadow type="text" id="uV*DTVf/!P@N=6In~c.V">
                                                <field name="TEXT"></field>
                                              </shadow>
                                              <block type="variables_get" id="na3`C8![:Ca[xjS*gzQU">
                                                <field name="VAR" id="8CRYYEX+JaTUV-o=C]7}" variabletype="">suchText</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="comment" id="yoySoy5sdmr=YYv`I]zE">
                                            <field name="COMMENT">der interessante Teil vom Datenpunkt</field>
                                            <next>
                                              <block type="variables_set" id="C{@Fm({M.}eH`U/;#f,[">
                                                <field name="VAR" id="exHs?NUXv!N%lId*IJsx" variabletype="">TextTeilstueck</field>
                                                <value name="VALUE">
                                                  <block type="text_getSubstring" id="F#KAY6uw#c+{=*.oXI%y" inline="false">
                                                    <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="IVdD`%5}{8TbHW0p0e_z">
                                                        <field name="VAR" id="2R99*+!(ovfD$?Z+Ri@~" variabletype="">Text</field>
                                                      </block>
                                                    </value>
                                                    <value name="AT1">
                                                      <block type="math_arithmetic" id=":H30puv$~3+t[?MAK*U5">
                                                        <field name="OP">ADD</field>
                                                        <value name="A">
                                                          <shadow type="math_number" id="gx]rsLxD~nL#-~Dn^`mp">
                                                            <field name="NUM">1</field>
                                                          </shadow>
                                                          <block type="variables_get" id="[DW(~aPCD2b.94t$5o#?">
                                                            <field name="VAR" id="=4O:50b6Ek/vo;[8*[mN" variabletype="">Fundstelle</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <shadow type="math_number" id="@XWBM*.T5Bn`.H)Kx7jP">
                                                            <field name="NUM">2</field>
                                                          </shadow>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="AT2">
                                                      <block type="math_arithmetic" id="gd?A.QRMbwlJDg1pi~F,">
                                                        <field name="OP">MINUS</field>
                                                        <value name="A">
                                                          <shadow type="math_number" id="k-/*$gp2Ne;hGtsn(kO:">
                                                            <field name="NUM">1</field>
                                                          </shadow>
                                                          <block type="variables_get" id="XP3ociH9,hIc-YQoJ!A%">
                                                            <field name="VAR" id="2|TCE*#nEGA2s*%j+z.F" variabletype="">TextLaenge</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <shadow type="math_number" id="MSq3N9]@/;|0NI?MBfHi">
                                                            <field name="NUM">2</field>
                                                          </shadow>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="debug" id="mH6Na/53l](,qLkK:l5D">
                                                    <field name="Severity">log</field>
                                                    <value name="TEXT">
                                                      <shadow type="text" id="Lt?(z4E|?_kq/U#h9P7-">
                                                        <field name="TEXT">test</field>
                                                      </shadow>
                                                      <block type="variables_get" id="B,{HJt:LS#R$8xFa%c;R">
                                                        <field name="VAR" id="exHs?NUXv!N%lId*IJsx" variabletype="">TextTeilstueck</field>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="comment" id="mqk1HfPp7N/Qb`*/:BLo">
                                                        <field name="COMMENT">Eine Liste aus dem Teilstück</field>
                                                        <next>
                                                          <block type="variables_set" id="dVIP@h_MG9yz*UL6NL).">
                                                            <field name="VAR" id="`Q/:wkC*Z([8-mYvl,5i" variabletype="">Liste</field>
                                                            <value name="VALUE">
                                                              <block type="lists_split" id="(7yd*61IIl-[J=k0p(r9">
                                                                <mutation mode="SPLIT"></mutation>
                                                                <field name="MODE">SPLIT</field>
                                                                <value name="INPUT">
                                                                  <block type="variables_get" id="yf))S%kc21#`E09kX5R(">
                                                                    <field name="VAR" id="exHs?NUXv!N%lId*IJsx" variabletype="">TextTeilstueck</field>
                                                                  </block>
                                                                </value>
                                                                <value name="DELIM">
                                                                  <shadow type="text" id="j_:ESd1QYrR(gT=GbKD_">
                                                                    <field name="TEXT">;</field>
                                                                  </shadow>
                                                                </value>
                                                              </block>
                                                            </value>
                                                            <next>
                                                              <block type="comment" id="gCP1_V%YWpnK*^da#L|^">
                                                                <field name="COMMENT">Anzahl der erstellen Elemente in der Liste</field>
                                                                <next>
                                                                  <block type="variables_set" id="sKX_Ir@hwNvZM]0oRH|8">
                                                                    <field name="VAR" id="mFFbNq?Vt.;s{*c!I5@p" variabletype="">ListeAnzahlElemente</field>
                                                                    <value name="VALUE">
                                                                      <block type="lists_length" id="+^RGW_$?RaD#A*weO_Z0">
                                                                        <value name="VALUE">
                                                                          <block type="variables_get" id="=wN?MH.da[X^cwa)jfSC">
                                                                            <field name="VAR" id="`Q/:wkC*Z([8-mYvl,5i" variabletype="">Liste</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <next>
                                                                      <block type="debug" id="x=fvm$zuZzf1pK#MJCWS">
                                                                        <field name="Severity">log</field>
                                                                        <value name="TEXT">
                                                                          <shadow type="text" id=".]Ih{:Fq*!1zTJ#Ck5^$">
                                                                            <field name="TEXT">test</field>
                                                                          </shadow>
                                                                          <block type="variables_get" id="fYR_10YMqyY*=hu_x{7~">
                                                                            <field name="VAR" id="mFFbNq?Vt.;s{*c!I5@p" variabletype="">ListeAnzahlElemente</field>
                                                                          </block>
                                                                        </value>
                                                                        <next>
                                                                          <block type="comment" id="%rzt#pYr7#Q*?6rPFe+^">
                                                                            <field name="COMMENT">Ausgeben der Elemente</field>
                                                                            <next>
                                                                              <block type="controls_for" id="lO$x3?Q)WT[uQ7ai5O]T">
                                                                                <field name="VAR" id="A=oFX+JV^E?Ne=R/e_N[" variabletype="">i</field>
                                                                                <value name="FROM">
                                                                                  <shadow type="math_number" id="/knKj6=7j^t[j^^Wtt1s">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                </value>
                                                                                <value name="TO">
                                                                                  <shadow type="math_number" id="Z?o_jrxs]8/^p;y[Pb_(">
                                                                                    <field name="NUM">10</field>
                                                                                  </shadow>
                                                                                  <block type="variables_get" id="s{L-]Ojj:V(JCu)@CA!B">
                                                                                    <field name="VAR" id="mFFbNq?Vt.;s{*c!I5@p" variabletype="">ListeAnzahlElemente</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="BY">
                                                                                  <shadow type="math_number" id="-jF$^h,PPl74u`usV)kh">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                </value>
                                                                                <statement name="DO">
                                                                                  <block type="debug" id="-+R?qVY8OHyn~xx@8ToU">
                                                                                    <field name="Severity">log</field>
                                                                                    <value name="TEXT">
                                                                                      <shadow type="text" id="XyhwTo6F?DK)#u|}nN]T">
                                                                                        <field name="TEXT">test</field>
                                                                                      </shadow>
                                                                                      <block type="lists_getIndex" id="Ur#l[;ZM%ZhNT7a=jik6">
                                                                                        <mutation statement="false" at="true"></mutation>
                                                                                        <field name="MODE">GET</field>
                                                                                        <field name="WHERE">FROM_START</field>
                                                                                        <value name="VALUE">
                                                                                          <block type="variables_get" id="he.hEu8SPO9wBS:Py6QI">
                                                                                            <field name="VAR" id="`Q/:wkC*Z([8-mYvl,5i" variabletype="">Liste</field>
                                                                                          </block>
                                                                                        </value>
                                                                                        <value name="AT">
                                                                                          <block type="variables_get" id="BeYIjC%X6Cv2M*sPV+m+">
                                                                                            <field name="VAR" id="A=oFX+JV^E?Ne=R/e_N[" variabletype="">i</field>
                                                                                          </block>
                                                                                        </value>
                                                                                      </block>
                                                                                    </value>
                                                                                  </block>
                                                                                </statement>
                                                                                <next>
                                                                                  <block type="comment" id="T{IH*//7)ZocWo(VtWL*">
                                                                                    <field name="COMMENT">Element 1 und 2 sind hier die gesuchten Werte</field>
                                                                                  </block>
                                                                                </next>
                                                                              </block>
                                                                            </next>
                                                                          </block>
                                                                        </next>
                                                                      </block>
                                                                    </next>
                                                                  </block>
                                                                </next>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </xml>
        

        Grüße

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

          Ich denke was atreck damit eher meint ist, dass das wirklich nur Grundbefehle sind und der TE nach einem Skript direkt fragt und nicht nach hilfe zu einem Skript.

          @winny1900 Wo hast du denn Probleme?
          Was funktioniert nicht, was hast du bisher?

          rantanplan 1 Reply Last reply Reply Quote 0
          • rantanplan
            rantanplan @thewhobox last edited by

            @thewhobox sagte in Hilfe brauche ein Script:

            Ich denke was atreck damit eher meint ist, dass das wirklich nur Grundbefehle sind und der TE nach einem Skript direkt fragt und nicht nach hilfe zu einem Skript.

            Du und arteck habt ja beide Recht. (wenigstens ein bisschen ☺ )
            Aber wir kommen vom Thema ab.

            Grüße

            thewhobox 1 Reply Last reply Reply Quote 0
            • thewhobox
              thewhobox @rantanplan last edited by

              @rantanplan na gut. Um wieder auf das Theme zu kommen 😛
              Hier mal ein einfaches Blockly mit einer Javascript funktion:
              6ae3e2cd-0e00-4317-8f64-705a7478e92d-grafik.png

              Die Funktion sieht dann so aus:
              edd73392-48e9-4890-990b-613caa02aa9a-grafik.png

              Alles minimaler Aufwand, wie es @paul53 schon hatte, nur in einem Blockly.

              Was macht es?
              Es holt sich zuerst den JSON strin aus dem Datenpunkt mit "getState", macht daraus ein JSON-Objekt "JSON.parse" und splittet es dann bei jedem Semikolon und gibt es als Array (hier auch Liste genannt) zurück.

              Die Funktion kannst du auch in einen Trigger packen, wenn sich der Wert ändert und dann in einen seperaten Datenpunkt schreiben.

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

                @winny1900 sagte:

                Kannst du mir da vlt. noch ein wenig weiter helfen ?

                const idSrc = 'mqtt.0.domoticz.in';
                const idTemp = 'Aussen.Temperatur'; 
                const idHum = 'Aussen.Luftfeuchte';
                
                createState(idTemp, 0, {type: 'number', unit: '°C'});
                createState(idHum, 0, {type: 'number', unit: '%'});
                
                function values(val) {
                   var svalue = JSON.parse(val).svalue.split(';');
                   setState(idTemp, parseFloat(svalue[0]), true);
                   setState(idHum, parseFloat(svalue[1]), true);
                }
                
                setTimeout(function() { // Skriptstart
                   values(getState(idSrc).val);
                }, 100);
                
                on(idSrc, function(dp) {
                   values(dp.state.val);
                });
                
                rantanplan 1 Reply Last reply Reply Quote 0
                • rantanplan
                  rantanplan @paul53 last edited by

                  @paul53 Wir sind hier in der Blockly Rubrik.

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

                    @rantanplan sagte:

                    Wir sind hier in der Blockly Rubrik.

                    Habe ich übersehen.
                    Blockly ist mir zu anstrengend. Schadet es jemandem, an Beispielen Javascript zu lernen ?

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

                      Hey Jungs

                      Ich möchte euch danken für die Hilfe werde es zu Hause gleich ausprobieren.

                      Ich wollte hier kein Ärger verursachen mit meiner Frage.

                      Bevor ich es hier gepostet habe , habe ich alles was mir in Sachen blockly bekannt ist ausprobiert. Ohne Erfolg. Deshalb und nur deshalb habe ich um Hilfe gebeten.

                      Mit den Jason Scripts habe ich noch gar keine Erfahrung.

                      Nochmals danke für die Hilfe ich werde mich melden ob es geklappt hat.

                      Grüße vom Niederrhein

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

                        @winny1900

                        @winny1900 sagte in Hilfe brauche ein Script:

                        habe ich alles was mir in Sachen blockly bekannt ist ausprobiert

                        Dann zeig das mal.

                        Es ist immer einfacher an den Fragmenten zu erkennen wo die Denkfehler sind

                        1 Reply Last reply Reply Quote 0
                        • W
                          winny1900 @rantanplan last edited by winny1900

                          @rantanplan
                          Danke das klappt soweit ganz gut. Er zeigt mir die Daten richtig an die oben im Text stehen. Der Text ändert sich ja nicht wenn sich der Zustand der Temp ändert. Habe ich doch richtig verstanden oder ?

                          Das heißt der müsste sich doch wenn sich die Temp aktualisiert einen neue Textzeile holen oder ?

                          rantanplan 1 Reply Last reply Reply Quote 0
                          • rantanplan
                            rantanplan @winny1900 last edited by rantanplan

                            @winny1900 sagte in Hilfe brauche ein Script:

                            @rantanplan
                            Danke das klappt soweit ganz gut. Er zeigt mir die Daten richtig an die oben im Text stehen. Der Text ändert sich ja nicht wenn sich der Zustand der Temp ändert. Habe ich doch richtig verstanden oder ?

                            Das heißt der müsste sich doch wenn sich die Temp aktualisiert einen neue Textzeile holen oder ?

                            Ich habe keinen Adapter der einen JSON liefert. Deshalb habe ich Deine Angabe in einen Text gepackt.
                            Da müsste Dein Datenpunkt von Deinem Adapter hin. Habe ich aber auch drüber kommentiert.

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

                              1234.PNG

                              So schauts aus und Klappt. Jedes mal wenn der Wert neu rein kommt wird neu geladen.

                              Danke das hätte ich so nicht hinbekommen !!!

                              Grüße

                              1 Reply Last reply Reply Quote 0
                              • rantanplan
                                rantanplan last edited by

                                Prima. Kannste aber noch "optimieren".
                                Setze bitte ein [gelöst] in Deinem ersten Beitrag-Titel.

                                W 1 Reply Last reply Reply Quote 0
                                • W
                                  winny1900 @rantanplan last edited by

                                  @rantanplan

                                  eine Frage noch dann ist es wohl Gelößt.

                                  Wie bekomme ich diese Zahl jetzt in VIS ?

                                  Ist das erste Blockly für mich in verbindung mit VIS.

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

                                    @winny1900 sagte:

                                    Wie bekomme ich diese Zahl jetzt in VIS ?

                                    Erstelle unter javascript.0 zwei Datenpunkte vom Typ Zahl. Die kannst Du in Vis anzeigen.
                                    Hier noch eine einfachere Variante in Blockly:

                                    Blockly_json_temp_hum.JPG

                                    <xml xmlns="http://www.w3.org/1999/xhtml">
                                      <variables>
                                        <variable type="" id="^qm4e^`2czKZoH]v$#fl">svalue</variable>
                                      </variables>
                                      <block type="comment" id="9n9v:t+^YMFN!FcVt%`," x="-412" y="37">
                                        <field name="COMMENT">mqtt.0.domoticz.in</field>
                                        <next>
                                          <block type="on_ext" id="GT`:hBV!3yxgm!|!K~71">
                                            <mutation items="1"></mutation>
                                            <field name="CONDITION">ne</field>
                                            <field name="ACK_CONDITION"></field>
                                            <value name="OID0">
                                              <shadow type="field_oid" id="QsKav`scUw[F2b`k4|:0">
                                                <field name="oid">default</field>
                                              </shadow>
                                            </value>
                                            <statement name="STATEMENT">
                                              <block type="variables_set" id="Oj_j6{/t`(UmgHca?z{h">
                                                <field name="VAR" id="^qm4e^`2czKZoH]v$#fl" variabletype="">svalue</field>
                                                <value name="VALUE">
                                                  <block type="lists_split" id="BWP{vz7kklj8g/$9Z9w1">
                                                    <mutation mode="SPLIT"></mutation>
                                                    <field name="MODE">SPLIT</field>
                                                    <value name="INPUT">
                                                      <block type="get_attr" id=".(zz43SmwgHL-7;k06`A">
                                                        <value name="PATH">
                                                          <shadow type="text" id="p3x_XG,@)4*`}n1$EPK!">
                                                            <field name="TEXT">svalue</field>
                                                          </shadow>
                                                        </value>
                                                        <value name="OBJECT">
                                                          <block type="on_source" id="{ci9/]DbojUFy#dg!346">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="DELIM">
                                                      <shadow type="text" id="mVDhf?jm!P!+1axeKFt7">
                                                        <field name="TEXT">;</field>
                                                      </shadow>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="comment" id="vlRRKrcDW%0k~i/!$qCg">
                                                    <field name="COMMENT">Temperatur</field>
                                                    <next>
                                                      <block type="update" id="bEl[~{A}71F!?sOPMSE#">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">Object ID</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="convert_tonumber" id="q4kt:./.w7)aJ@R]Hrdm">
                                                            <value name="VALUE">
                                                              <block type="lists_getIndex" id="c{lQ3iLBC_o=6LI!9r7j">
                                                                <mutation statement="false" at="true"></mutation>
                                                                <field name="MODE">GET</field>
                                                                <field name="WHERE">FROM_START</field>
                                                                <value name="VALUE">
                                                                  <block type="variables_get" id="C.*hD-!6honAqqOr`{uk">
                                                                    <field name="VAR" id="^qm4e^`2czKZoH]v$#fl" variabletype="">svalue</field>
                                                                  </block>
                                                                </value>
                                                                <value name="AT">
                                                                  <block type="math_number" id="j}{GiOwS*(,Zgm2]Kcr:">
                                                                    <field name="NUM">1</field>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="comment" id="7:hpc2shYp-{jw${9Owx">
                                                            <field name="COMMENT">Luftfeuchtigkeit</field>
                                                            <next>
                                                              <block type="update" id="zJiYj1wb9T6W[3{b:ip}">
                                                                <mutation delay_input="false"></mutation>
                                                                <field name="OID">Object ID</field>
                                                                <field name="WITH_DELAY">FALSE</field>
                                                                <value name="VALUE">
                                                                  <block type="convert_tonumber" id="59Kp#ayU+-[lR:fq23M8">
                                                                    <value name="VALUE">
                                                                      <block type="lists_getIndex" id="uJH|GQie1lqx|6%EqSpH">
                                                                        <mutation statement="false" at="true"></mutation>
                                                                        <field name="MODE">GET</field>
                                                                        <field name="WHERE">FROM_START</field>
                                                                        <value name="VALUE">
                                                                          <block type="variables_get" id="!2HC:9{c}JjO~-b?(bV}">
                                                                            <field name="VAR" id="^qm4e^`2czKZoH]v$#fl" variabletype="">svalue</field>
                                                                          </block>
                                                                        </value>
                                                                        <value name="AT">
                                                                          <block type="math_number" id="G,t04Tbinp}-ph0J;r|~">
                                                                            <field name="NUM">2</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </statement>
                                          </block>
                                        </next>
                                      </block>
                                    </xml>
                                    
                                    

                                    W 1 Reply Last reply Reply Quote 1
                                    • W
                                      winny1900 last edited by

                                      12345.PNG

                                      Der ansatz ist doch richtig. Der soll den wert in den neu angelegten Datenpunkt schreiben. Wenn ich da Liste eintrage schreibt der mir 3 Werte da rein.
                                      Wie bekomme ich das gelößt ?

                                      Ich mus auf jedenfall einen zweiten schreibe Block hinzufügen der mit ID Luftfeuchte.

                                      Grüße

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

                                        @winny1900 sagte:

                                        zweiten schreibe Block hinzufügen der mit ID Luftfeuchte.

                                        Schau mal in den Post davor: Die Variable Liste heißt dort svalue.

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

                                          @paul53

                                          bei aktualisiere Objekt ID kommt domoticz rein oder ?

                                          Weil das Script bei mir nicht läuft.

                                          17:30:05.712 error javascript.0 script.js.common.Test_2: Cannot get svalue of undefined
                                          17:30:05.713 error javascript.0 at Object.<anonymous> (script.js.common.Test_2:7:35)

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

                                            @winny1900 sagte in Hilfe brauche ein Script:

                                            bei aktualisiere Objekt ID kommt domoticz rein oder ?

                                            Nein, beim ersten kommt die ID des Datenpunktes für die Temperaturanzeige und beim zweiten für die Feuchteanzeige rein (steht im Kommentar darüber). domoticz/in kommt beim Trigger rein.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            971
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            6
                                            31
                                            1252
                                            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