Hallo zusammen,
ich habe mich nun etliche Stunden an einem Blockly Skript versucht, das meine Deckenlampe mit einer Verzögerung von ca. 2 Minuten ausschaltet, nachdem ich die Tür geöffnet habe. Wenn ich innerhalb dieser 2 Minuten jedoch wieder ins Zimmer zurückkehre (überprüft durch Türkontakt) oder ich gar nicht erst rausgegangen bin(überprüft durch BWM), soll das Licht sich nicht ausschalten, das Timeout also abgebrochen werden.
Aktuell funktioniert mein Schleifenkonstrukt zur Abfrage der BWM und des Türkontakts aber nicht, da (wie ich vermute) der Trigger, wenn ich die Tür öffne, die Schleifen wieder von vorne startet.
So sieht es aktuell aus:
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="2C$4RAfRMC)wIv=:]mF}">türsensor_aktiv</variable>
<variable id="moq?YSluuwUVF=IlV.^(">bewegung_erkannt</variable>
<variable id="kJwMa]1OCO7$1^F`mz;#">timer</variable>
<variable type="timeout" id="timeout3">timeout3</variable>
<variable id="mH{{sUi(g@a5B*9n=*iX">anwesend</variable>
<variable type="interval" id="Intervall3">Intervall3</variable>
<variable type="timeout" id="anwesenheit_false">anwesenheit_false</variable>
<variable type="interval" id="Intervall4">Intervall4</variable>
</variables>
<block type="on_ext" id="CxdBIx/PBa?_}#pg%rkI" x="63" y="1588">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">gt</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="HE;QcY],D~R5o[qcP{H.">
<field name="oid">deconz.0.Sensors.5.open</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="HHX`e=-%DHvb4:I?7#c;">
<value name="IF0">
<block type="logic_compare" id="w}5|g_RibBTN?}zAx|-v">
<field name="OP">EQ</field>
<value name="A">
<block type="time_compare_ex" id="8SSFw2#RVLq/ze_|IGN5">
<mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation>
<field name="USE_ACTUAL_TIME">TRUE</field>
<field name="OPTION">></field>
<value name="START_TIME">
<shadow type="text" id="K.JtbBV`MK^@~iJTZs^C">
<field name="TEXT">15:00</field>
</shadow>
</value>
</block>
</value>
<value name="B">
<block type="logic_compare" id="nDppnhJD*./pO?F7o,A)">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="SbfmN]D$ESlh_J_0t!f-">
<field name="VAR" id="2C$4RAfRMC)wIv=:]mF}">türsensor_aktiv</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="6wnm$iHEd^ln]//8k,ql">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="debug" id="N7M./*)Yy+R6o7o?]rX(">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="?E(x8vulR}6Bm};qG)gn">
<field name="TEXT">Tür geöffnet</field>
</shadow>
</value>
<next>
<block type="controls_if" id=";^$KDuqbqv6!Oq?kCr!m">
<value name="IF0">
<block type="logic_compare" id="lS^ZUG_o^Fby)M@x)|@:">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="3{f1I@pLbFTrrjy3.3H8">
<field name="ATTR">val</field>
<field name="OID">sonoff.0.Deckenlampe.POWER</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="ABvu,o]#EB4g8uV/2tbq">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="%2h9X|NOSs%$OzyEg9c)">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Deckenlampe.Dimmer</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="=q*~/9k!)lo/=t;!f:a]">
<field name="NUM">100</field>
</block>
</value>
<next>
<block type="control" id="=(P!C86=^Hy~af$lc[%d">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Deckenlampe.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id=":0/e:o/u=]#u8pU{2Sdv">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="controls_if" id="xr[MT/#:!d_+DDUN$l6#">
<value name="IF0">
<block type="logic_compare" id="S6ZFRMyTsn#qut-n`r`t">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id=":.r9GYNaCO]NwePbrxE}">
<field name="ATTR">val</field>
<field name="OID">sonoff.0.Deckenlampe.POWER</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="98b(8IS^{c40B|Unku*t">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="qJr_a4ke#bO,3G{Mr;`E">
<field name="VAR" id="moq?YSluuwUVF=IlV.^(">bewegung_erkannt</field>
<value name="VALUE">
<block type="math_number" id="XN:RY^9Hn3#d)0Z#*U`w">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="a4uj_ih[s-{CpkC/xg~W">
<field name="VAR" id="kJwMa]1OCO7$1^F`mz;#">timer</field>
<value name="VALUE">
<block type="math_number" id="vP6NV}OoFE{7U4By{4Gl">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="controls_if" id="bz^5DSd](0DJn/`Kj,g*">
<value name="IF0">
<block type="logic_compare" id="}l|OFHU3XtM-2_q~/cL@">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="O3#/Jc(O5Nk;OHA+W]7=">
<field name="VAR" id="mH{{sUi(g@a5B*9n=*iX">anwesend</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="#=$7$h9%QZ|cwxpF,K[D">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="timeouts_settimeout" id="k@ROcG=o]V[U|PqJgb/q">
<field name="NAME">timeout3</field>
<field name="DELAY">130</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="debug" id="2q%:+w*A[gQUyG57}c7h">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="^F/F-yBx`}ow@1|g74==">
<field name="TEXT">timeout gestartet</field>
</shadow>
</value>
<next>
<block type="control" id="JI6Jt3k7,A/8qGU*E4Sj">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Deckenlampe.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="7t0AJMF?gjh$O)1`/qE#">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="timeouts_setinterval" id="+n2cT;OnP(F;*N4:]y7|">
<field name="NAME">Intervall3</field>
<field name="INTERVAL">25</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="controls_if" id="Tg=P+:y4x02cf4b:282U">
<value name="IF0">
<block type="logic_operation" id="}F.ZTLJVSM1Qev3:JB4x">
<field name="OP">OR</field>
<value name="A">
<block type="logic_compare" id="ao~Cf3giY8k-ed0zhY)I">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="XGBJlU+*2axDa.*4L_;v">
<field name="ATTR">val</field>
<field name="OID">deconz.0.Sensors.8.presence</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="Yf5}zYp4zIMsmQY?R8e%">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_compare" id="+=@;-#DI_e9[~P;5(U{x">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="u0{ss7D(I.{{2Q!JB#0z">
<field name="ATTR">val</field>
<field name="OID">deconz.0.Sensors.9.presence</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="EUf+qctJyUbgbZMDLdX7">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="debug" id="/9-^wizwYAX!`vLiMTR7">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="@4sXh{aeU-|1mw]hyxmj">
<field name="TEXT">Bewegung erkannt</field>
</shadow>
</value>
<next>
<block type="math_change" id="EECfgOh7$R-h7!pMm^v8">
<field name="VAR" id="moq?YSluuwUVF=IlV.^(">bewegung_erkannt</field>
<value name="DELTA">
<shadow type="math_number" id="lrD7A)}o~YCxrF]y?-Nr">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="debug" id="Y5dF+vnRi=48H.1[r96F">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="+A3Ux_1s$@2ttF+yLbV)">
<field name="TEXT">count</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="controls_if" id="jmdtzVT_7#tK$cq?SM=a">
<value name="IF0">
<block type="logic_compare" id="1)`}SvNKMH8.}Mw+@X#4">
<field name="OP">GTE</field>
<value name="A">
<block type="variables_get" id="AY8BZ:AlpO`{isiAqpq5">
<field name="VAR" id="moq?YSluuwUVF=IlV.^(">bewegung_erkannt</field>
</block>
</value>
<value name="B">
<block type="math_number" id="-{b%t6*{{K;Gp?d$MWWN">
<field name="NUM">3</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="debug" id="gxhsxA+xN;O*VDRgTOQL">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="Vp!A}8jtZ`onY?rgzZix">
<field name="TEXT">timeout durch Bewegung gestoppt</field>
</shadow>
</value>
<next>
<block type="variables_set" id="ca(qB-]q3^xT-|L?Dk.F">
<field name="VAR" id="mH{{sUi(g@a5B*9n=*iX">anwesend</field>
<value name="VALUE">
<block type="logic_boolean" id="-seWn3R@iwU8_A(nawt]">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="timeouts_cleartimeout" id="5OW.Ce~Sh}rk)tl7,_`{">
<field name="NAME">timeout3</field>
<next>
<block type="timeouts_clearinterval" id="_=;$:u4P`(URpIudDyUS">
<field name="NAME">Intervall3</field>
<next>
<block type="timeouts_clearinterval" id="#5dB#V[nHE5;8*sJjE@T">
<field name="NAME">Intervall3</field>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="timeouts_setinterval" id="`GNWWxA|yn@?LUir01=B">
<field name="NAME">Intervall4</field>
<field name="INTERVAL">1000</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="controls_if" id="C=Le)IT;d@_JAfCdES1e">
<value name="IF0">
<block type="logic_compare" id="A2ab)0N?tk+]C[CNNXob">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="!OI*=wcR1W?Oue@`yIIq">
<field name="ATTR">val</field>
<field name="OID">deconz.0.Sensors.5.open</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="+h8;I!!)bIM]kwNQk{zr">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="debug" id="-ipSuh6,o/syK9#~uvAL">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="4z$~rvtqd@m%N;F~{A{M">
<field name="TEXT">timeout durch Tür gestoppt</field>
</shadow>
</value>
<next>
<block type="variables_set" id="lHXc)F/1sa!x4,u0r|K`">
<field name="VAR" id="mH{{sUi(g@a5B*9n=*iX">anwesend</field>
<value name="VALUE">
<block type="logic_boolean" id="uXcSwT@v_4{sN-]ohYc)">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="timeouts_cleartimeout" id="3g3Jr|1G{`y*}(6Jo$xf">
<field name="NAME">timeout3</field>
<next>
<block type="timeouts_clearinterval" id="Cn`$g_hs:tFZ1uE$5b~5">
<field name="NAME">Intervall3</field>
<next>
<block type="timeouts_clearinterval" id="ITry4jtl9xw%vX{ctgDi">
<field name="NAME">Intervall4</field>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
<next>
<block type="math_change" id="(.S`p#`REs7P=2sc!#0E">
<field name="VAR" id="kJwMa]1OCO7$1^F`mz;#">timer</field>
<value name="DELTA">
<shadow type="math_number" id="x(v9%fJKSM=j`fCsv$sq">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="controls_if" id="g=p!1JwJ[n)/4@a;W$Z8">
<value name="IF0">
<block type="logic_compare" id="zy0^J9xiJ;Ov^X|x8keX">
<field name="OP">GTE</field>
<value name="A">
<block type="variables_get" id="3p1/;WDqk,pu^`DwOyb~">
<field name="VAR" id="kJwMa]1OCO7$1^F`mz;#">timer</field>
</block>
</value>
<value name="B">
<block type="math_number" id="IaLSi|H8?iNWg?uvvbV[">
<field name="NUM">4</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="K}6w:{qZ[Vz2hnfZo*ej">
<field name="VAR" id="moq?YSluuwUVF=IlV.^(">bewegung_erkannt</field>
<value name="VALUE">
<block type="math_number" id="HmOe,Mp:/ITg@`!an-)T">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="#cv]Nb7kj@5i3EC?U2bn">
<field name="VAR" id="kJwMa]1OCO7$1^F`mz;#">timer</field>
<value name="VALUE">
<block type="math_number" id="Ss*ke#c$TK/#tj5B%9N|">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="Flq#Z1Nwpv+5M=Bl2)qL">
<field name="VAR" id="mH{{sUi(g@a5B*9n=*iX">anwesend</field>
<value name="VALUE">
<block type="logic_boolean" id="2VIGEmk_uN_NoDYQ1Uza">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="timeouts_clearinterval" id="wmse#kizCJ|]_(+m9]*!">
<field name="NAME">Intervall4</field>
<next>
<block type="timeouts_clearinterval" id="8tbc/T0=4);-^$cQ9ITI">
<field name="NAME">Intervall3</field>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="timeouts_settimeout" id="Bo:WX7xpGKo,f|Dfra3#">
<field name="NAME">anwesenheit_false</field>
<field name="DELAY">150</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="variables_set" id="ye.C~;^PLa,vapHnwGZ2">
<field name="VAR" id="mH{{sUi(g@a5B*9n=*iX">anwesend</field>
<value name="VALUE">
<block type="logic_boolean" id="s6$q`1GCCQ81k70WeJtE">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</xml>
Hat einer eine Idee, wo mein Fehler liegt? Bin für jede Hilfe dankbar!