NEWS
Skript nach Änderung Timeout - wo einfügen?
-
Hallo zusammen, ich habe bereits vor einiger Zeit mit Hilfe des Forums ein Skript für meine Automatisierung des Dachfensters zum Schlafzimmer geschrieben. Dieses wird nur einmal alle halbe Stunde ausgeführt.
Um den Öffnungswinkel desselben den Wetterbedingungen anpassen zu können, habe ich dieses kleine Skript geschrieben. Ja es funktioniert. Aber ich möchte den kleinen armen Raspberry etwas entlasten und ihm bei der Berechnung einen gewissen Timeout gönnen, denn das Skript wird ja andauernd neu berechnet. Wo könnte, besser muss ich denn den Timeout einbauen, dass es nur alle 10 oder 15 min ausgeführt wird? vielleicht kann mir von euch jemand helfen?<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</variable> <variable id="mstO3~jL5t|G{mXscjk7">Wind</variable> </variables> <block type="time_compare" id="qgy*Dr6m+ur}%kKJZ]l#" disabled="true" x="1063" y="-212"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true"></mutation> <field name="OPTION">between</field> <field name="START_TIME">7:00</field> <field name="END_TIME">19:00</field> </block> <block type="on_ext" id="GAQVxbQUh0r93N$11[$O" x="741" y="-139"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="iKGw*[EYVHWSsV:dY!zP"> <field name="oid">0_userdata.0.Wetterstation.Sonnenstrahlung</field> </shadow> </value> <value name="OID1"> <shadow type="field_oid" id="L@V`LZEejoVPFp}z1an?"> <field name="oid">0_userdata.0.Wetterstation.Wind</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="01HpKhW=U[jMb:{c`-?6"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> <value name="VALUE"> <block type="get_value" id=":7=[0+ne7?n8.y@0BlOS"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wetterstation.Sonnenstrahlung</field> </block> </value> <next> <block type="variables_set" id="8R/$6/,/VS.^nEiogbt/"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> <value name="VALUE"> <block type="get_value" id="vadxYm+so+Nhw|(1MTIW"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Wetterstation.Wind</field> </block> </value> <next> <block type="controls_if" id="gWwN1TC(z@B+zmP$]Flu"> <value name="IF0"> <block type="time_compare_ex" id="Oz[lEqEG]NI3a-JRzj$m"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">between</field> <value name="START_TIME"> <shadow type="text" id="YX12lB28yIdp[6JZ:bhu"> <field name="TEXT">12:00</field> </shadow> <block type="time_astro" id=")x68iEhb1#5Rl9EZ=KNf"> <field name="TYPE">sunriseEnd</field> <field name="OFFSET">0</field> </block> </value> <value name="END_TIME"> <shadow type="text" id="xuzF!9;ZY5~dfKq3CrNi"> <field name="TEXT">18:00</field> </shadow> <block type="time_astro" id="L//m{HYwob}w|rc$wQBw"> <field name="TYPE">sunsetStart</field> <field name="OFFSET">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="controls_if" id="sOvx5_pk|Z(_#k]o~inN"> <mutation elseif="3"></mutation> <value name="IF0"> <block type="logic_operation" id="Cvo%.o+Mf+Cy:|Cl@jyi" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="ShU@2AK9qOP,4eKdETLy"> <field name="OP">GTE</field> <value name="A"> <block type="variables_get" id="uRI*HeJSOEon;0T}H,{C"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="M%^BS$42F-/D:A*ZxHx5"> <field name="NUM">500</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="!0|T4misb)Awlw,GoA@I"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="qLXk}.;(]!E;+f9uY+Vz"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="`M$N%}!,Y45)NJL!ziC}"> <field name="NUM">6</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id=",/Tr,pl#HG]5/3u@`l0g"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.value.wetterbedingung_sonne_wind</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="[YE[yfzFgjGT-!0~:n}Z"> <field name="NUM">3</field> </block> </value> <next> <block type="debug" id="AK}h%oQlVOP+2k|77zk|"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="86xRP5Jd%4+l.[Cqp_rm"> <field name="TEXT">State drei hat ausgelöst</field> </shadow> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_operation" id="DgE}P(k`Ao$x4)K|~,45" inline="false"> <field name="OP">OR</field> <value name="A"> <block type="logic_operation" id="q`99=/X/{lB8uxl,Fs]k" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_operation" id="4TfQDmnsl2F+=@NozM*^"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="#aEV-Rsw)Ui.sVyEm2xb"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="9~X1K|VPIB?AdI92R{L|"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="+6F*$R]gI{^r64ms*xcT"> <field name="NUM">500</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="[?J7+EUVtmvjNiahKHrc"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="~/*K/]|6o+`z#n5XoQ~o"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="u5)4HM5k6eb1K4+`DXMg"> <field name="NUM">250</field> </block> </value> </block> </value> </block> </value> <value name="B"> <block type="logic_operation" id="q`A2zh^jo.gWF7:q*gFH"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="hO04/(D_QU8o[jSJAYlB"> <field name="OP">GTE</field> <value name="A"> <block type="variables_get" id="a1PwEu#2%01=T7_$Romc"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="TY[B:|6D!J2$SW)cXs?3"> <field name="NUM">6</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="?Be[c([e+VL9T:T-Yg?o"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="pE:uUm.;7QfRQ2gY%ni#"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="E;+i)o]0`s=Mt9HW2:lm"> <field name="NUM">15</field> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <block type="logic_operation" id="GMg;~TFD/sf+,ULS1GPG" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="lL~v$bC*!+7B`(^b)l[p"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="NY#Q|4h$;**)Rbe1%Cx("> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="`{C@CXW+zS|E5@K$8J[G"> <field name="NUM">170</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="0~T/3!{$d^M!m)x9=%2G"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="^+I1af)z5?/?r2~2vtk9"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="u:lY;m=uIK3vJ=w*OBx`"> <field name="NUM">6</field> </block> </value> </block> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id="{rZFA~-BGj*F34(Zw]Gw"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.value.wetterbedingung_sonne_wind</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="o8,|o*am|)Xuc+A:wSiJ"> <field name="NUM">2</field> </block> </value> <next> <block type="debug" id="/Nhj:K6Qx+)%,#a|wX}Z"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="n02f}N$0q6b7-k_?TYZJ"> <field name="TEXT">State zwei hat ausgelöst</field> </shadow> </value> </block> </next> </block> </statement> <value name="IF2"> <block type="logic_operation" id="a$h+]RiLz3-A*7wk}@dk" inline="false"> <field name="OP">OR</field> <value name="A"> <block type="logic_operation" id="M]eeqOXKjJ_j*JbI:1N;" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_operation" id="FxQ7Q}-7xHl^(wPOcJr9"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="Q_Mz,0Zs)__hlYbtr,q{"> <field name="OP">LTE</field> <value name="A"> <block type="variables_get" id="-std)`_}o0D?CsGX?D*P"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="SaGYCr1t@Vn|N~jxieUP"> <field name="NUM">250</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="J3!=S5AoaJ^I#oo?-{F@"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="[3HF:MCt;W4`3TryE%vb"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="?ef:Rfj:}au{D:udOs3*"> <field name="NUM">130</field> </block> </value> </block> </value> </block> </value> <value name="B"> <block type="logic_operation" id="^Sa3b|p*zR2)lP2kHZFO"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="-qkA_RMgQRJUJ|Bi@a2-"> <field name="OP">GTE</field> <value name="A"> <block type="variables_get" id="ez)f+OV6?9(IaV)8su;9"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="gF~n=EczPeY!3~scc|0S"> <field name="NUM">6</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="zq#@!gN?jP`|k#Kj+{+7"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="KFy+.{:Lw=vap=Dl50f,"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="Uz^fYe`XRp3V_+;ibxZ?"> <field name="NUM">15</field> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <block type="logic_operation" id="`Eo=}a:?5q)gnK*NFbLJ" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_operation" id="WI0qaxTH6UU1fBuRaqV,"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="]G(wWzLT^6f7KcdJ4=B]"> <field name="OP">LTE</field> <value name="A"> <block type="variables_get" id="59gxqDyf+88=[YE(mnW;"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="z`mdSt3Z5fFo~5=YA.+{"> <field name="NUM">500</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="/$yWyYa[yDmidA6f.eXq"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="1N[DxmwkedMY[EtG5XxA"> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="SwB/V-pj(R*F{(1-05K0"> <field name="NUM">250</field> </block> </value> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="FxKOkBkW2-PMXL-3v,iB"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="Rn}GuX~Z(5e3k]^rJCLL"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="41wFkE{AmLB(oz7S/rVv"> <field name="NUM">12</field> </block> </value> </block> </value> </block> </value> </block> </value> <statement name="DO2"> <block type="update" id="}Qj}g.-e7Dt*+j+6OyWy"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.value.wetterbedingung_sonne_wind</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="QG??yD}HoMEbF,B$7_`M"> <field name="NUM">1</field> </block> </value> <next> <block type="debug" id="zb.JE`:(LN7p)s.wlaLN"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="kG3tk17(pFA#5:5F1R$9"> <field name="TEXT">State eins hat ausgelöst</field> </shadow> </value> </block> </next> </block> </statement> <value name="IF3"> <block type="logic_operation" id="f.{ObFiR1Zuo_ZZT6[wg"> <field name="OP">OR</field> <value name="A"> <block type="logic_compare" id="XjuE7@.TgO#oL-xzI@Zr"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="bu]ydJ1p4IXkRI@,=MY="> <field name="VAR" id="$Z[`Z?5`{Fqt@y2UHaxV">Sonnenschein</field> </block> </value> <value name="B"> <block type="math_number" id="8+crid*L;+{,:Wnt1MC/"> <field name="NUM">130</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="iNZoor3]O_/l10:Nc^H8"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="8.Q$iDdohmOXs_lRC1Y0"> <field name="VAR" id="mstO3~jL5t|G{mXscjk7">Wind</field> </block> </value> <value name="B"> <block type="math_number" id="I`UQHlr$=9?`6$5`QsUc"> <field name="NUM">15</field> </block> </value> </block> </value> </block> </value> <statement name="DO3"> <block type="update" id="!H6~GNm@Y8*(t55j7i*#"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.value.wetterbedingung_sonne_wind</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="09EXLL%Ei4Q[;IHPA@U6"> <field name="NUM">0</field> </block> </value> <next> <block type="debug" id="aSm4AcpEhq]HK/_.KldU"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id=":l-`_L5%EWVou*Fpt]BS"> <field name="TEXT">State Null hat ausgelöst</field> </shadow> </value> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@gezi70 sagte in Skript nach Änderung Timeout - wo einfügen?:
vielleicht kann mir von euch jemand helfen?
dazu müsste man das Skript kennen, oder das Blockly sehen.
-
@homoran bin gerade überm Bildschirmfoto. Ich hänge es oben hinter dem Skript noch an.
-
Ich habe es auf diese Art und Weise hinbekommen (testweise erstmal auf 5 min).
Es sieht etwas dilettantisch aus - geht es auch sauberer? -
-
@codierknecht sagte: Du könntest mit einer Sperrvariablen arbeiten.
Dazu kann die Variable
timeout
direkt dienen, die in Blockly seit JS-Version 7.0.5 automatisch auf null gesetzt wird.So werden allerdings auch starke Windböen ausgeblendet.
-
@paul53 @Codierknecht Nachdem ich in den Protokollen meiner Murkserei wieder Unregelmäßigkeiten entdeckt habe, versuche ich mal nacheinander euere Versionen.
Auf jeden Fall danke ich euch erstmal. -
@paul53 sagte in Skript nach Änderung Timeout - wo einfügen?:
So werden allerdings auch starke Windböen ausgeblendet.
Wobei sich die Frage stellt, ob der Antrieb überhaupt schnell genug reagieren kann, um bei kurzen heftigen Böen das Fenster zu schließen.
-
@codierknecht
Das Fenster reagiert nicht auf Böen. Die werden leider nicht von der Wetterstation ausgelesen. Dafür nehme ich eben die normale Windgeschwindigkeit, die ja vor Böen auch immer erhöht ist. Aus der Sonneneinstrahlung (Helligkeit) und der Windgeschwindigkeit habe ich durch hin- und herprobieren Werte "ermittelt", die in 4 Stufen das Fenster mehr oder weniger öffnen. Das ist auch wieder abhängig von der vorhergesagten Tageshöchsttemperatur. Was ich noch einbinden will ist die Windrichtung, denn wenn der Wind von Osten / Südosten bläst ist das eigentlich unrelevant, da das Fenster nach Westen öffnet.