Ich habe die Codeabfrage nun auf Basis von @paul53 nochmal etwas überarbeitet.
Nun wird der "code" erst geprüft, wenn die code länge (Anzahl der Eingabe) komplett ist. Im Beispiel 4
Wird mitten in der Eingabe abgebrochen, dann wird die Eingabe ebenfalls nach 4 Sekunden resettet.
Hier der Screenshot:
Bildschirmfoto 2021-05-05 um 11.40.23.png
und im Spoiler der code für den blockly Import:
Spoiler
<xml xmlns="
https://developers.google.com/blockly/xml">
<variables>
<variable id="fZpa$[L$,GDGdQ|yeR}h">code</variable>
<variable type="timeout" id="Tastereingabe_timeout">Tastereingabe_timeout</variable>
</variables>
<block type="variables_set" id="3a0Dkgszm_ei=Sx~hg3S" x="-62" y="-113">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="VALUE">
<block type="text" id="z4CP0MeVg3P1N6RM]]V4">
<field name="TEXT"></field>
</block>
</value>
<next>
<block type="comment" id="7O@::zc.QOzDb.EM^x)F">
<field name="COMMENT">Taste 1</field>
<next>
<block type="on_ext" id="e_SVlyA$JM:qbjs6/S]">
<mutation xmlns="
http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">true</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="Ro1y{wh]CaS@c!5csPYB">
<field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_1</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="timeouts_cleartimeout" id="sxj0;T@aM6tz)R)zx7zS">
<field name="NAME">Tastereingabe_timeout</field>
<next>
<block type="text_append" id="8,8wgI;K9C@[A//LEn$Z">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="TEXT">
<shadow type="text" id=",vGD|V%f8-9M7+~+?cc~">
<field name="TEXT">1</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="nxVw1FeSxQtw#LBHEwn"> <mutation name="Tastereingabe_timeout"></mutation> <next> <block type="procedures_callnoreturn" id="u.S/S::}A*:k){@/g2@+"> <mutation name="Code auswerten"></mutation> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="l9DC94X0[hxR{j!EGkFS"> <field name="COMMENT">Taste 2</field> <next> <block type="on_ext" id="}}X]|J_BflsP0BCCjm]J"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="-KRnc}gJ;n,y*VKkp{@-"> <field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_2</field> </shadow> </value> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="6DF*@+uBG.[XiNM4WL=">
<field name="NAME">Tastereingabe_timeout</field>
<next>
<block type="text_append" id="FI,xjI48N)D6F{BrxFV"> <field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field> <value name="TEXT"> <shadow type="text" id="qs$3upW0DyUJC45crYmz"> <field name="TEXT">2</field> </shadow> </value> <next> <block type="procedures_callnoreturn" id="NjF*YmX10XgPCJzo=}}/"> <mutation name="Tastereingabe_timeout"></mutation> <next> <block type="procedures_callnoreturn" id="yOc$rEeFQzB-eV#ZwkhB"> <mutation name="Code auswerten"></mutation> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="VtSZbvdzielc9DFb1M.">
<field name="COMMENT">Taste 3</field>
<next>
<block type="on_ext" id="o0ha-.@$gG7p|%ss^=g$">
<mutation xmlns="
http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">true</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="++Pt{=lQj)F$hNc.c{/"> <field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_3</field> </shadow> </value> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="ZMOM[u=1T|KGNfX4zEo">
<field name="NAME">Tastereingabe_timeout</field>
<next>
<block type="text_append" id="K9S=z;a;Mj)E[=$J?OOi">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="TEXT">
<shadow type="text" id="YWS@-.:b8)x]Dc5a/b=">
<field name="TEXT">3</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="R$os0/q|@Fl.Fuj*H/N"> <mutation name="Tastereingabe_timeout"></mutation> <next> <block type="procedures_callnoreturn" id=")!s~?t7A=-W6VEOE|u3X"> <mutation name="Code auswerten"></mutation> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="=:mK7xT(1rUIL90E(b}k"> <field name="COMMENT">Taste 4</field> <next> <block type="on_ext" id="B9mlf,oP@siAaMZjYkkh"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="0hV-)zEcc*{_;~A+yEG."> <field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_4</field> </shadow> </value> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="k?eZt1-CM8cr$|MzZTT_"> <field name="NAME">Tastereingabe_timeout</field> <next> <block type="text_append" id="!_aes.)@oFwt*sNJQ+J;"> <field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field> <value name="TEXT"> <shadow type="text" id="w~boH]BBxMvzJ=CL#i|T"> <field name="TEXT">4</field> </shadow> </value> <next> <block type="procedures_callnoreturn" id="eIDCn]h@[^Oo[I/#koFK"> <mutation name="Tastereingabe_timeout"></mutation> <next> <block type="procedures_callnoreturn" id="QWR%I%{D^QJqq)SoPhW">
<mutation name="Code auswerten"></mutation>
</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>
<block type="comment" id="iUR;PQ%ukEXLZ)~Vs|mU" x="387" y="-88">
<field name="COMMENT">Taste 5</field>
<next>
<block type="on_ext" id="v4CPn*]rX:l(1WOz$M)"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="jrMkQ)J)T$duo+AhXH^r"> <field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_5</field> </shadow> </value> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="ORe@J%jm)1vW{WU!ORSt"> <field name="NAME">Tastereingabe_timeout</field> <next> <block type="text_append" id="_Cu!c-.z5%~+0$e#W;w9"> <field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field> <value name="TEXT"> <shadow type="text" id="5AOTIv5wR{QGrUYH#iUo"> <field name="TEXT">5</field> </shadow> </value> <next> <block type="procedures_callnoreturn" id="p)oAtA#Edxn@%r1X%Z}m"> <mutation name="Tastereingabe_timeout"></mutation> <next> <block type="procedures_callnoreturn" id="6(e%,_0Bk-t7oW($^_(Y"> <mutation name="Code auswerten"></mutation> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="us~4LB9*z{yKcw$bR^+k"> <field name="COMMENT">Taste 6</field> <next> <block type="on_ext" id="ONK]THi}k=;+.zMj*2yv"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="wVR|}!dYvn;J=vrnz$]D"> <field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_6</field> </shadow> </value> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="i!0OtfNn2/eF+a,=%H+-"> <field name="NAME">Tastereingabe_timeout</field> <next> <block type="text_append" id="y][eaI{Ed^zJOT/(WHR">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="TEXT">
<shadow type="text" id="}4Q:ZDf?)HWDDa-SH16S">
<field name="TEXT">6</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="pcy8Z?u=QmB%/eNAIj*)">
<mutation name="Tastereingabe_timeout"></mutation>
<next>
<block type="procedures_callnoreturn" id="5ucyI_U5yRb-=SlQS?kh">
<mutation name="Code auswerten"></mutation>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="comment" id="v09@0|,fyLQ/hLF%Ek00">
<field name="COMMENT">Taste 7</field>
<next>
<block type="on_ext" id="o4f[jUi9?R=gbgnW0,7a">
<mutation xmlns="
http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">true</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="4oiiX3osXrGNu/Ta-!LW">
<field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_7</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="timeouts_cleartimeout" id="Qi.~iGV=|iWM|ps]W5p">
<field name="NAME">Tastereingabe_timeout</field>
<next>
<block type="text_append" id="jZ^xoJOQ5ohPcfd2U@S">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="TEXT">
<shadow type="text" id="D1MpxdhmLP/^[h+=n/ck">
<field name="TEXT">7</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="M/+aCAe#/$Kxw+b|B._"> <mutation name="Tastereingabe_timeout"></mutation> <next> <block type="procedures_callnoreturn" id="q1=Tv^%{R+$K|j_I^[(">
<mutation name="Code auswerten"></mutation>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="comment" id="uO~fBOCx;~Iu3Mddm?"> <field name="COMMENT">Taste 8</field> <next> <block type="on_ext" id="zSoXfN(wJ.mO*Hl^pYs1"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="Jc;Uz|=8tAQ.xRTR_:vd"> <field name="oid">knx.0.Sensoren.UG.Codeschloss_Taste_8</field> </shadow> </value> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="5hRDVfv1(A4s;Vqoo}z">
<field name="NAME">Tastereingabe_timeout</field>
<next>
<block type="text_append" id="((Ee-p)|o?GIFG?]IOw-">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="TEXT">
<shadow type="text" id="rc)?o;2k^GnQUx?X4rR%">
<field name="TEXT">8</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="H!ABSsrYTDTN}dvi#$T,">
<mutation name="Tastereingabe_timeout"></mutation>
<next>
<block type="procedures_callnoreturn" id="tGg$q~HW~FXuzT%,p%0d">
<mutation name="Code auswerten"></mutation>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<block type="procedures_defnoreturn" id="xAeTBD2!1A+j!+fuYz(9" x="862" y="-87">
<field name="NAME">Tastereingabe_timeout</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="timeouts_settimeout" id="D9Yiug;LTB3XfOehNa"> <field name="NAME">Tastereingabe_timeout</field> <field name="DELAY">4</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="variables_set" id="VWp)Y$%{b0ly[TozoK"> <field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field> <value name="VALUE"> <block type="text" id="ITIl{RYEe%J8.;|;Y0x~"> <field name="TEXT"></field> </block> </value> </block> </statement> </block> </statement> </block> <block type="procedures_defnoreturn" id="]w2o%mA..K[lO=}1@.qd" x="863" y="63"> <field name="NAME">Code auswerten</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="controls_if" id="v%$cmyMVU4Ffbf!C-|w5"> <value name="IF0"> <block type="logic_compare" id="w;03AtcZV*)mw^O@Ss)H"> <field name="OP">EQ</field> <value name="A"> <block type="text_length" id="7VlneYG9f6wptV/7Napt"> <value name="VALUE"> <shadow type="text" id="zrkQ:=(XB_nN:%R/8^Cu"> <field name="TEXT">abc</field> </shadow> <block type="variables_get" id="oNV2M$9RucpDjYLTFnN,"> <field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field> </block> </value> </block> </value> <value name="B"> <block type="math_number" id="~4qhmjxFIV{41lq?wYn4"> <field name="NUM">4</field> </block> </value> </block> </value> <statement name="DO0"> <block type="controls_if" id="#xu}-a=7A8gE5S[,sO72"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="S?E;SH}!C=IOsso=UFsJ"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="rp2B@m1(D:dC}=n_V!/?"> <field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field> </block> </value> <value name="B"> <block type="text" id="Pe+)+rXrUuVwms?6xTzu"> <field name="TEXT">2425</field> </block> </value> </block> </value> <statement name="DO0"> <block type="comment" id="-L**-:A:kfL6rl#km~I">
<field name="COMMENT">Code OK: Aktion ausführen</field>
</block>
</statement>
<statement name="ELSE">
<block type="comment" id="C=317it,8oB}45)@IvJX">
<field name="COMMENT">Code falsch: Aktion ausführen</field>
</block>
</statement>
<next>
<block type="variables_set" id="ZdJFauga~RJfcLSzV4qo">
<field name="VAR" id="fZpa$[L$,GDGdQ|yeR}h">code</field>
<value name="VALUE">
<block type="text" id=".Hy53;$0$v*C(U8}VNeA">
<field name="TEXT"></field>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</xml>