NEWS
Abstände zwischen mehreren Events berechnen (Blockly)
-
@passuff Kann Dein Script leider nicht importieren.
Nach Deiner Beschreibung vermute ich mal, dass Du die timeouts mehrmals startest ohne sie vorher zu beenden.Grüße
-
@passuff sagte in Abstände zwischen mehreren Events berechnen (Blockly):
Hier ist mein aktueller Code. Ich würde mich freuen wenn jemand mal drüber gucken kann. Ich vermute es benötigt einen neuen Ansatz.
Herzlichen Glückwunsch - der Code ist unlesbar. Es fehlen die
Code Tags
Ich hab mehrmals versucht den Code zu importieren. Geht nicht.
Eine Frage habe ich aber trotzdem: Wofür brauchst du bei der Fragestellung Timeouts ?
Du hast im Trigger mit dem Baustein
Zugriff auf:
- den Timestamp der aktuellen Änderung
- den Timestamp der letzten Änderung
- den aktuellen Wert
- den letzten Wert
Damit solltest du direkt im Trigger die von Dir gewünschten Dinge berechnen können ohne das Du timeouts benutzt.
A.
Nachtrag: Ich würde das so lösen:
-
Annahme: Datenpunkt = true heisst Brenner ist an.
-
Variable "LetztesMalEingeschaltet" = 0
-
Trigger auf Wert ist grösser als vorher
-
Einschaltabstand = "LetztesMalEingeschaltet - Timestamp aktuelle Änderung.
-
"LetztesMalEingeschaltet" = Timestamp aktuelle Änderung
ggf. musst du den Timestamp noch konvertieren, glaube ich aber nicht, so wie ich das erinnere liefert der ms, relativ zu einem Ursprungsdatum
A.
-
@Asgothian
Vielen Dank für deine Tipps.
Ich habe die Blöcke exportiert. Ich habe es gerade nochmal getestet und kann diese auch wieder importieren. Ich weiß nicht weshalb es bei dir nicht funktioniert.
Dein Ansatz den Abstand zu berechnen gefällt mir, das klingt etwas einfacher als bei mir. Der erste Abstand ist aber m.E. nicht das Problem, sondern der zweite. Ich vermute bei mir den Fehler beim "umschichten" der Abstände (neuer Abstand = alter Abstand ) und dem typischen JS Problem, dass Befehle nicht nacheinander abgearbeitet werden. Daher nutze ich Timeouts. Ohne diese Timeouts funktioniert das Skript überhaupt nicht. -
@passuff bist du sicher das du das aus dem post noch einmal heraus kopiert hast ? ich hab das noch mehrmals probiert und bekomme immer xml parser errors.
poste doch mal einen Screenshot vom Script, dann können wir sehen wie das Script aussieht.
A.
-
@Asgothian
gerade nochmal versucht - funktioniert einwandfrei.
Das Skript ist sehr lange. Dann müsste ich viele Screenshots erstellen - das wird sehr unübersichtlich.
Wie exportierst/importierst du skripte? In der Blockly oder in der JS Ansicht? -
@passuff In der Blockly Ansicht
-
@Asgothian Nachfrage: hast du irgendwie Telegramm oder Alexa Blöcke im Skript ? Beide Adapter laufen bei mir nicht, deswegen fehlen die Blöcke auch
-
@passuff Pass doch bitte deinen Post mit dem XML so an das der XML in Code tags gesetzt ist, dann kann ich nochmal versuchen das zu importieren.
A.
-
@passuff sagte:
dass Befehle nicht nacheinander abgearbeitet werden. Daher nutze ich Timeouts. Ohne diese Timeouts funktioniert das Skript überhaupt nicht.
Timeouts sind nicht erforderlich, wenn folgendes Prinzip angewendet wird:
letzte Änderung findet man unter "Trigger" und es enthält den aktuellen Startzeitpunkt.
-
@Asgothian sagte in Abstände zwischen mehreren Events berechnen (Blockly):
@Asgothian Nachfrage: hast du irgendwie Telegramm oder Alexa Blöcke im Skript ? Beide Adapter laufen bei mir nicht, deswegen fehlen die Blöcke auch
Nein, weder Alexa noch Telegram.
@passuff Pass doch bitte deinen Post mit dem XML so an das der XML in Code tags gesetzt ist, dann kann ich nochmal versuchen das zu importieren.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable type="timeout" id="timeout15">timeout15</variable> <variable id="5t9p`1Dxw,$Hk*h.$xcg">Zeitstempel3_lokal</variable> <variable type="timeout" id="timeout16">timeout16</variable> <variable id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</variable> <variable type="timeout" id="timeout17">timeout17</variable> <variable id="Vy[aoB}!u@F)cFH@mb/0">Zeitstempel1_lokal</variable> <variable type="timeout" id="timeout18">timeout18</variable> <variable id="d2Hca]CPU+D32`h3H=BU">Abstand1_lokal</variable> <variable type="timeout" id="timeout19">timeout19</variable> <variable id="1AoS_%+:!c@4+#30Vfwe">Abstand2_lokal</variable> <variable type="interval" id="Intervall2">Intervall2</variable> <variable type="timeout" id="timeout20">timeout20</variable> </variables> <block type="on_ext" id="![=JFmD0UB1vtF~|D`i^" x="238" y="590"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="}.GxRXPD[M2S[cQVqH;+"> <field name="oid">viessmann.0.get.VitoStartsBrenner</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="7HlOlU2L}V*ajD$g[2?V"> <value name="IF0"> <block type="logic_compare" id="G[M;=~wX%eR1y6S3Bp0?"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="?nU*vx5UEcW,h10-9:LQ"> <field name="ATTR">val</field> <field name="OID">viessmann.0.get.VitoStatusWW</field> </block> </value> <value name="B"> <block type="math_number" id="(N5s_A;npDPuOB,KLj{H"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="timeouts_settimeout" id="QdNR{j4j-R|H12tkS]OT"> <field name="NAME">timeout15</field> <field name="DELAY">100</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="variables_set" id="O(fNI_zEq`Wveou,ZN^S"> <field name="VAR" id="5t9p`1Dxw,$Hk*h.$xcg">Zeitstempel3_lokal</field> <value name="VALUE"> <block type="variables_get" id="(b_hqSV{U5i_JX^Zla-4"> <field name="VAR" id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</field> </block> </value> <next> <block type="debug" id="gH1.Ho}BG1NW6xTLp(b|"> <field name="Severity">log</field> <value name="TEXT"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="text"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="if?k_%lLCm:VJ@T[SEoi"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="-L9#zCqB8#w_FI!aQ.%h"> <field name="TEXT">Zeitstempel zwei Brennerstarts zuvor: </field> </block> </value> <value name="ADD1"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="variables_get" id=".vg#,tfOEKE^JYZ(::^P"> <field name="VAR" id="5t9p`1Dxw,$Hk*h.$xcg">Zeitstempel3_lokal</field> </block> </value> <value name="ADD2"> <block type="text" id="R^BmzC3tn..VobsbUSoo"> <field name="TEXT"> min</field> </block> </value> </block> </value> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="wx9CQ}h?Isym3TFg0JxW"> <field name="NAME">timeout16</field> <field name="DELAY">200</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="variables_set" id="w$Xp5d@5XB?*oV60OUMr"> <field name="VAR" id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</field> <value name="VALUE"> <block type="variables_get" id="[c%eKeX4yJ^c7CWHieYd"> <field name="VAR" id="Vy[aoB}!u@F)cFH@mb/0">Zeitstempel1_lokal</field> </block> </value> <next> <block type="debug" id="[|V]B|Bi*FmNvu4M[B9."> <field name="Severity">log</field> <value name="TEXT"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="text"> <field name="TEXT"></field> </shadow> <block type="text_join" id="$22k$xMtESSD/LU)=AZZ"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="L*%35_O}uiiD(o}#X~[]"> <field name="TEXT">Zeitstempel ein Brennerstart zuvor: </field> </block> </value> <value name="ADD1"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="variables_get" id="{%rh+kvn8#XPRw[@6$7g"> <field name="VAR" id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</field> </block> </value> <value name="ADD2"> <block type="text" id="-c!e^_OC3uti3Ko(p}?@"> <field name="TEXT"> min</field> </block> </value> </block> </value> <next> <block type="variables_set" id=")bLkU2c+ueuaq5e+I{j7"> <field name="VAR" id="Vy[aoB}!u@F)cFH@mb/0">Zeitstempel1_lokal</field> <value name="VALUE"> <block type="math_round" id="e53+s-ZEMM0EwsdO4{Rb"> <field name="OP">ROUND</field> <value name="NUM"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="!.u3jkS$OIwzWQJq|kov"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="on_source" id="b.)@eG`LDxg7:Xe,VA%U"> <field name="ATTR">state.ts</field> </block> </value> <value name="B"> <shadow type="math_number" id="C{Z/CKfe{}Q?hNk4(5N%"> <field name="NUM">60000</field> </shadow> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="0CEr(SwQ{Ji::6d?s;;B"> <field name="NAME">timeout17</field> <field name="DELAY">300</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="debug" id="o0{OCKkLv6{UsKkehy07"> <field name="Severity">log</field> <value name="TEXT"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="text"> <field name="TEXT">test</field> </shadow> <block type="text_join" id=";/@_22:yltE*a:p@!oyQ"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="5S3cg[pD;U6z?Pj58Z*b"> <field name="TEXT">Zeitstempel aktueller Brennerstart: </field> </block> </value> <value name="ADD1"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="variables_get" id="L_t$@ycd}zlzRdVge!Ef"> <field name="VAR" id="Vy[aoB}!u@F)cFH@mb/0">Zeitstempel1_lokal</field> </block> </value> <value name="ADD2"> <block type="text" id="3S([iSuZQ*|SNNVTL%9#"> <field name="TEXT"> min</field> </block> </value> </block> </value> </block> </statement> <next> <block type="timeouts_settimeout" id="H%e.Sqgt.LImej1XhtnC"> <field name="NAME">timeout18</field> <field name="DELAY">400</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="variables_set" id="%w%$W4E43g~3pBjrk._N"> <field name="VAR" id="d2Hca]CPU+D32`h3H=BU">Abstand1_lokal</field> <value name="VALUE"> <block type="math_arithmetic" id="X2aeV2^Ca5#uQMVqcel*"> <field name="OP">MINUS</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="(#newn(BEI/@40^1`zc1"> <field name="VAR" id="Vy[aoB}!u@F)cFH@mb/0">Zeitstempel1_lokal</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="KmfKkHIdaBaeoy(3ZL-Y"> <field name="VAR" id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</field> </block> </value> </block> </value> <next> <block type="comment" id="~7,f2lw,J5XprZ0Md0ER"> <field name="COMMENT">Abstand Taktung1= Zeitstempel1-Zeitstempel2 [min]</field> <next> <block type="debug" id="yi(c@6v_DkPZ9{_]%GC!"> <field name="Severity">log</field> <value name="TEXT"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="text"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="h1[^^d(P0hOZOV_^U%2+"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="%]1#|L|1Tbg||xJwxJu!"> <field name="TEXT">Abstand zwischen aktuellem und vorherigem Brennerstart : </field> </block> </value> <value name="ADD1"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="variables_get" id="(|v|)S@`_V/WIPUR|=Q5"> <field name="VAR" id="d2Hca]CPU+D32`h3H=BU">Abstand1_lokal</field> </block> </value> <value name="ADD2"> <block type="text" id="8ZCHZIuGMTRzt:H#+uJ("> <field name="TEXT"> min</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="CB-yH~p=l|`H3fmSQW05"> <field name="NAME">timeout19</field> <field name="DELAY">500</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="variables_set" id="hGibDc2pcK;=j%p`kU|u"> <field name="VAR" id="1AoS_%+:!c@4+#30Vfwe">Abstand2_lokal</field> <value name="VALUE"> <block type="math_arithmetic" id="Y=idd}Jln}3b6N,}XY4l"> <field name="OP">MINUS</field> <value name="A"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="CUXYMOXfgP=I^rQ@Oy=)"> <field name="VAR" id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</field> </block> </value> <value name="B"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="Gl74d0I6,][(*kFsyJp7"> <field name="VAR" id="5t9p`1Dxw,$Hk*h.$xcg">Zeitstempel3_lokal</field> </block> </value> </block> </value> <next> <block type="comment" id="yQ9Q]DPHi?wlf~*|K6eI"> <field name="COMMENT">Abstand Taktung1= Zeitstempel2-Zeitstempel3 [min]</field> <next> <block type="debug" id="[KFi4^XRnD_Av[y7@Q#?"> <field name="Severity">log</field> <value name="TEXT"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="text"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="/.Hd{st}N})FEtilr%[D"> <mutation items="3"></mutation> <value name="ADD0"> <block type="text" id="q:E~v$3N_l@}$PhJ)T)`"> <field name="TEXT">Abstand zwischen vorletztem und letztem Brennerstart: </field> </block> </value> <value name="ADD1"> <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="variables_get" id="c8he;m0JdL20:E1zfg^-"> <field name="VAR" id="1AoS_%+:!c@4+#30Vfwe">Abstand2_lokal</field> </block> </value> <value name="ADD2"> <block type="text" id="vIQ/}}mVY`l+Cc.5Kb3,"> <field name="TEXT"> min</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_setinterval" id="d@w4smoXSX|*cT-^r=nm"> <field name="NAME">Intervall2</field> <field name="INTERVAL">1000</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="update" id="Vh.:?h3Jd!esppCzt%$6"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Heizung.Brenner.Zeitstempel1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_tonumber" id="]K!|.b:;aSn97}+*ldyi"> <value name="VALUE"> <block type="variables_get" id="N`V@m(N8u4a-{4}Bis}t"> <field name="VAR" id="Vy[aoB}!u@F)cFH@mb/0">Zeitstempel1_lokal</field> </block> </value> </block> </value> <next> <block type="update" id="XL3OaIU70vtxf-{8DQM["> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Heizung.Brenner.Zeitstempel2</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_tonumber" id="ITr?dx~[9O[9QHy:d%!3"> <value name="VALUE"> <block type="variables_get" id="L}y%i5W!kN(n=YitCNpR"> <field name="VAR" id="w5DgCBDMyFCt5c(S./|!">Zeitstempel2_lokal</field> </block> </value> </block> </value> <next> <block type="update" id="Pu(Mps4x2=o:$**`;E|q"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Heizung.Brenner.Zeitstempel3</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_tonumber" id="gN73k(Tb#]KdN1B$~!--"> <value name="VALUE"> <block type="variables_get" id="*/OiCXrIRGKF9dNcli~$"> <field name="VAR" id="5t9p`1Dxw,$Hk*h.$xcg">Zeitstempel3_lokal</field> </block> </value> </block> </value> <next> <block type="update" id="n=?%O(J[1Fe%Ho*{JtRH"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Heizung.Brenner.Abstand1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_tonumber" id="y{$0O;HLt4/^3@tXpJjN"> <value name="VALUE"> <block type="variables_get" id="+m:rmF]T]6))|8kQ,a@n"> <field name="VAR" id="d2Hca]CPU+D32`h3H=BU">Abstand1_lokal</field> </block> </value> </block> </value> <next> <block type="update" id="O]NWDtF}q#_BE,Bu8yJw"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Heizung.Brenner.Abstand2</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_tonumber" id="Vn/s5r1w@9+3$F-SbR3R"> <value name="VALUE"> <block type="variables_get" id="#|JujysL|6{4JtG@?QtQ"> <field name="VAR" id="1AoS_%+:!c@4+#30Vfwe">Abstand2_lokal</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="{t96;`LdE4o2pEe;t@xr"> <field name="NAME">timeout20</field> <field name="DELAY">1200</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="controls_if" id="(1el,P[!}V:`|+:k;/D~"> <value name="IF0"> <block type="logic_operation" id="S}:%U%6@1wK9+}(R`xcB"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="lgN$TXl)@u{?)7WrAg.@"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="3LG[owD|:-zt.0htp!=`"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Heizung.Brenner.Takten_erkannt</field> </block> </value> <value name="B"> <block type="logic_boolean" id="+KvB([iRAJTu*L*54:a~"> <field name="BOOL">FALSE</field> </block> </value> </block> </value> <value name="B"> <block type="logic_operation" id=".A~AYpPpJR{7(C$m,L)s"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="#^ln{:;.G08c=t/JoG]L"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="7)W^0IK8#5RPyc}+u^)w"> <field name="VAR" id="d2Hca]CPU+D32`h3H=BU">Abstand1_lokal</field> </block> </value> <value name="B"> <block type="math_number" id="_ZJ1n]SVr~t[Y`IOI#$7"> <field name="NUM">18</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="8_YS%}iwNq$ZOQ,,%HX*"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="LS^))4j+qlx%fsa}8FZH"> <field name="VAR" id="1AoS_%+:!c@4+#30Vfwe">Abstand2_lokal</field> </block> </value> <value name="B"> <block type="math_number" id="4V-Y)n!^$Y:BcNvhhJ:z"> <field name="NUM">18</field> </block> </value> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="hHx+C:gYwPHn50nNcH)v"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Heizung.Brenner.Takten_erkannt</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="H#5BJfNcPi)4$y9Vh;;B"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="comment" id="Q/_c9^D[CM@lPne9]gCz"> <field name="COMMENT">falls Abstand 1 und 2 < 10min, dann Brennertakten erkannt = 1</field> <next> <block type="debug" id="lue$qzaw!v0.eqfZ/{=}"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="D_cek6$LX(]TK54Ga-i8"> <field name="TEXT">Brennertakten erkannt </field> </shadow> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </xml>
-
@passuff
Ich habe mal sämtliche Timeouts entfernt und die Startzeiten im lesbaren Format "hh:mm:ss" (string) ausgegeben:Wie wird "Takten_erkannt" zurück gesetzt ?
EDIT: Bild
-
So - jetzt konnte ich es auch importieren:
die gute Nachricht: Alle Timeouts die ich gesehen habe sind unnötig. Warum:
- Die Timeouts 15-19 arbeiten nur mit Variablen. Da gibt es nichts asynchrones.
- Der Timeout 20 ist auch unnötig - der Datenpunkt den du liest (Takten erkannt) wird sicher erst nach dem lesen gesetzt.
- Du hast um das setzen der Datenpunkte ein Intervall. Das ist sicherlich nicht ok. Unnötig ist es auch. Die Datenpunkte machen im übrigen nur Sinn wenn du zu beginn des Skriptes die entsprechenden Variablen aus den Datenpunkten initialisierst.
(@paul53 war schneller
)
-
@paul53
VielenDank dafür. Ich habe importier, aber irgendwie stört sich iobroker an den Zeilen 10, 11, 12 (aktualisiere Zeitstempel 1-3).javascript.0 (14906) script.js.common.Heizung_Kamin.Takten_Erkennen: setForeignState(id=0_userdata.0.Heizung.Brenner.Zeitstempel3, state={"val":"NaN:NaN:NaN","ack":true}) - wurde nicht ausgeführt, während der Debug-Modus aktiv ist
Das skript scheint aber zu laufen...
-
@Asgothian
Du hast vermutlich völlig recht, dennoch hat es mit timeouts meistens funktioniert und ohne gar nicht. Ohne habe ich als Abstand immer "null" erhalten.
Warum das so war, kann ich nicht sagen - war nur eine Beobachtung. Vl kam noch eine andere Störgröße hinzu. -
@passuff
Ändere den Datenpunkt-Typ der 3 Startzeiten in "Zeichenkette" (string).
Wenn es die Zeilen 10, 11, 12 sind, hast Du die Initialisierung der beiden Variablen letzter_Start und vorletzter_Start oberhalb des Triggers noch nicht drin (hatte ich nachträglich ergänzt).Vor dem ersten Skriptstart trage manuell sinnvolle Zeiten im Format "hh:mm:ss" in die beiden Datenpunkte ein.
-
Super, funktioniert wie es soll. Danke euch allen!