NEWS
[gelöst] Prozentuale Abweichung per Blockly
-
Hallo,
ich bräuchte mal eure Hilfe. Ich habe einen Wemos D1 mit Tasmota geflasht und daran einen JSN-SR04T zur Distanz-Meldung. Damit ermitteln ich die Höhe des Wasserstand im Tank. Das funktioniert soweit; auch die Umrechnung in Liter. Da der SR04 allerdings auch manchmal etwas bei der Entfernungsmessung springt möchte ich gerne eine Abfrage einbauen, welche Abweichungen der aktuellen Messung zur gespeicherten vorherigen Messung ab einer gewissen Größe herausfiltern. Er soll dann also keine Berechnung ausführen und auf die nächste Messung nah 5 Minuten warten. In den Variablen speichere ich sowohl die Distanz als auch das berechnete Litervolumen. Die Abweichungen bei der Messung können positiv wie negativ sein.
Wie kann ich dies in Blockly umsetzen?Grüße
Micha<xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="G`U+oiRG+HUjtH?o^G=-">Distance_min</variable> <variable type="" id="c2plL]pMvb5TCurO0603">Distance_max</variable> <variable type="" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</variable> <variable type="" id="UI^P)(I-;}(x?lc@,LNq">Number_of_Tanks</variable> <variable type="" id="bO1B3^Z{7S_zcIxfG+.*">Tankvolume_max</variable> <variable type="undefined" id="timeout">timeout</variable> <variable type="" id="42PvN3W_TzVSZcGYd+G]">Volume</variable> <variable type="" id="u|W0By(tUCK][m1XJHR?">Volume_Percent</variable> </variables> <block type="on_ext" id="R)1E`t;L4g_jb/ECYX1R" x="94" y="32"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="9;N^GmhI_N_,LY:Ke63H"> <field name="oid">sonoff.0.DVES_4A4D4D.SR04_Distance</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="vWnc2kkdhi%r!k,}.^1+"> <field name="COMMENT">max.Volume bei 20cm</field> <next> <block type="variables_set" id="`K/N4k:9gql~IS?W]$rR"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-" variabletype="">Distance_min</field> <value name="VALUE"> <block type="math_number" id=":a,vd*z;DhA{SS.Nms[G"> <field name="NUM">20</field> </block> </value> <next> <block type="comment" id="XTV$pY{jlg9l3gZNI_uh"> <field name="COMMENT">min.Volume bei 109cm</field> <next> <block type="variables_set" id="N/,i%}r/d{s_k8Ks!O)a"> <field name="VAR" id="c2plL]pMvb5TCurO0603" variabletype="">Distance_max</field> <value name="VALUE"> <block type="math_number" id="GV-m!L2o53f@doOLdm7/"> <field name="NUM">109</field> </block> </value> <next> <block type="comment" id="qp_2$9#A;^OGD^OC-ETS"> <field name="COMMENT">aktuelle Distance</field> <next> <block type="variables_set" id="R_}6t$@c|vA(jWx4OJ_m"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> <value name="VALUE"> <block type="math_round" id="IBb41H7k8Wt4rqgZ(AD2"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="K+MPBm%l0-@bddD8Q)9["> <field name="NUM">3.1</field> </shadow> <block type="get_value" id="Q2WKcs1LH_Ddu;qJq#:^"> <field name="ATTR">val</field> <field name="OID">sonoff.0.DVES_4A4D4D.SR04_Distance</field> </block> </value> </block> </value> <next> <block type="comment" id="m{at7W0VoJ-7h#*VAr8j"> <field name="COMMENT">max. Volume Überlauf</field> <next> <block type="variables_set" id="R,4zN(fs{j?.Bw#G}pAG"> <field name="VAR" id="UI^P)(I-;}(x?lc@,LNq" variabletype="">Number_of_Tanks</field> <value name="VALUE"> <block type="math_number" id="iN`faV*[dxZ/MTFYK2oR"> <field name="NUM">2</field> </block> </value> <next> <block type="variables_set" id="V)AQ_fHMbPKJR{eRhF6k"> <field name="VAR" id="bO1B3^Z{7S_zcIxfG+.*" variabletype="">Tankvolume_max</field> <value name="VALUE"> <block type="math_number" id=",:Ul~:(rjtxN|rFI1F#$"> <field name="NUM">900</field> </block> </value> <next> <block type="timeouts_settimeout" id="Z,3B}3EvICr{zyg+~ky8"> <field name="NAME">timeout</field> <field name="DELAY">100</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="6NYpiij2dQ}xIeN%)Hz`"> <field name="COMMENT">Berechnung des Volumens</field> <comment pinned="false" h="32" w="807">Anzahl der Tanks * ((Sensor-MaxWert - gemessene Entfernung) * (Überlaufvolumen / Sensor-Überlaufwert))</comment> <next> <block type="controls_if" id="LhH-]aQW)YK=wDdIT/QC"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="Kf.?EDS8;DxgamldEx8A"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="}s)-i*N2/mZs[/]VcPuC"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> <value name="B"> <block type="variables_get" id=".Qr,lOjq|/u4N1o2m4VN"> <field name="VAR" id="c2plL]pMvb5TCurO0603" variabletype="">Distance_max</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="rktTG:CxV62.2O!Msk^q"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> <value name="VALUE"> <block type="variables_get" id="QQHgodwL{`Dv(_Yl%n)9"> <field name="VAR" id="c2plL]pMvb5TCurO0603" variabletype="">Distance_max</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="8u6#dd2uf:vTXbWc$90*"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="_p+y#G86BBHboNa3mR)$"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> <value name="B"> <block type="variables_get" id="BA^d04|j!_z@g_+if*nx"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-" variabletype="">Distance_min</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="]-L40cEqvr-c{-??h|[R"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> <value name="VALUE"> <block type="variables_get" id="1^QUN.=W?tQo,[06cT|5"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-" variabletype="">Distance_min</field> </block> </value> </block> </statement> <next> <block type="control" id="-*yO?G;`EhJjFG{wntkd"> <mutation delay_input="false"></mutation> <field name="OID">0_userdata.0.Wassertank.Distance</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="6^v_$/WaL^PWLLNu]/`T"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> <next> <block type="variables_set" id="Cj4Lkc0W[Mh3,%/6%y%-"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]" variabletype="">Volume</field> <value name="VALUE"> <block type="math_round" id=")2jP`:(9;vXy6gDBn}kF"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="$k`BKynjP!A*Ef-(|WUF"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="-mnTjvl=@A}]i.m+)B$E" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="c45VmR{.n{!G~+Yz`9sK"> <field name="VAR" id="UI^P)(I-;}(x?lc@,LNq" variabletype="">Number_of_Tanks</field> </block> </value> <value name="B"> <shadow type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=":7,_8}cAb1L.h{WrC+N7" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="vR`}ckgVq1bjfhhYi;`8"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=";]XRB_KnTIPlecr]#)hC" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="#Dv%6uSxw(]j$Jo-N[iJ"> <field name="VAR" id="c2plL]pMvb5TCurO0603" variabletype="">Distance_max</field> </block> </value> <value name="B"> <shadow type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="DN30zujI:NE^qP[sp7Ep"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="}0-{_!q0}XpvgQ5p:8]?"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="KedQp8XYI+YLV2s0d7w." inline="false"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="g7j__ULI|5M^P31]z)`{"> <field name="VAR" id="bO1B3^Z{7S_zcIxfG+.*" variabletype="">Tankvolume_max</field> </block> </value> <value name="B"> <shadow type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="~nS@;,gC]6bTohrT9qfr" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="7Dt?,s4USr4i@*zU;q;I"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="9vDgZ[h!oxl1/:sVgC=a"> <field name="VAR" id="c2plL]pMvb5TCurO0603" variabletype="">Distance_max</field> </block> </value> <value name="B"> <shadow type="math_number" id="lx,q6PiKhwAbN(1/c$Cx"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="SI%{i/n4q{/%;_dY;[m]"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-" variabletype="">Distance_min</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="{p4wDEoY{3b-6A~5Q]r*"> <field name="VAR" id="u|W0By(tUCK][m1XJHR?" variabletype="">Volume_Percent</field> <value name="VALUE"> <block type="math_round" id=":[*Z}Zi^_pZv:x}xolME"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="$k`BKynjP!A*Ef-(|WUF"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="(LnTL+F1RqjvQ~hW{];2" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">0</field> </shadow> <block type="math_arithmetic" id="Gl23k`VD6u,({Z4rcqbG" inline="false"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="IkId^}l/4cSZxpCCOk67"> <field name="NUM">1</field> </shadow> <block type="variables_get" id=",shbnSBxa9YOF}@=+h*q"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]" variabletype="">Volume</field> </block> </value> <value name="B"> <shadow type="math_number" id="sHU$TcHI[uVaOY:^p`V3"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="%lBO/,QscV}_Jj_So)[{" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="vR`}ckgVq1bjfhhYi;`8"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="nJWjrpALk=S{E(_EOJUv"> <field name="VAR" id="UI^P)(I-;}(x?lc@,LNq" variabletype="">Number_of_Tanks</field> </block> </value> <value name="B"> <shadow type="math_number" id="}0-{_!q0}XpvgQ5p:8]?"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="/VY0rg|EG8BNmG~vOw^k"> <field name="VAR" id="bO1B3^Z{7S_zcIxfG+.*" variabletype="">Tankvolume_max</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="math_number" id="{%M.FtJS4xvrYQNdEnl["> <field name="NUM">100</field> </block> </value> </block> </value> </block> </value> <next> <block type="control" id="zn[8!]!#198fyLd)%~-]"> <mutation delay_input="false"></mutation> <field name="OID">0_userdata.0.Wassertank.Volume</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id=",^pF);KNYtnp}C?xB7w^"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]" variabletype="">Volume</field> </block> </value> <next> <block type="control" id="RYr`M{dQHta7bQT{`ZFn"> <mutation delay_input="false"></mutation> <field name="OID">0_userdata.0.Wassertank.Volume_Percent</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="PBz?#JvNe$E`M^Nqj5[p"> <field name="VAR" id="u|W0By(tUCK][m1XJHR?" variabletype="">Volume_Percent</field> </block> </value> <next> <block type="debug" id="C5Bm[F#kVzakN.LV+gTv"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="*xh{m{6{:yX`g_LA$fh]"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="JGcxC/9YDv8o`]VN#@3:"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="wPQSWIH7!w-JEm$U|7}t"> <field name="TEXT">Abweichung: </field> </block> </value> <value name="ADD1"> <block type="math_arithmetic" id="`jgg_k^_OEf6cu:Se-Rq"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="Sr/;i:thO3DppD6{~A|b"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="@/~aG0Vmo|L@YXj.[_ER"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="ox1nF)/GV5kgwE-NL`3i"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="smXw6Kgx6cQKcDA@~APV"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="[gU.C$Aajs1TGnT-:`Uk"> <field name="NUM">1</field> </shadow> <block type="get_value" id="i%9BTEFI^Ew]Dv$9~+^d"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> <value name="B"> <shadow type="math_number" id="Nm1)Mo9R*LTKmUYc7HA7"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="IrwIP0,ElAl~3yNGv,6)"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="j!gF``A:s?pRsLd:@weh"> <field name="NUM">1</field> </shadow> <block type="get_value" id="#Pg%K/$rl[G$eZP?]`.J"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="%moo=JF$.]B/7shv#z}C"> <field name="NUM">100</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="debug" id="u}^P.I*k{;Qpw+V]H1A)" disabled="true"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="*xh{m{6{:yX`g_LA$fh]"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="8XN}d.:]S59@j7Kyr*2("> <mutation items="9"></mutation> <value name="ADD0"> <block type="text" id="vhH*M-S,6e;^s_wbI_(7"> <field name="TEXT">Volume: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="B]Y*sW^o!/m7,}M`7+=p"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]" variabletype="">Volume</field> </block> </value> <value name="ADD2"> <block type="text" id="6~=r4|)|~3L{qVaQ#I7?"> <field name="TEXT"> Liter (</field> </block> </value> <value name="ADD3"> <block type="variables_get" id="%4wSHH?G^eS`bC|_me7~"> <field name="VAR" id="u|W0By(tUCK][m1XJHR?" variabletype="">Volume_Percent</field> </block> </value> <value name="ADD4"> <block type="text" id="COMDp4})d!4:Rwc?Q|@$"> <field name="TEXT"> %, Distance: </field> </block> </value> <value name="ADD5"> <block type="variables_get" id="g4P/t$H(cloa-ev$~bJv"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> <value name="ADD6"> <block type="text" id="7pqB[84^z}NAR-o4_aM8"> <field name="TEXT">)</field> </block> </value> <value name="ADD7"> <block type="text" id="PUp!cCkXL?k}^C6!]f;r"> <field name="TEXT">, Abweichung: </field> </block> </value> <value name="ADD8"> <shadow type="math_number" id="jJ3grm4f*kYe0Hjd~|@B"> <field name="NUM">9</field> </shadow> <block type="math_round" id="$B}[gN*INmY#l=@)ou5Z"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="5nNk7;T)?iR*8QEV_aqe"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="(?l5i/9,VHo?KFIkUNM$"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="Sr/;i:thO3DppD6{~A|b"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="ycY*Rcb;RD+c)]RB!Q!n"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="hSAewZ].8tjltZJi_)qe"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="Nm1)Mo9R*LTKmUYc7HA7"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="SP3#KGG7o~lWX-o.nj=Q"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="ox1nF)/GV5kgwE-NL`3i"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="=x{Bd6P.~=E*^0Xm}=YP"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d" variabletype="">Distance_actual</field> </block> </value> <value name="B"> <shadow type="math_number" id="j!gF``A:s?pRsLd:@weh"> <field name="NUM">1</field> </shadow> <block type="get_value" id="HE%Wk=y?UbHj]*w#I!_F"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="uNmz7[zjjXc@Nvd1dXm="> <field name="NUM">100</field> </shadow> </value> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@steimi sagte:
manchmal etwas bei der Entfernungsmessung springt
Du möchtest Ausreißer ausblenden ? Vielleicht so:
-
ja, genau die Ausreißer möchte ich wegfilter. Und genau die Funktion 'Betrag' hatte ich gesucht. Danke, ich werde testen.
-
@steimi steimi Ich bin auch gerade dabei meinen Füllstand zu erfassen. Hast du das mit den "Ausreiser" und der Berechnung in Liter hinbekommen? Könntest du mir dein fertiges Blockly mal schicken.
Gruß Basti -
@Basti97 zumindest hab eich eine Lösung die für meine Ansprüche reicht
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="G`U+oiRG+HUjtH?o^G=-">Distance_min</variable> <variable id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</variable> <variable id="c2plL]pMvb5TCurO0603">Distance_max</variable> <variable id="42PvN3W_TzVSZcGYd+G]">Volume</variable> <variable id="u|W0By(tUCK][m1XJHR?">Volume_Percent</variable> <variable id="UI^P)(I-;}(x?lc@,LNq">Number_of_Tanks</variable> <variable id="bO1B3^Z{7S_zcIxfG+.*">Tankvolume_max</variable> <variable type="timeout" id="timeout">timeout</variable> </variables> <block type="on_ext" id="R)1E`t;L4g_jb/ECYX1R" x="13" y="13"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="9;N^GmhI_N_,LY:Ke63H"> <field name="oid">sonoff.0.DVES_4A4D4D.SR04_Distance</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="vWnc2kkdhi%r!k,}.^1+"> <field name="COMMENT">max.Volume bei 20cm</field> <next> <block type="variables_set" id="`K/N4k:9gql~IS?W]$rR"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-">Distance_min</field> <value name="VALUE"> <block type="math_number" id=":a,vd*z;DhA{SS.Nms[G"> <field name="NUM">20</field> </block> </value> <next> <block type="comment" id="XTV$pY{jlg9l3gZNI_uh"> <field name="COMMENT">min.Volume bei 107cm</field> <next> <block type="variables_set" id="N/,i%}r/d{s_k8Ks!O)a"> <field name="VAR" id="c2plL]pMvb5TCurO0603">Distance_max</field> <value name="VALUE"> <block type="math_number" id="GV-m!L2o53f@doOLdm7/"> <field name="NUM">107</field> </block> </value> <next> <block type="comment" id="qp_2$9#A;^OGD^OC-ETS"> <field name="COMMENT">aktuelle Distance</field> <next> <block type="variables_set" id="R_}6t$@c|vA(jWx4OJ_m"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> <value name="VALUE"> <block type="math_round" id="IBb41H7k8Wt4rqgZ(AD2"> <field name="OP">ROUND</field> <value name="NUM"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="K+MPBm%l0-@bddD8Q)9["> <field name="NUM">3.1</field> </shadow> <block type="convert_tonumber" id="Y{#9;4vNk!3F2@TTN+al"> <value name="VALUE"> <block type="get_value" id="Q2WKcs1LH_Ddu;qJq#:^"> <field name="ATTR">val</field> <field name="OID">sonoff.0.DVES_4A4D4D.SR04_Distance</field> </block> </value> </block> </value> </block> </value> <next> <block type="comment" id="m{at7W0VoJ-7h#*VAr8j"> <field name="COMMENT">max. Volume Überlauf</field> <next> <block type="variables_set" id="R,4zN(fs{j?.Bw#G}pAG"> <field name="VAR" id="UI^P)(I-;}(x?lc@,LNq">Number_of_Tanks</field> <value name="VALUE"> <block type="math_number" id="iN`faV*[dxZ/MTFYK2oR"> <field name="NUM">2</field> </block> </value> <next> <block type="variables_set" id="V)AQ_fHMbPKJR{eRhF6k"> <field name="VAR" id="bO1B3^Z{7S_zcIxfG+.*">Tankvolume_max</field> <value name="VALUE"> <block type="math_number" id=",:Ul~:(rjtxN|rFI1F#$"> <field name="NUM">900</field> </block> </value> <next> <block type="timeouts_cleartimeout" id="%e(aA|6?:k%5OB9a{BV5"> <field name="NAME">timeout</field> <next> <block type="timeouts_settimeout" id="Z,3B}3EvICr{zyg+~ky8"> <field name="NAME">timeout</field> <field name="DELAY">1</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="controls_if" id="2B2)+,_(KR5rp1PK!ss6"> <value name="IF0"> <block type="logic_compare" id="U!9]enWK-*c4Fjx[9z,M"> <field name="OP">LT</field> <value name="A"> <block type="math_single" id="~lt/Eu#jDFm2?@fv2Igz"> <field name="OP">ABS</field> <value name="NUM"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="iLWbt+b..)Nsd(k#h|SY"> <field name="NUM">9</field> </shadow> <block type="math_arithmetic" id="CRP`},)_x6~q;~1LWJ){"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="Sr/;i:thO3DppD6{~A|b"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=":lk3ieVAkkyWZGNWCTa?"> <field name="OP">DIVIDE</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="ox1nF)/GV5kgwE-NL`3i"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="T0(q{!}?%Z^*fBP:ZwC?"> <field name="OP">MINUS</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="[gU.C$Aajs1TGnT-:`Uk"> <field name="NUM">1</field> </shadow> <block type="get_value" id="({oCnYW+MMAU*lMN*H!-"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="Nm1)Mo9R*LTKmUYc7HA7"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="MdN1GtSdmQAX.l$20Kpn"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="j!gF``A:s?pRsLd:@weh"> <field name="NUM">1</field> </shadow> <block type="get_value" id="Uj!nJU|#%m_MZeHx3:ny"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="OB8lS#LM^aCibjD5~M[w"> <field name="NUM">100</field> </shadow> </value> </block> </value> </block> </value> <value name="B"> <block type="math_number" id="$joNW.e$ez^DB;,}Ya^R"> <field name="NUM">10</field> </block> </value> </block> </value> <statement name="DO0"> <block type="comment" id="9bo;KD6r11}:Q.B%0y-G"> <field name="COMMENT">Berechnung der prozentualen Abweichung um Sprünge der Abstandsmessung abzufangen</field> <comment pinned="false" h="32" w="807">Anzahl der Tanks * ((Sensor-MaxWert - gemessene Entfernung) * (Überlaufvolumen / Sensor-Überlaufwert))</comment> <next> <block type="procedures_callnoreturn" id="9~pGs4Er]}lP*?E:^]rX"> <mutation name="Volume_berechnen"></mutation> <next> <block type="procedures_callnoreturn" id="Nl.!E~eOiPDX8MlCFrZ`"> <mutation name="Volume_schreiben"></mutation> </block> </next> </block> </next> </block> </statement> <next> <block type="procedures_callnoreturn" id="4Ep6D`/)V4H:xh*LncBT" disabled="true"> <mutation name="Volume_berechnen"></mutation> <next> <block type="procedures_callnoreturn" id="efC`MVyNl,`53/p)XazL" disabled="true"> <mutation name="Volume_schreiben"></mutation> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="_|y1_EoyUR:GGCG/q#Py" x="13" y="663"> <field name="NAME">Volume_berechnen</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="comment" id="6NYpiij2dQ}xIeN%)Hz`"> <field name="COMMENT">Berechnung des Volumens</field> <comment pinned="false" h="32" w="807">Anzahl der Tanks * ((Sensor-MaxWert - gemessene Entfernung) * (Überlaufvolumen / Sensor-Überlaufwert))</comment> <next> <block type="controls_if" id="LhH-]aQW)YK=wDdIT/QC"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="Kf.?EDS8;DxgamldEx8A"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="}s)-i*N2/mZs[/]VcPuC"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> <value name="B"> <block type="variables_get" id=".Qr,lOjq|/u4N1o2m4VN"> <field name="VAR" id="c2plL]pMvb5TCurO0603">Distance_max</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="rktTG:CxV62.2O!Msk^q"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> <value name="VALUE"> <block type="variables_get" id="QQHgodwL{`Dv(_Yl%n)9"> <field name="VAR" id="c2plL]pMvb5TCurO0603">Distance_max</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="8u6#dd2uf:vTXbWc$90*"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="_p+y#G86BBHboNa3mR)$"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> <value name="B"> <block type="variables_get" id="BA^d04|j!_z@g_+if*nx"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-">Distance_min</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="]-L40cEqvr-c{-??h|[R"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> <value name="VALUE"> <block type="variables_get" id="1^QUN.=W?tQo,[06cT|5"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-">Distance_min</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="@dpxZdoa8@fk3OJ0NoVM"> <value name="IF0"> <block type="logic_compare" id="^:^e-8MXX?o=TDVW1juC"> <field name="OP">NEQ</field> <value name="A"> <block type="get_value" id="n1oDbCb4Ut~nN;-^z6/1"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> <value name="B"> <block type="variables_get" id="rPQjKjrNG|FO$s9bkBa1"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="-*yO?G;`EhJjFG{wntkd"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Wassertank.Distance</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="6^v_$/WaL^PWLLNu]/`T"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> </block> </statement> <next> <block type="variables_set" id="Cj4Lkc0W[Mh3,%/6%y%-"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]">Volume</field> <value name="VALUE"> <block type="math_round" id=")2jP`:(9;vXy6gDBn}kF"> <field name="OP">ROUND</field> <value name="NUM"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="$k`BKynjP!A*Ef-(|WUF"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="-mnTjvl=@A}]i.m+)B$E" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="c45VmR{.n{!G~+Yz`9sK"> <field name="VAR" id="UI^P)(I-;}(x?lc@,LNq">Number_of_Tanks</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=":7,_8}cAb1L.h{WrC+N7" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="vR`}ckgVq1bjfhhYi;`8"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=";]XRB_KnTIPlecr]#)hC" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="#Dv%6uSxw(]j$Jo-N[iJ"> <field name="VAR" id="c2plL]pMvb5TCurO0603">Distance_max</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="DN30zujI:NE^qP[sp7Ep"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="}0-{_!q0}XpvgQ5p:8]?"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="KedQp8XYI+YLV2s0d7w." inline="false"> <field name="OP">DIVIDE</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="g7j__ULI|5M^P31]z)`{"> <field name="VAR" id="bO1B3^Z{7S_zcIxfG+.*">Tankvolume_max</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="~nS@;,gC]6bTohrT9qfr" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="7Dt?,s4USr4i@*zU;q;I"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="9vDgZ[h!oxl1/:sVgC=a"> <field name="VAR" id="c2plL]pMvb5TCurO0603">Distance_max</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="lx,q6PiKhwAbN(1/c$Cx"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="SI%{i/n4q{/%;_dY;[m]"> <field name="VAR" id="G`U+oiRG+HUjtH?o^G=-">Distance_min</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="{p4wDEoY{3b-6A~5Q]r*"> <field name="VAR" id="u|W0By(tUCK][m1XJHR?">Volume_Percent</field> <value name="VALUE"> <block type="math_round" id=":[*Z}Zi^_pZv:x}xolME"> <field name="OP">ROUND</field> <value name="NUM"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="$k`BKynjP!A*Ef-(|WUF"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="(LnTL+F1RqjvQ~hW{];2" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=".5a9p.Ih{Tm?D#F4XAh6"> <field name="NUM">0</field> </shadow> <block type="math_arithmetic" id="Gl23k`VD6u,({Z4rcqbG" inline="false"> <field name="OP">DIVIDE</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="IkId^}l/4cSZxpCCOk67"> <field name="NUM">1</field> </shadow> <block type="variables_get" id=",shbnSBxa9YOF}@=+h*q"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]">Volume</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="sHU$TcHI[uVaOY:^p`V3"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="%lBO/,QscV}_Jj_So)[{" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="vR`}ckgVq1bjfhhYi;`8"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="nJWjrpALk=S{E(_EOJUv"> <field name="VAR" id="UI^P)(I-;}(x?lc@,LNq">Number_of_Tanks</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="}0-{_!q0}XpvgQ5p:8]?"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="/VY0rg|EG8BNmG~vOw^k"> <field name="VAR" id="bO1B3^Z{7S_zcIxfG+.*">Tankvolume_max</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="WfJ3[+Ru=u,*/v|U!ih8"> <field name="NUM">1</field> </shadow> <block type="math_number" id="{%M.FtJS4xvrYQNdEnl["> <field name="NUM">100</field> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="u;Qur|{||Yxqsk3N70/=" x="13" y="1238"> <field name="NAME">Volume_schreiben</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="comment" id="C/#wLoY/P1T(-M]+nQ5$"> <field name="COMMENT">Setzen des aktuellen Volumens</field> <comment pinned="false" h="32" w="807">Anzahl der Tanks * ((Sensor-MaxWert - gemessene Entfernung) * (Überlaufvolumen / Sensor-Überlaufwert))</comment> <next> <block type="controls_if" id="tDHPBZg{LU#ci=v.kkJ."> <value name="IF0"> <block type="logic_compare" id="1@`%mVC,rc7L,ue:fIsl"> <field name="OP">NEQ</field> <value name="A"> <block type="get_value" id="%o9!Q2JFkgWr^GeqexnX"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Volume</field> </block> </value> <value name="B"> <block type="variables_get" id="=(XLwPqIE;wka}O|KNV;"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]">Volume</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="G6MxN.@C~lvw3tN(F@f1"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Wassertank.Volume</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="O)pB2,g@D(kD$Y^jJ6U$"> <field name="VAR" id="42PvN3W_TzVSZcGYd+G]">Volume</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="g1aiPq}=}mtLvSRkRa^E"> <value name="IF0"> <block type="logic_compare" id="~9GUYXyrNM#gV(+rEC^O"> <field name="OP">NEQ</field> <value name="A"> <block type="get_value" id="aE?zuc6W@~/ETa/e[f04"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Volume_Percent</field> </block> </value> <value name="B"> <block type="variables_get" id="gnaEj5/NIeSk1ci0v5$K"> <field name="VAR" id="u|W0By(tUCK][m1XJHR?">Volume_Percent</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="r50?|pOzt2=aa}3gU/rh"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Wassertank.Volume_Percent</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="N|lu}QV,Ne!3)x^+pPxd"> <field name="VAR" id="u|W0By(tUCK][m1XJHR?">Volume_Percent</field> </block> </value> </block> </statement> <next> <block type="debug" id="C5Bm[F#kVzakN.LV+gTv" disabled="true"> <field name="Severity">debug</field> <value name="TEXT"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="*xh{m{6{:yX`g_LA$fh]"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="JGcxC/9YDv8o`]VN#@3:"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="wPQSWIH7!w-JEm$U|7}t"> <field name="TEXT">Abweichung: </field> </block> </value> <value name="ADD1"> <block type="math_single" id="?p.MGJiuefF#vU[ZpqXQ"> <field name="OP">ABS</field> <value name="NUM"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="v7Lb5PH*hg70~|k2)b`B"> <field name="NUM">9</field> </shadow> <block type="math_arithmetic" id="`jgg_k^_OEf6cu:Se-Rq"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="Sr/;i:thO3DppD6{~A|b"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="@/~aG0Vmo|L@YXj.[_ER"> <field name="OP">DIVIDE</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="ox1nF)/GV5kgwE-NL`3i"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="smXw6Kgx6cQKcDA@~APV"> <field name="OP">MINUS</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="[gU.C$Aajs1TGnT-:`Uk"> <field name="NUM">1</field> </shadow> <block type="get_value" id="i%9BTEFI^Ew]Dv$9~+^d"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="Nm1)Mo9R*LTKmUYc7HA7"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="IrwIP0,ElAl~3yNGv,6)"> <field name="VAR" id="@QB)YM-?e#a$E:tKRB,d">Distance_actual</field> </block> </value> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="j!gF``A:s?pRsLd:@weh"> <field name="NUM">1</field> </shadow> <block type="get_value" id="#Pg%K/$rl[G$eZP?]`.J"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wassertank.Distance</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="%moo=JF$.]B/7shv#z}C"> <field name="NUM">100</field> </shadow> </value> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@steimi Danke für das Blockly. Ich gucke es mir morgen mal an.
Ich muss noch kleine Sachen ändern bzw an meine Bedürfnisse Anpassen. Aber es ist eine super voraussetzungslos.
Ein schönen Abend noch.