- Home
- Deutsch
- Skripten / Logik
- [Gelöst][Hilfe!] PIN Eingabe über Blockly
[Gelöst][Hilfe!] PIN Eingabe über Blockly
-
Re: Kleine Alarmanlage - mit Blockly?
Hallo,
habe mir das o.g. Script genommen und etwas angepasst.
Nun habe ich folgendes Problem:
Wenn ich 4 falsche Zahlen eingebe, hängt das Script bei der nächsten Zahleneingabe die erste Zahl an die letzten 4 an.
Danach wird als erste Zahl eine Null gesetzt, die ich aber nicht eingegeben habe.Danach muss ich das Script neu starten, weil eine richtige Eingabe nicht mehr funktioniert.
Die Log-Meldung:
javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 4 17:41:58.701 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 43 17:41:59.339 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 432 17:42:00.070 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 4321 17:42:00.070 info javascript.0 script.js.Alarm.Pincode: Alarmanlage ausgeschalten 17:42:49.608 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 6 17:42:50.200 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 65 17:42:51.025 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 658 17:42:51.314 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 6580 17:43:49.371 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 65801 17:43:49.371 info javascript.0 script.js.Alarm.Pincode: *****Zuviele Zeichen***** 17:43:50.034 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 02 17:43:50.639 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 023 17:43:51.440 info javascript.0 script.js.Alarm.Pincode: *****Eingabe -> 0234
Das Script dazu:
Wie kann man sowas abfangen?
Oder besser gesagt, warum passiert das?
Kann mir dabei jemand helfen? -
Hier noch ein paar Bilder vom Script.
Passt nicht alles auf ein Foto, deswegen geteilt.
-
@Superdad Das exportierte Blockly und deine Bilder stimmen iwie nicht überein.
Bei "getCode" zum beispiel hast du in der ersten Abfrage noch ein Und+Oder drin.Welches ist denn das aktuelle?
Ich würde den Datenpunkt TempCode nicht im Trigger mit einem Timeout setzten, sondern am Ende der "getCode" funktion.
Der Trigger ist auch seltsam.
Nach dem tastendruck setzt du die Taste wieder auf false. Der Trigger reagiert aber auf alles, was theoretisch eig den tastendruck zwei mal auslösen sollte (einmal wurde er auf true gesetzt in der VIS und einmal setzt du ihn zurück au false)
Hier würde ich vll mit "wurde aktualisiert" arbeiten und dann per obj.id herausfinden welcher gedrückt wurde. Dann ersparst du dir das zurück setzen.+Im exportierten Blockly setzt du den Wert von TempCode gibst aber keinen Wert an:
Ebenso würde ich die Variable tempCode nicht für "Pin richtig" missbrauchen und 3 Sekunden später zurücksetzen. Das kann sehr viele Probleme machen.
-
Ich hab das Skript mal angepasst und bei mit funktioniert es:
Hier mal der Export.
<xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="ITkif9wDtLGFs/#o[__}">obj</variable> <variable type="" id="[|vEnueG447)8;@ij4Z/">TastenWert</variable> <variable type="" id="2IVfkgYBTmV|ClF$JyY,">AnzahlVersuche</variable> <variable type="" id="-%t(A!B?L#Q@1F$nmfJ~">tempCode</variable> <variable type="" id="=fqAdNW+-;3@%drz;?sd">maxVersuche</variable> <variable type="undefined" id="timeout">timeout</variable> <variable type="undefined" id="timeout4">timeout4</variable> <variable type="" id="BahnYj{jlb#a:#W)#2M|">maxCodeLaenge</variable> <variable type="" id="niZ3//f$eX8LcKDOBbZV">CodeAnwesend</variable> <variable type="" id="^:-Xdw$Uu?.2I3~y[y=C">CodeAbwesend</variable> <variable type="undefined" id="timeout2">timeout2</variable> <variable type="undefined" id="timeout3">timeout3</variable> </variables> <block type="procedures_defnoreturn" id="O)q*?M8Hfa5)/}O6ZsZ7" x="1037" y="-213"> <field name="NAME">Initialisierung</field> <comment pinned="false" h="80" w="160">Bei Programmstart Werte vorgeben.</comment> <statement name="STACK"> <block type="variables_set" id="?L69j3%sRmc}([5G2X60"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="t]h/P`X7feEalP-;RDq_"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="wMeGQPHU)@|vwaJP%iqr"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="^J(t|s-ySqnJKRARc_:|"> <field name="TEXT"></field> </block> </value> <next> <block type="comment" id="_UZqDvMtW0LHk96L^T8z"> <field name="COMMENT">Maximale Fehlversuche festlegen</field> <next> <block type="variables_set" id="e663[k*hSCd%o_?sd(XA"> <field name="VAR" id="=fqAdNW+-;3@%drz;?sd" variabletype="">maxVersuche</field> <value name="VALUE"> <block type="math_number" id="{OjuYXvX(;:=T.oag~a#"> <field name="NUM">3</field> </block> </value> <next> <block type="comment" id="K(:;y-gihBx_:{%kJ~Oo"> <field name="COMMENT">Länge der Codes festlegen</field> <next> <block type="variables_set" id="BGt@+4h!d)Kco3]{`,)V"> <field name="VAR" id="BahnYj{jlb#a:#W)#2M|" variabletype="">maxCodeLaenge</field> <value name="VALUE"> <block type="math_number" id="|Wm^i`:C`~o0Bp7;,-yy"> <field name="NUM">4</field> </block> </value> <next> <block type="comment" id="ZgOwwPRCnNLM~@tR?DhB"> <field name="COMMENT">Liste der Codes</field> <next> <block type="comment" id="|9)F(1-)Murz[PAg@Pcz"> <field name="COMMENT">Beliebig erweiterbar. Auf Länge achten!</field> <next> <block type="variables_set" id=";~}[HtK6:wa8W/1,]j2a"> <field name="VAR" id="niZ3//f$eX8LcKDOBbZV" variabletype="">CodeAnwesend</field> <value name="VALUE"> <block type="text" id="/%k9:KVHUC2RVgH.:^v5"> <field name="TEXT">4321</field> </block> </value> <next> <block type="variables_set" id=";{0Vr(56Uhr:z8Cziv*C"> <field name="VAR" id="^:-Xdw$Uu?.2I3~y[y=C" variabletype="">CodeAbwesend</field> <value name="VALUE"> <block type="text" id="^di=V@V!cAe+WZiLfuL%"> <field name="TEXT">1234</field> </block> </value> <next> <block type="create" id="`Z+;K{8ZH$M`)Vh5[xKf"> <field name="NAME">Alarmsystem.PIN.Nummer_1</field> <value name="VALUE"> <block type="logic_boolean" id="pS,!ox}LkjT-%8l`d*rE"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="create" id="fKSJ~4u3b}F[~iX6uly0"> <field name="NAME">Alarmsystem.PIN.Nummer_2</field> <value name="VALUE"> <block type="logic_boolean" id="VzL$o*=!`2-(+x~|Kslq"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="create" id="#^mP#_]r+Y+5Q0S}UQWY"> <field name="NAME">Alarmsystem.PIN.Nummer_3</field> <value name="VALUE"> <block type="logic_boolean" id="#gcMM+0TFHp?Lp2_hte#"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="create" id="eU7|lo.1zrB8-*U~oQzJ"> <field name="NAME">Alarmsystem.PIN.Nummer_4</field> <value name="VALUE"> <block type="logic_boolean" id="v%[6$h|P}vE-1m[@3;We"> <field name="BOOL">FALSE</field> </block> </value> </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> </statement> </block> <block type="on_ext" id="7r*}c).]GtkEH)FR.:s." x="412" y="-138"> <mutation items="12"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="qW*M98D`Of90FmZ?BT;~"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_1</field> </shadow> </value> <value name="OID1"> <shadow type="field_oid" id="db.g;R`[uTi-M|khCqfC"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_2</field> </shadow> </value> <value name="OID2"> <shadow type="field_oid" id="xXI+u{uUm0V4mOYK!n]j"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_3</field> </shadow> </value> <value name="OID3"> <shadow type="field_oid" id="L/.+Co%HVmPx|6[dkKDf"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_4</field> </shadow> </value> <value name="OID4"> <shadow type="field_oid" id="YVdua@J5e.V_U-U26+?x"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_5</field> </shadow> </value> <value name="OID5"> <shadow type="field_oid" id="3p-_6#@zV#xSNcEo/hbt"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_6</field> </shadow> </value> <value name="OID6"> <shadow type="field_oid" id="[XON[zsvmV^USlAkKTMv"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_7</field> </shadow> </value> <value name="OID7"> <shadow type="field_oid" id="%{._9]MXCKmMWiwrYR}w"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_8</field> </shadow> </value> <value name="OID8"> <shadow type="field_oid" id="ME,JB!1D%xbAV}6ir2wG"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_9</field> </shadow> </value> <value name="OID9"> <shadow type="field_oid" id="raHa*UG!:Q]~4]zEv1,#"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_0</field> </shadow> </value> <value name="OID10"> <shadow type="field_oid" id="t/lBj:{1Z*;LCZ!?G/?g"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_Raute</field> </shadow> </value> <value name="OID11"> <shadow type="field_oid" id="[jEp!64??uE`5I.NeKqk"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_Stern</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="Yg;,[I7Ex=?rcz#y?kj%"> <field name="COMMENT">Timer für zu lange Eingabepause stoppen</field> <next> <block type="timeouts_cleartimeout" id="#p8Sw}HSQK?cYiU:YHiK"> <field name="NAME">timeout</field> <next> <block type="comment" id="?pNSp?WhqKPHT/B_pJo:"> <field name="COMMENT">Nur ausführen wenn Eingabe nicht geblockt</field> <next> <block type="controls_if" id="`dn-O]h-kTj)k:Hx)Xkz"> <value name="IF0"> <block type="logic_compare" id="aahnsRO!(k,8K;ftiGcN"> <field name="OP">NEQ</field> <value name="A"> <block type="variables_get" id="~1[*:7k/oGI/ZT1ie-F5"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> </block> </value> <value name="B"> <block type="variables_get" id="9EtqToNOpvma_:nUc:I3"> <field name="VAR" id="=fqAdNW+-;3@%drz;?sd" variabletype="">maxVersuche</field> </block> </value> </block> </value> <statement name="DO0"> <block type="procedures_callcustomnoreturn" id="2C-VQN.6}IcT%{@4PrJ#"> <mutation name="getPin"> <arg name="obj"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="8hLPHI7-,n:]1Xb+vdmH"> <field name="VAR" id="ITkif9wDtLGFs/#o[__}" variabletype="">obj</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="comment" id="VL?eGr.k/g/-$31{$5;q" x="13" y="-12"> <field name="COMMENT">https://forum.iobroker.net/topic/4461/vorlage-flexible-pin-eingabe-mit-blockly/62</field> <next> <block type="comment" id=".M/Q%KRmxbXWc2P9~_MO"> <field name="COMMENT">Einmalige Initialisierung bei Programmstart</field> <next> <block type="procedures_callnoreturn" id="tjP%K@i{#i,h1Dyax-gY"> <mutation name="Initialisierung"></mutation> <next> <block type="comment" id="?bXfiCYH0h;wOsNVLQT1"> <field name="COMMENT">Hier beginnt das Triggern</field> <next> <block type="comment" id="Ox)}[Fr#C.VldaJS5L^k"> <field name="COMMENT">Beliebig erweiterbar</field> </block> </next> </block> </next> </block> </next> </block> </next> </block> <block type="procedures_defcustomnoreturn" id="c!ax#5;I){tc3[MrthV6" x="-12" y="212"> <mutation statements="false"> <arg name="obj" varid="ITkif9wDtLGFs/#o[__}"></arg> </mutation> <field name="NAME">getPin</field> <field name="SCRIPT">dmFyIG5hbWUgPSBvYmouaWQ7DQp2YXIgcGluID0gbmFtZS5zdWJzdHIobmFtZS5pbmRleE9mKCJfIikrMSk7DQpjb25zb2xlLmxvZyhwaW4pOw0KDQpnZXRDb2RlKHBpbik7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defnoreturn" id="t@lDFN#V:FHO31zeMUSV" x="413" y="512"> <mutation> <arg name="TastenWert" varid="[|vEnueG447)8;@ij4Z/"></arg> </mutation> <field name="NAME">getCode</field> <comment pinned="false" h="80" w="160">Code pruefen</comment> <statement name="STACK"> <block type="text_append" id="@0sNv=W?MJzk`622W]Q4"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="TEXT"> <shadow id="6q^nqw|R(+L0{n_l/Gc4" type="text"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="LWMvwI0w|bcPvg-n5gGg"> <field name="VAR" id="[|vEnueG447)8;@ij4Z/" variabletype="">TastenWert</field> </block> </value> <next> <block type="debug" id="vjr3FKb9Vi*y+77wJTx,"> <field name="Severity">log</field> <value name="TEXT"> <shadow id=".0O)AP~8_Z_^cA%~Y=0o" type="text"> <field name="TEXT"></field> </shadow> <block type="text_join" id=")*fGp8U0U/F=Wcs;KY/|"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id=").fVwr0of^0wi[*+UipI"> <field name="TEXT">*****Eingabe -> </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="Cw9-Bo9Tle36/K]UpAeB"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> </block> </value> <next> <block type="controls_if" id="n5A{||l/F/:ozsHSOg4^"> <mutation elseif="2"></mutation> <value name="IF0"> <block type="logic_compare" id="T`=]omffKe6S+_(UpU:6"> <field name="OP">GT</field> <value name="A"> <block type="text_length" id=";Xk,nZX;Io@ax2OT=s73"> <value name="VALUE"> <shadow id="RGYf`*(-7S#_3L-Ww7];" type="text"> <field name="TEXT">abc</field> </shadow> <block type="variables_get" id="gapi+DOc_=Fi})6b*l7}"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> </block> </value> <value name="B"> <block type="variables_get" id="j9RTTC,C]+Q)EY2SD}`i"> <field name="VAR" id="BahnYj{jlb#a:#W)#2M|" variabletype="">maxCodeLaenge</field> </block> </value> </block> </value> <statement name="DO0"> <block type="comment" id="|T`go8I~X04G[v8TB8v3"> <field name="COMMENT">Zuviele Eingaben</field> <next> <block type="comment" id="+lM8)EE*fCo`n1X0.Dw="> <field name="COMMENT">Eingabe löschen und Versuche hochzählen</field> <next> <block type="debug" id="sRw2Xy,4}LO3T4q.5*yM"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="+cYZRRJa1z=6hGhTLdam"> <field name="TEXT">*****Zuviele Zeichen*****</field> </shadow> </value> <next> <block type="variables_set" id="%D8buHC|kCUU1/KVJB[2"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="lht*IiaJIlncVA5vW*fJ"> <field name="TEXT"></field> </block> </value> <next> <block type="procedures_callnoreturn" id="T/]?rq:p![ebfuT~k+i/"> <mutation name="chkVersuche"></mutation> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="lDJ@;/jzBi=HTRV]yYn,"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="*v]-iY2]3*a;Ir}hU9sM"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> <value name="B"> <block type="variables_get" id="FXw/|._t2rtHCxgNR}N{"> <field name="VAR" id="niZ3//f$eX8LcKDOBbZV" variabletype="">CodeAnwesend</field> </block> </value> </block> </value> <statement name="DO1"> <block type="comment" id="l(HPe4p~ikj;pvhZJME,"> <field name="COMMENT">Eingabe anwesend</field> <next> <block type="control" id="z#w8=~wJNFy5,wBe]y3t"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Display</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="?A(n{dp%CWjg*zq7aXwN"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="update" id="R:QUWw_[Kmvca%SHrk^N"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Zielstatus</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="6LV~-IW;nfvm3/%(T)aY"> <field name="NUM">0</field> </block> </value> <next> <block type="update" id="2Ybk+GO*e6flP9xhg%It"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Warnung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="aWX!@-;lTda4%0PVhzxY"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="jJV|H|{;efHyN9b(sl-:"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.schalten</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="3/bU30,@}ly$[LaX.U9M"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="debug" id="U;M412@-[mW58w:2/pDZ"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="/6PKtIv;_asj~zH1YFWm"> <field name="TEXT">Alarmanlage ausgeschalten</field> </shadow> </value> <next> <block type="variables_set" id="JsF`#tPrlP((e*D(PKz;"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="_#wsFg(JuzNqSyCO63UI"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="Px}Q)CvBmC02#T1cMXk@"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="C]I6H6SIHR8|iQm];Ca}"> <field name="TEXT"></field> </block> </value> <next> <block type="control" id="hZv`zZhM|2M?YyvDn,8x"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="_2;iEf4vhv#}}w#t+U(]"> <field name="TEXT">PIN richtig</field> </block> </value> <next> <block type="timeouts_settimeout" id="qwA/l(1KFnv*jNTWN(m`"> <field name="NAME">timeout2</field> <field name="DELAY">3</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="control" id="5m?zQ9o#0XN]Sy]zM-d~"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="}Rb,H2Qe+D}`g5_,1[$s"> <field name="TEXT"></field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="IF2"> <block type="logic_compare" id="q5TC_HT@d%%zp2v~b*Tn"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="l7kYxI,*WfQpfk]KeaNx"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> <value name="B"> <block type="variables_get" id="|1s`IFir18cpI{pu#Q^-"> <field name="VAR" id="^:-Xdw$Uu?.2I3~y[y=C" variabletype="">CodeAbwesend</field> </block> </value> </block> </value> <statement name="DO2"> <block type="comment" id="gC,mfb5oIVA~7AtfZLuq"> <field name="COMMENT">Eingabe abwesend</field> <next> <block type="control" id="hN|;!4oR*1!xQ#qC}E~]"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Display</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="wyyzs~v;}u.J*FoTQ~A."> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="update" id=".l_pf7%NJK^fu.[PDnS9"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Zielstatus</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="$u{1|w]7W1M=1H*zDe#["> <field name="NUM">1</field> </block> </value> <next> <block type="update" id="@G`#|z).MM0ttOjIlmxC"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Warnung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="EInLUZYLQ^B6/pNGIb)g"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="0Foa1|H$7v|{V6EZzdN@"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.schalten</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="0Dd|cem]c9bb*5I(o17t"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="debug" id="WFx{B]6g/3*_57_mwTh9"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="$KPapM}N/I*O3(yLiP)y"> <field name="TEXT">Alarmanlage eingeschalten</field> </shadow> </value> <next> <block type="variables_set" id="(l}I!WN~.4y.yPKOsA7C"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="f-kQuDu8P|7}j/j)$6N6"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id=".)$mHrhltnE@+2}=D9sr"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="e-?/ER9U7@RsGJKKC$wE"> <field name="TEXT"></field> </block> </value> <next> <block type="control" id="jXT624efjw8F_y,-67bV"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="oYr:xJ3wIZpO_I2Rq)=."> <field name="TEXT">PIN richtig</field> </block> </value> <next> <block type="timeouts_settimeout" id="MGWRkKRl|1rY/i:OzALh"> <field name="NAME">timeout3</field> <field name="DELAY">3</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="control" id="|mRij4l@yr4Swzt.x4DB"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="wW3x,e|}+SZjW4i:$$N:"> <field name="TEXT"></field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="*)]FG}!jqa@!^@C404zD"> <field name="NAME">timeout</field> <field name="DELAY">6000</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="debug" id="^/scr0CQw5az!rQS:r]]"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="m2OB0+b5__We4Le7l@;4"> <field name="TEXT">Keine Eingabe registriert</field> </shadow> </value> <next> <block type="comment" id="@87rub*L(JD2dLo|`Aef"> <field name="COMMENT">Wenn in 5 Sek. keine weitere Eingabe erfolgt</field> <next> <block type="comment" id="/6Z(,/]_}ZhyadfHIgZ5"> <field name="COMMENT">dann Eingabe löschen und Versuche hochzählen</field> <next> <block type="variables_set" id="a3yX(4)M(27nSsHd.d-_"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="oolYv~l{~LPGx~/TXDZ["> <field name="TEXT"></field> </block> </value> <next> <block type="control" id="g{=LG6f@H8l]3]]y#Fdu"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="^8;s:u.d!90:F22;,d@|"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> <next> <block type="procedures_callnoreturn" id="Uq`e6b9wNj]Sp(Zb#o#X"> <mutation name="chkVersuche"></mutation> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="c,ULx]X]~F-z^(_+{6vr" x="387" y="2813"> <field name="NAME">chkVersuche</field> <comment pinned="false" h="80" w="160">Fehlerhafte Eingaben zählen und Eingabe sperren wenn maxVersuche erreicht.</comment> <statement name="STACK"> <block type="math_change" id="+bbjB`}N7U3vkk:@%?[V"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="DELTA"> <shadow type="math_number" id="P!Tq!OVi/*(ehXZb]uC8"> <field name="NUM">1</field> </shadow> </value> <next> <block type="controls_if" id="V6AzqIh:%+F@oh[M-IQ{"> <value name="IF0"> <block type="logic_compare" id="!CYyilZ1svbcZ]Yf=BXd"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="@Zmti,3QUsDg5gTF6tjC"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> </block> </value> <value name="B"> <block type="variables_get" id="x=cs)@yt;A6[ua*T5FE|"> <field name="VAR" id="=fqAdNW+-;3@%drz;?sd" variabletype="">maxVersuche</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="[d~Z|qEH+C4%5%A*xBTT"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="v.9ViGY:H4?EbA+fzjKV"> <field name="TEXT">*****Eingabe gesperrt*****</field> </shadow> </value> <next> <block type="timeouts_settimeout" id="(l|4)g2/(/@5-swvVF@2"> <field name="NAME">timeout4</field> <field name="DELAY">5</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="U22mj9gD,9P)FU@4%{K~"> <field name="COMMENT">Nach 10 Sek. wieder frei</field> <next> <block type="variables_set" id="d)*rJF_51+C|Z3NMW9N+"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="^)c6!p[y)V0zk(9oMl16"> <field name="NUM">0</field> </block> </value> <next> <block type="debug" id="SO`ZMoZ)Os7:]]y=T3yE"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="5.ubt?0E+m)aiIY`J``U"> <field name="TEXT">*****Eingabe entsperrt*****</field> </shadow> </value> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> </xml>
-
Ich habe es gerade ausgiebig getestet.
Deswegen meine verspätete Antwort und mein Dank an dich!Funktioniert sehr gut!
Vielen Dank! -
@Superdad Gerne doch.
Dann lag da wohl iwo der Fehler bei dem aufgezählten, hat sich verzettelt oder so bei den Timeouts.
Aber gut, dass es jetzt funktioniert.Btw. Du wertest momentan Raute und Stern nicht aus. Mein Skript gibt nicht das Zeichen (#/*) weiter sondern den Namen (Raute/Stern) ist einfach als viele IFs.
-
Ich werde es mal ausprobieren.
-
Ist denn dein Script anders aufgebaut?
Für was nutzt du denn Raute und Stern? -
Das Und/Oder war nur zum ausprobieren.
Ich wollte die Fehleingaben abfangen.Mit deinem abgewandelten Script funktioniert es aber.
Das Pin-Richtig lasse ich auf dem Display im Hinweisfeld anzeigen.
Das erscheint nur bei richtiger Eingabe für 3 Sekunden.
Wenn ich es nicht wieder lösche, dann ist es immer im Hinweisfeld. -
@Superdad sagte in [Hilfe!] PIN Eingabe über Blockly:
Ist denn dein Script anders aufgebaut?
Jap. Ich verwende die Object ID und geb alles was hinter _ (unterstrich) steht an deine Funktion weiter. Das erspart viele IFs.
Das Pin-Richtig lasse ich auf dem Display im Hinweisfeld anzeigen.
Vermische nichts was nicht zusammen gehört. In die Variable gehört nur die PIN sonst nix.
Du setzt die Variable in verschiedenen Timeouts mit verschiedenen Werten die nichts miteinander zu tun haben.
Das macht man einfach nicht^^
Gib doch direkt den Text "Richtige PIN" an den Datenpunkt anstatt ihn in einer Variable zu speicher.
(So wie es jetzt in meinem Skript ist) -
Ich habe ja jetzt nur dein Script laufen.
Dann müsste ja alles ok sein, oder?Also das abgewandelte was du geschickt hast.
Nicht das wir aneinander vorbei reden. -
@Superdad Wenn es funktioniert dann passt es so^^
-
Nochmals vielen Dank!
-
@thewhobox Guten Morgen Bin gerade über das Skript gestollpert und wollt es mal auf die schnelle Testen.
Bei deinem Export haben noch ein paar createStates gefehlt, die habe ich ergänzt.
Allerdings bekomme ich, egal welchen PIN ich eingebe immer die Erfolgsmeldung wie wenn ich PIN 1 2 3 4 eingegeben hätte. Getestet wurde es auf einem frischen Testsystem.
EDIT:
<xml xmlns="http://www.w3.org/1999/xhtml">
<variables>
<variable type="" id="$om.b{xr,!oP@m%Q([v-">obj</variable>
<variable type="" id="[|vEnueG447)8;@ij4Z/">TastenWert</variable>
<variable type="" id="2IVfkgYBTmV|ClF$JyY,">AnzahlVersuche</variable>
<variable type="" id="-%t(A!B?L#Q@1F$nmfJ~">tempCode</variable>
<variable type="" id="=fqAdNW+-;3@%drz;?sd">maxVersuche</variable>
<variable type="undefined" id="timeout">timeout</variable>
<variable type="undefined" id="timeout4">timeout4</variable>
<variable type="" id="BahnYj{jlb#a:#W)#2M|">maxCodeLaenge</variable>
<variable type="" id="niZ3//f$eX8LcKDOBbZV">CodeAnwesend</variable>
<variable type="" id="^:-Xdw$Uu?.2I3~y[y=C">CodeAbwesend</variable>
<variable type="undefined" id="timeout2">timeout2</variable>
<variable type="undefined" id="timeout3">timeout3</variable>
</variables>
<block type="comment" id="VL?eGr.k/g/-$31{$5;q" x="38" y="-612">
<field name="COMMENT">https://forum.iobroker.net/topic/4461/vorlage-flexible-pin-eingabe-mit-blockly/62</field>
<next>
<block type="comment" id=".M/Q%KRmxbXWc2P9~MO">
<field name="COMMENT">Einmalige Initialisierung bei Programmstart</field>
<next>
<block type="procedures_callnoreturn" id="tjP%K@i{#i,h1Dyax-gY">
<mutation name="Initialisierung"></mutation>
<next>
<block type="comment" id="?bXfiCYH0h;wOsNVLQT1">
<field name="COMMENT">Hier beginnt das Triggern</field>
<next>
<block type="comment" id="Ox)}[Fr#C.VldaJS5L^k">
<field name="COMMENT">Beliebig erweiterbar</field>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<block type="on_ext" id="7r*}c).]GtkEH)FR.:s." x="488" y="-613">
<mutation items="12"></mutation>
<field name="CONDITION">any</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="qWM98DOf90FmZ?BT;~"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_1</field> </shadow> </value> <value name="OID1"> <shadow type="field_oid" id="db.g;R
[uTi-M|khCqfC">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_2</field>
</shadow>
</value>
<value name="OID2">
<shadow type="field_oid" id="xXI+u{uUm0V4mOYK!n]j">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_3</field>
</shadow>
</value>
<value name="OID3">
<shadow type="field_oid" id="L/.+Co%HVmPx|6[dkKDf">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_4</field>
</shadow>
</value>
<value name="OID4">
<shadow type="field_oid" id="YVdua@J5e.V_U-U26+?x">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_5</field>
</shadow>
</value>
<value name="OID5">
<shadow type="field_oid" id="3p-_6#@zV#xSNcEo/hbt">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_6</field>
</shadow>
</value>
<value name="OID6">
<shadow type="field_oid" id="[XON[zsvmV^USlAkKTMv">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_7</field>
</shadow>
</value>
<value name="OID7">
<shadow type="field_oid" id="%{._9]MXCKmMWiwrYR}w">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_8</field>
</shadow>
</value>
<value name="OID8">
<shadow type="field_oid" id="ME,JB!1D%xbAV}6ir2wG">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_9</field>
</shadow>
</value>
<value name="OID9">
<shadow type="field_oid" id="raHaUG!:Q]~4]zEv1,#">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_0</field>
</shadow>
</value>
<value name="OID10">
<shadow type="field_oid" id="t/lBj:{1Z*;LCZ!?G/?g">
<field name="oid">javascript.0.Alarmsystem.PIN.Nummer_Raute</field>
</shadow>
</value>
<value name="OID11">
<shadow type="field_oid" id="[jEp!64??uE5I.NeKqk"> <field name="oid">javascript.0.Alarmsystem.PIN.Nummer_Stern</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="Yg;,[I7Ex=?rcz#y?kj%"> <field name="COMMENT">Timer für zu lange Eingabepause stoppen</field> <next> <block type="timeouts_cleartimeout" id="#p8Sw}HSQK?cYiU:YHiK"> <field name="NAME">timeout</field> <next> <block type="comment" id="?pNSp?WhqKPHT/B_pJo:"> <field name="COMMENT">Nur ausführen wenn Eingabe nicht geblockt</field> <next> <block type="controls_if" id="
dn-O]h-kTj)k:Hx)Xkz">
<value name="IF0">
<block type="logic_compare" id="aahnsRO!(k,8K;ftiGcN">
<field name="OP">NEQ</field>
<value name="A">
<block type="variables_get" id="~1[*:7k/oGI/ZT1ie-F5">
<field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field>
</block>
</value>
<value name="B">
<block type="variables_get" id="9EtqToNOpvma:nUc:I3">
<field name="VAR" id="=fqAdNW+-;3@%drz;?sd" variabletype="">maxVersuche</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="procedures_callcustomnoreturn" id="2C-VQN.6}IcT%{@4PrJ#">
<mutation name="getPin">
<arg name="obj"></arg>
</mutation>
<value name="ARG0">
<block type="variables_get" id="8hLPHI7-,n:]1Xb+vdmH">
<field name="VAR" id="$om.b{xr,!oP@m%Q([v-" variabletype="">obj</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="c,ULx]X]~F-z^(+{6vr" x="1288" y="-613">
<field name="NAME">chkVersuche</field>
<comment pinned="false" h="80" w="160">Fehlerhafte Eingaben zählen und Eingabe sperren wenn maxVersuche erreicht.</comment>
<statement name="STACK">
<block type="math_change" id="+bbjB}N7U3vkk:@%?[V"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="DELTA"> <shadow type="math_number" id="P!Tq!OVi/*(ehXZb]uC8"> <field name="NUM">1</field> </shadow> </value> <next> <block type="controls_if" id="V6AzqIh:%+F@oh[M-IQ{"> <value name="IF0"> <block type="logic_compare" id="!CYyilZ1svbcZ]Yf=BXd"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="@Zmti,3QUsDg5gTF6tjC"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> </block> </value> <value name="B"> <block type="variables_get" id="x=cs)@yt;A6[ua*T5FE|"> <field name="VAR" id="=fqAdNW+-;3@%drz;?sd" variabletype="">maxVersuche</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="[d~Z|qEH+C4%5%A*xBTT"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="v.9ViGY:H4?EbA+fzjKV"> <field name="TEXT">*****Eingabe gesperrt*****</field> </shadow> </value> <next> <block type="timeouts_settimeout" id="(l|4)g2/(/@5-swvVF@2"> <field name="NAME">timeout4</field> <field name="DELAY">5</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="U22mj9gD,9P)FU@4%{K~"> <field name="COMMENT">Nach 10 Sek. wieder frei</field> <next> <block type="variables_set" id="d)*rJF_51+C|Z3NMW9N+"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="^)c6!p[y)V0zk(9oMl16"> <field name="NUM">0</field> </block> </value> <next> <block type="debug" id="SO
ZMoZ)Os7:]]y=T3yE">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="5.ubt?0E+m)aiIYJ``U"> <field name="TEXT">*****Eingabe entsperrt*****</field> </shadow> </value> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> <block type="procedures_defcustomnoreturn" id="c!ax#5;I){tc3[MrthV6" x="38" y="-438"> <mutation statements="false"> <arg name="obj" varid="$om.b{xr,!oP@m%Q([v-"></arg> </mutation> <field name="NAME">getPin</field> <field name="SCRIPT">dmFyIG5hbWUgPSBvYmouaWQ7DQp2YXIgcGluID0gbmFtZS5zdWJzdHIobmFtZS5pbmRleE9mKCJfIikrMSk7DQpjb25zb2xlLmxvZyhwaW4pOw0KDQpnZXRDb2RlKHBpbik7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defnoreturn" id="O)q*?M8Hfa5)/}O6ZsZ7" x="1288" y="-237"> <field name="NAME">Initialisierung</field> <comment pinned="false" h="80" w="160">Bei Programmstart Werte vorgeben.</comment> <statement name="STACK"> <block type="variables_set" id="?L69j3%sRmc}([5G2X60"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="t]h/P
X7feEalP-;RDq">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="wMeGQPHU)@|vwaJP%iqr">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
<value name="VALUE">
<block type="text" id="^J(t|s-ySqnJKRARc_:|">
<field name="TEXT"></field>
</block>
</value>
<next>
<block type="comment" id="UZqDvMtW0LHk96L^T8z">
<field name="COMMENT">Maximale Fehlversuche festlegen</field>
<next>
<block type="variables_set" id="e663[k*hSCd%o?sd(XA">
<field name="VAR" id="=fqAdNW+-;3@%drz;?sd" variabletype="">maxVersuche</field>
<value name="VALUE">
<block type="math_number" id="{OjuYXvX(;:=T.oag~a#">
<field name="NUM">3</field>
</block>
</value>
<next>
<block type="comment" id="K(:;y-gihBx_:{%kJ~Oo">
<field name="COMMENT">Länge der Codes festlegen</field>
<next>
<block type="variables_set" id="BGt@+4h!d)Kco3]{,)V"> <field name="VAR" id="BahnYj{jlb#a:#W)#2M|" variabletype="">maxCodeLaenge</field> <value name="VALUE"> <block type="math_number" id="|Wm^i
:C~o0Bp7;,-yy"> <field name="NUM">4</field> </block> </value> <next> <block type="comment" id="ZgOwwPRCnNLM~@tR?DhB"> <field name="COMMENT">Liste der Codes</field> <next> <block type="comment" id="|9)F(1-)Murz[PAg@Pcz"> <field name="COMMENT">Beliebig erweiterbar. Auf Länge achten!</field> <next> <block type="variables_set" id=";~}[HtK6:wa8W/1,]j2a"> <field name="VAR" id="niZ3//f$eX8LcKDOBbZV" variabletype="">CodeAnwesend</field> <value name="VALUE"> <block type="text" id="/%k9:KVHUC2RVgH.:^v5"> <field name="TEXT">4321</field> </block> </value> <next> <block type="variables_set" id=";{0Vr(56Uhr:z8Cziv*C"> <field name="VAR" id="^:-Xdw$Uu?.2I3~y[y=C" variabletype="">CodeAbwesend</field> <value name="VALUE"> <block type="text" id="^di=V@V!cAe+WZiLfuL%"> <field name="TEXT">1234</field> </block> </value> <next> <block type="create" id="
Z+;K{8ZH$M)Vh5[xKf"> <field name="NAME">Alarmsystem.PIN.Nummer_1</field> <value name="VALUE"> <block type="logic_boolean" id="pS,!ox}LkjT-%8l
drE">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="create" id="fKSJ~4u3b}F[~iX6uly0">
<field name="NAME">Alarmsystem.PIN.Nummer_2</field>
<value name="VALUE">
<block type="logic_boolean" id="VzL$o=!2-(+x~|Kslq"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="create" id="#^mP#_]r+Y+5Q0S}UQWY"> <field name="NAME">Alarmsystem.PIN.Nummer_3</field> <value name="VALUE"> <block type="logic_boolean" id="#gcMM+0TFHp?Lp2_hte#"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="create" id="eU7|lo.1zrB8-*U~oQzJ"> <field name="NAME">Alarmsystem.PIN.Nummer_4</field> <value name="VALUE"> <block type="logic_boolean" id="v%[6$h|P}vE-1m[@3;We"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="comment" id="SYPf3(W71279K/Kkm}AR"> <field name="COMMENT">folgende DPs ergänzt:</field> <next> <block type="create" id="Ye,=$B/r]/|qB?|O!w3g"> <field name="NAME">Alarmsystem.PIN.Display</field> <value name="VALUE"> <block type="logic_boolean" id="ltqe1AYj6Hu~tlXD
rcZ">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="create" id="Wf=g$yO)0]lHEA1l-UPu">
<field name="NAME">Alarmsystem.Alarm.Zielstatus</field>
<next>
<block type="create" id="IGj}RI_FVz4(~@V}Biv,">
<field name="NAME">Alarmsystem.Alarm.Warnung</field>
<next>
<block type="create" id="[+5dzjjdZxW4N*N0y)("> <field name="NAME">Alarmsystem.Alarm.schalten</field> <value name="VALUE"> <block type="logic_boolean" id="a*fglq4X5_p.eU0gx=mm"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="create" id="KituU9=_uWe:?73K$jPM"> <field name="NAME">Alarmsystem.PIN.Hinweisfeld</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> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="t@lDFN#V:FHO31zeMUSV" x="488" y="12"> <mutation> <arg name="TastenWert" varid="[|vEnueG447)8;@ij4Z/"></arg> </mutation> <field name="NAME">getCode</field> <comment pinned="false" h="80" w="160">Code pruefen</comment> <statement name="STACK"> <block type="text_append" id="@0sNv=W?MJzk
622W]Q4">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
<value name="TEXT">
<shadow id="6q^nqw|R(+L0{n_l/Gc4" type="text">
<field name="TEXT"></field>
</shadow>
<block type="variables_get" id="LWMvwI0w|bcPvg-n5gGg">
<field name="VAR" id="[|vEnueG447)8;@ij4Z/" variabletype="">TastenWert</field>
</block>
</value>
<next>
<block type="debug" id="vjr3FKb9Viy+77wJTx,">
<field name="Severity">log</field>
<value name="TEXT">
<shadow id=".0O)AP~8_Z_^cA%~Y=0o" type="text">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id=")fGp8U0U/F=Wcs;KY/|">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="text" id=").fVwr0of^0wi[+UipI">
<field name="TEXT">*****Eingabe -> </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="Cw9-Bo9Tle36/K]UpAeB">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if" id="n5A{||l/F/:ozsHSOg4^">
<mutation elseif="2"></mutation>
<value name="IF0">
<block type="logic_compare" id="T=]omffKe6S+_(UpU:6"> <field name="OP">GT</field> <value name="A"> <block type="text_length" id=";Xk,nZX;Io@ax2OT=s73"> <value name="VALUE"> <shadow id="RGYf
(-7S#3L-Ww7];" type="text">
<field name="TEXT">abc</field>
</shadow>
<block type="variables_get" id="gapi+DOc=Fi})6bl7}">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="variables_get" id="j9RTTC,C]+Q)EY2SD}i"> <field name="VAR" id="BahnYj{jlb#a:#W)#2M|" variabletype="">maxCodeLaenge</field> </block> </value> </block> </value> <statement name="DO0"> <block type="comment" id="|T
go8I~X04G[v8TB8v3">
<field name="COMMENT">Zuviele Eingaben</field>
<next>
<block type="comment" id="+lM8)EEfCon1X0.Dw="> <field name="COMMENT">Eingabe löschen und Versuche hochzählen</field> <next> <block type="debug" id="sRw2Xy,4}LO3T4q.5*yM"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="+cYZRRJa1z=6hGhTLdam"> <field name="TEXT">*****Zuviele Zeichen*****</field> </shadow> </value> <next> <block type="variables_set" id="%D8buHC|kCUU1/KVJB[2"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="lht*IiaJIlncVA5vW*fJ"> <field name="TEXT"></field> </block> </value> <next> <block type="procedures_callnoreturn" id="T/]?rq:p![ebfuT~k+i/"> <mutation name="chkVersuche"></mutation> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="lDJ@;/jzBi=HTRV]yYn,"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="*v]-iY2]3*a;Ir}hU9sM"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> <value name="B"> <block type="variables_get" id="FXw/|._t2rtHCxgNR}N{"> <field name="VAR" id="niZ3//f$eX8LcKDOBbZV" variabletype="">CodeAnwesend</field> </block> </value> </block> </value> <statement name="DO1"> <block type="comment" id="l(HPe4p~ikj;pvhZJME,"> <field name="COMMENT">Eingabe anwesend</field> <next> <block type="control" id="z#w8=~wJNFy5,wBe]y3t"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Display</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="?A(n{dp%CWjg*zq7aXwN"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="update" id="R:QUWw_[Kmvca%SHrk^N"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Zielstatus</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="6LV~-IW;nfvm3/%(T)aY"> <field name="NUM">0</field> </block> </value> <next> <block type="update" id="2Ybk+GO*e6flP9xhg%It"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Warnung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="aWX!@-;lTda4%0PVhzxY"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="jJV|H|{;efHyN9b(sl-:"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.schalten</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="3/bU30,@}ly$[LaX.U9M"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="debug" id="U;M412@-[mW58w:2/pDZ"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="/6PKtIv;_asj~zH1YFWm"> <field name="TEXT">Alarmanlage ausgeschalten</field> </shadow> </value> <next> <block type="variables_set" id="JsF
#tPrlP((eD(PKz;">
<field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field>
<value name="VALUE">
<block type="math_number" id="_#wsFg(JuzNqSyCO63UI">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="Px}Q)CvBmC02#T1cMXk@">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
<value name="VALUE">
<block type="text" id="C]I6H6SIHR8|iQm];Ca}">
<field name="TEXT"></field>
</block>
</value>
<next>
<block type="control" id="hZvzZhM|2M?YyvDn,8x"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="_2;iEf4vhv#}}w#t+U(]"> <field name="TEXT">PIN richtig</field> </block> </value> <next> <block type="timeouts_settimeout" id="qwA/l(1KFnv*jNTWN(m
">
<field name="NAME">timeout2</field>
<field name="DELAY">3</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="control" id="5m?zQ9o#0XN]Sy]zM-d~">
<mutation delay_input="false"></mutation>
<field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="text" id="}Rb,H2Qe+D}g5_,1[$s"> <field name="TEXT"></field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="IF2"> <block type="logic_compare" id="q5TC_HT@d%%zp2v~b*Tn"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="l7kYxI,*WfQpfk]KeaNx"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> </block> </value> <value name="B"> <block type="variables_get" id="|1s
IFir18cpI{pu#Q^-">
<field name="VAR" id="^:-Xdw$Uu?.2I3~y[y=C" variabletype="">CodeAbwesend</field>
</block>
</value>
</block>
</value>
<statement name="DO2">
<block type="comment" id="gC,mfb5oIVA~7AtfZLuq">
<field name="COMMENT">Eingabe abwesend</field>
<next>
<block type="control" id="hN|;!4oR1!xQ#qC}E~]">
<mutation delay_input="false"></mutation>
<field name="OID">javascript.0.Alarmsystem.PIN.Display</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="wyyzs~v;}u.JFoTQ~A.">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="update" id=".l_pf7%NJK^fu.[PDnS9">
<mutation delay_input="false"></mutation>
<field name="OID">javascript.0.Alarmsystem.Alarm.Zielstatus</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="$u{1|w]7W1M=1HzDe#[">
<field name="NUM">1</field>
</block>
</value>
<next>
<block type="update" id="@G#|z).MM0ttOjIlmxC"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.Warnung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="EInLUZYLQ^B6/pNGIb)g"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="0Foa1|H$7v|{V6EZzdN@"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.Alarm.schalten</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="0Dd|cem]c9bb*5I(o17t"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="debug" id="WFx{B]6g/3*_57_mwTh9"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="$KPapM}N/I*O3(yLiP)y"> <field name="TEXT">Alarmanlage eingeschalten</field> </shadow> </value> <next> <block type="variables_set" id="(l}I!WN~.4y.yPKOsA7C"> <field name="VAR" id="2IVfkgYBTmV|ClF$JyY," variabletype="">AnzahlVersuche</field> <value name="VALUE"> <block type="math_number" id="f-kQuDu8P|7}j/j)$6N6"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id=".)$mHrhltnE@+2}=D9sr"> <field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field> <value name="VALUE"> <block type="text" id="e-?/ER9U7@RsGJKKC$wE"> <field name="TEXT"></field> </block> </value> <next> <block type="control" id="jXT624efjw8F_y,-67bV"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="oYr:xJ3wIZpO_I2Rq)=."> <field name="TEXT">PIN richtig</field> </block> </value> <next> <block type="timeouts_settimeout" id="MGWRkKRl|1rY/i:OzALh"> <field name="NAME">timeout3</field> <field name="DELAY">3</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="control" id="|mRij4l@yr4Swzt.x4DB"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="wW3x,e|}+SZjW4i:$$N:"> <field name="TEXT"></field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="*)]FG}!jqa@!^@C404zD"> <field name="NAME">timeout</field> <field name="DELAY">6000</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="debug" id="^/scr0CQw5az!rQS:r]]"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="m2OB0+b5__We4Le7l@;4"> <field name="TEXT">Keine Eingabe registriert</field> </shadow> </value> <next> <block type="comment" id="@87rub*L(JD2dLo|
Aef">
<field name="COMMENT">Wenn in 5 Sek. keine weitere Eingabe erfolgt</field>
<next>
<block type="comment" id="/6Z(,/]}ZhyadfHIgZ5">
<field name="COMMENT">dann Eingabe löschen und Versuche hochzählen</field>
<next>
<block type="variables_set" id="a3yX(4)M(27nSsHd.d-">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
<value name="VALUE">
<block type="text" id="oolYv~l{~LPGx~/TXDZ[">
<field name="TEXT"></field>
</block>
</value>
<next>
<block type="control" id="g{=LG6f@H8l]3]]y#Fdu">
<mutation delay_input="false"></mutation>
<field name="OID">javascript.0.Alarmsystem.PIN.Hinweisfeld</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="^8;s:u.d!90:F22;,d@|">
<field name="VAR" id="-%t(A!B?L#Q@1F$nmfJ~" variabletype="">tempCode</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="Uq`e6b9wNj]Sp(Zb#o#X">
<mutation name="chkVersuche"></mutation>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml> -
Jetzt hab ich die Logik verstanden, da fehlten noch die DPs für den Zahlen 5-9 & 0
Was triggerst du denn mit # und * ?
Da Blockly-Export > 50.000 Zeichen:
https://gist.github.com/darkiop/a65a8a3f02212c5c914811578be0fc13 -
@darkiop hey, das Skript ist nicht von mir ich habe es nur verbessert.
Die Tasten Raute und stern werden momentan nicht benutzt.