Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Zeitdifferenz berechnen

    NEWS

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    Zeitdifferenz berechnen

    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      newbie2007 @paul53 last edited by

      @paul53 Hallo,

      ich möchte gerne die Laufzeit meines Roombas mit Hilfe der Start- und der Endzeit berechnen und habe folgendes Blockly gemacht. Allerdings wird die Differenz/Laufzeit nicht korrekt berechnet. Die berechnete Dauer ist im Bsp. 2St. 16min. Tatsächlich sind es aber 1 Std. und 16 min.
      Wer kann mir helfen?
      5FA0B048-D03C-4567-BEE6-2ECC6B858C0B.jpeg

      Homoran 1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @newbie2007 last edited by

        @newbie2007 Die berechnette Zeit in Millisekunden ist noch richtig. Sie wird im folgenden jedoch als Timestamp vom 01.01.1970 berechnet und so weit ich mich erinnern kann in der falschen Zeitzone

        N paul53 2 Replies Last reply Reply Quote 0
        • N
          newbie2007 @Homoran last edited by

          @homoran was kann ich tun?

          1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Homoran last edited by

            @homoran sagte: in der falschen Zeitzone

            Ja, siehe hier.

            N 1 Reply Last reply Reply Quote 1
            • N
              newbie2007 @paul53 last edited by

              @paul53 Das war´s.

              Danke euch beiden.

              1 Reply Last reply Reply Quote 0
              • P
                PatrickFro last edited by PatrickFro

                Ich schließe mich mit einem ähnlichen Thema mal an..

                Ich möchte nach Beginn einer Aktion, die per Bool festgehalten wird, nach 20 Sekunden feststellen, ob sie in den letzten 10 Sekunden weiter ausgeübt wurde

                c2ea5055-f8aa-4013-937a-5ed3af5669df-image.png

                <block xmlns="https://developers.google.com/blockly/xml" type="on" id="jK!Srf4|s?My,i]Z?.e_" x="38" y="37">
                  <field name="OID">zigbee.1.00158d000799f9ae.opened</field>
                  <field name="CONDITION">ne</field>
                  <field name="ACK_CONDITION"></field>
                  <statement name="STATEMENT">
                    <block type="controls_if" id="FDm6(4_CSQM.|d^|cYG2">
                      <value name="IF0">
                        <block type="logic_compare" id="72v{*O0YKSIW;h)t.%wM">
                          <field name="OP">EQ</field>
                          <value name="A">
                            <block type="on_source" id="(65c_U3)Y7RM59}@$|Kr">
                              <field name="ATTR">state.val</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_boolean" id="?~ft#;0JMLPi^5_=iFmQ">
                              <field name="BOOL">TRUE</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO0">
                        <block type="controls_if" id="HMVL(8UgPCqNF2+seN/5">
                          <value name="IF0">
                            <block type="logic_compare" id="{p,x[K=9#5HqN6]e4/;8">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="~`RyQBMVd+],i;a3%/Ou">
                                  <field name="ATTR">val</field>
                                  <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="At+vP+3x:dXo*226VG:1">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO0">
                            <block type="update" id="x]/[eU$U^~U?E~Yb%2Z)">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="i.NxT_cZm:D3pDq|nfYY">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                              <next>
                                <block type="update" id="CqBYKGD%HdGVtp.D-`=}">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                  <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                  <field name="WITH_DELAY">TRUE</field>
                                  <field name="DELAY_MS">2</field>
                                  <field name="UNIT">min</field>
                                  <field name="CLEAR_RUNNING">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="U6f`+?oKBw0xTIG*|lsb">
                                      <field name="BOOL">FALSE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="zqFe_u[sWLj;+]dMW##1">
                                      <field name="VAR" id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</field>
                                      <value name="VALUE">
                                        <block type="math_arithmetic" id="MQ6nN[*zAT8GVfWg1;-O" inline="false">
                                          <field name="OP">MINUS</field>
                                          <value name="A">
                                            <shadow type="math_number" id="uvD{f=e]!:O/B,9ALM*y">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="time_get" id="|wMCWeum)VGvX$e~)i4R">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                              <field name="OPTION">object</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="Bz#Vj4[#pNfW8n`Wr+[m">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="on_source" id="A~{K`b1A3*:7V2.%c:=4">
                                              <field name="ATTR">state.ts</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="timeouts_wait" id="ca*Hm,2ZbBK$qTmx;#)4">
                                          <field name="DELAY">20</field>
                                          <field name="UNIT">sec</field>
                                          <next>
                                            <block type="comment" id="6#xzLsShVx+oic{%WeO;">
                                              <field name="COMMENT">Zeitberechnung: erste Zahl für Start bei 00:00</field>
                                              <next>
                                                <block type="comment" id="PeRcRKspnBrM1f!.o6Zn">
                                                  <field name="COMMENT">1000 für 1 Sekunde x 10</field>
                                                  <next>
                                                    <block type="comment" id="dKTi=DXeE:d~t:`oElVJ">
                                                      <field name="COMMENT">Zeitdifferenz darf maximal &lt;10 Sekunden sein</field>
                                                      <next>
                                                        <block type="controls_if" id="~jT?0Z)3UnK1.zIu0LJS">
                                                          <value name="IF0">
                                                            <block type="logic_compare" id=":GPAg!:7I%ju?fd)KX0E" inline="false">
                                                              <field name="OP">LT</field>
                                                              <value name="A">
                                                                <block type="convert_from_date" id="czfF9^;@3a@u.-_-nu{G">
                                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                  <field name="OPTION">hh:mm:ss</field>
                                                                  <value name="VALUE">
                                                                    <block type="variables_get" id="SROQT(0H9:`1U/|,B7Fc">
                                                                      <field name="VAR" id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</field>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                              <value name="B">
                                                                <block type="convert_from_date" id="cZos(T}ax%]7`},ACGmj">
                                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                  <field name="OPTION">hh:mm:ss</field>
                                                                  <value name="VALUE">
                                                                    <block type="math_arithmetic" id="@C-m9AQ}$VRn$dkvAmrS">
                                                                      <field name="OP">ADD</field>
                                                                      <value name="A">
                                                                        <shadow type="math_number" id=".H8tQuQ;VnV8w2ZW@|%h">
                                                                          <field name="NUM">-3600000</field>
                                                                        </shadow>
                                                                      </value>
                                                                      <value name="B">
                                                                        <shadow type="math_number" id="/Jsy}]]3/khN%]%JMKI)">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="math_arithmetic" id="9ToNQ#]u8^EP]_?=nvtk">
                                                                          <field name="OP">MULTIPLY</field>
                                                                          <value name="A">
                                                                            <shadow type="math_number" id="x*HYUV1ky~+[EDmXu@Tz">
                                                                              <field name="NUM">1000</field>
                                                                            </shadow>
                                                                          </value>
                                                                          <value name="B">
                                                                            <shadow type="math_number" id="#~^=`kMd}9)_t|v;.N]9">
                                                                              <field name="NUM">10</field>
                                                                            </shadow>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                          <statement name="DO0">
                                                            <block type="telegram" id="pB:;!`u9TxYb{eB+GSJO">
                                                              <field name="INSTANCE">.1</field>
                                                              <field name="LOG"></field>
                                                              <field name="SILENT">FALSE</field>
                                                              <field name="PARSEMODE">default</field>
                                                              <value name="MESSAGE">
                                                                <shadow type="text" id="`w]AkcjR$}Tus_1HsmPo">
                                                                  <field name="TEXT">Testnachricht: Kurbeln längere Zeit gedreht</field>
                                                                </shadow>
                                                              </value>
                                                              <value name="USERNAME">
                                                                <block type="text" id="%?/-9(?N0.HXoD4gOL:l">
                                                                  <field name="TEXT">Patrick</field>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </statement>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </next>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </statement>
                        </block>
                      </statement>
                    </block>
                  </statement>
                </block>
                

                Leider komme ich einfach nicht drauf. Nach ca. 10 Stunden heutiger Beschäftigung mit IoBroker scheitere ich leider an der Berechnung, vielleicht auch an der Logik?

                Was mache ich falsch?

                paul53 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @PatrickFro last edited by paul53

                  @patrickfro sagte: einer Aktion,

                  Welche Aktion? Jede Wertänderung oder nur Änderung false --> true (öffnen)?

                  @patrickfro sagte in Zeitdifferenz berechnen:

                  nach 20 Sekunden feststellen, ob sie in den letzten 10 Sekunden weiter ausgeübt wurde

                  Weshalb erst nach 20 s?

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    PatrickFro @paul53 last edited by

                    @paul53 Jede Wertänderung, die bei aktiver Nutzung etwa 1-2 Mal pro Sekunde realistisch ist.

                    Nach 20 Sekunden möchte ich beim Start der Aktion testen, ob es nur eine Wertänderung aufgrund Verschieben des Gegenstandes ist oder ob wirklich Sport gemacht wird. Die 20 Sekunden sind willkürlich, könnten auch 30 Sekunden oder eine Minute sein.

                    paul53 1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 @PatrickFro last edited by

                      @patrickfro sagte: Jede Wertänderung

                      Vorschlag:

                      Bild_2021-12-08_001752.png

                      <xml xmlns="https://developers.google.com/blockly/xml">
                       <variables>
                         <variable id="P4J/pC!qmBM/1Z__aRWg">cnt</variable>
                         <variable id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</variable>
                         <variable type="timeout" id="timeout">timeout</variable>
                       </variables>
                       <block type="variables_set" id="d/jNs%DT4J/1*l?SN03^" x="63" y="13">
                         <field name="VAR" id="P4J/pC!qmBM/1Z__aRWg">cnt</field>
                         <value name="VALUE">
                           <block type="math_number" id="brpfPFO4,hfnn0rb%N^C">
                             <field name="NUM">0</field>
                           </block>
                         </value>
                         <next>
                           <block type="on" id="jK!Srf4|s?My,i]Z?.e_">
                             <field name="OID">zigbee.1.00158d000799f9ae.opened</field>
                             <field name="CONDITION">ne</field>
                             <field name="ACK_CONDITION"></field>
                             <statement name="STATEMENT">
                               <block type="variables_set" id="zqFe_u[sWLj;+]dMW##1">
                                 <field name="VAR" id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</field>
                                 <value name="VALUE">
                                   <block type="math_arithmetic" id="MQ6nN[*zAT8GVfWg1;-O" inline="false">
                                     <field name="OP">MINUS</field>
                                     <value name="A">
                                       <shadow type="math_number" id="uvD{f=e]!:O/B,9ALM*y">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="on_source" id="93mqKHm(M`hLmElkJQ5S">
                                         <field name="ATTR">state.lc</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <shadow type="math_number" id="Bz#Vj4[#pNfW8n`Wr+[m">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="on_source" id="^rsOSwuTg[J@hdSSu2~l">
                                         <field name="ATTR">oldState.lc</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="controls_if" id="Y%_)H%AK@R)fvL,aB4D$">
                                     <value name="IF0">
                                       <block type="logic_negate" id=":?FlLsbYm{.zN-[bZ)g^">
                                         <value name="BOOL">
                                           <block type="variables_get" id="]0?!t;E9Hq~?)pwd+#WM">
                                             <field name="VAR" id="timeout" variabletype="timeout">timeout</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="timeouts_settimeout" id="-@~Mtif+cgDPP[L:r-Nh">
                                         <field name="NAME">timeout</field>
                                         <field name="DELAY">20</field>
                                         <field name="UNIT">sec</field>
                                         <statement name="STATEMENT">
                                           <block type="variables_set" id="/ZG17;!yVU9?#U@ow`cc">
                                             <field name="VAR" id="P4J/pC!qmBM/1Z__aRWg">cnt</field>
                                             <value name="VALUE">
                                               <block type="math_number" id="P|Z3akKr[K_Tu:s~krie">
                                                 <field name="NUM">0</field>
                                               </block>
                                             </value>
                                             <next>
                                               <block type="variables_set" id="}re]Vg2D?(?fU^.|grmh">
                                                 <field name="VAR" id="timeout" variabletype="timeout">timeout</field>
                                                 <value name="VALUE">
                                                   <block type="logic_null" id="o}f]#}r:KRbuDc?O|jBb"></block>
                                                 </value>
                                               </block>
                                             </next>
                                           </block>
                                         </statement>
                                       </block>
                                     </statement>
                                     <next>
                                       <block type="comment" id="dKTi=DXeE:d~t:`oElVJ">
                                         <field name="COMMENT">Zeitdifferenz darf maximal &lt;10 Sekunden sein</field>
                                         <next>
                                           <block type="controls_if" id="HMVL(8UgPCqNF2+seN/5">
                                             <value name="IF0">
                                               <block type="logic_compare" id=":GPAg!:7I%ju?fd)KX0E">
                                                 <field name="OP">LT</field>
                                                 <value name="A">
                                                   <block type="variables_get" id="SROQT(0H9:`1U/|,B7Fc">
                                                     <field name="VAR" id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</field>
                                                   </block>
                                                 </value>
                                                 <value name="B">
                                                   <block type="math_number" id="0unIA@)v2Q~w@0CT[C%F">
                                                     <field name="NUM">10000</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <statement name="DO0">
                                               <block type="math_change" id="FiiU:QQ/R^C;+(/wf]vt">
                                                 <field name="VAR" id="P4J/pC!qmBM/1Z__aRWg">cnt</field>
                                                 <value name="DELTA">
                                                   <shadow type="math_number" id="+Anx@MLF)~l?PXLWmm;(">
                                                     <field name="NUM">1</field>
                                                   </shadow>
                                                 </value>
                                                 <next>
                                                   <block type="controls_if" id=":rgk1rFp!Sf@d6G86`4P">
                                                     <value name="IF0">
                                                       <block type="logic_operation" id="6XTSj{c@b[/og!~-lyx=" inline="false">
                                                         <field name="OP">AND</field>
                                                         <value name="A">
                                                           <block type="logic_compare" id="-M|#UyHG+Q)0o$L$Vafr">
                                                             <field name="OP">GT</field>
                                                             <value name="A">
                                                               <block type="variables_get" id="brKuBe9M`3K..voGI.nf">
                                                                 <field name="VAR" id="P4J/pC!qmBM/1Z__aRWg">cnt</field>
                                                               </block>
                                                             </value>
                                                             <value name="B">
                                                               <block type="math_number" id="GVx0yXUe6}Rad10Qz#/~">
                                                                 <field name="NUM">2</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                         <value name="B">
                                                           <block type="logic_compare" id="{p,x[K=9#5HqN6]e4/;8">
                                                             <field name="OP">EQ</field>
                                                             <value name="A">
                                                               <block type="get_value" id="~`RyQBMVd+],i;a3%/Ou">
                                                                 <field name="ATTR">val</field>
                                                                 <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                                               </block>
                                                             </value>
                                                             <value name="B">
                                                               <block type="logic_boolean" id="At+vP+3x:dXo*226VG:1">
                                                                 <field name="BOOL">FALSE</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                     <statement name="DO0">
                                                       <block type="update" id="x]/[eU$U^~U?E~Yb%2Z)">
                                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                         <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                                         <field name="WITH_DELAY">FALSE</field>
                                                         <value name="VALUE">
                                                           <block type="logic_boolean" id="i.NxT_cZm:D3pDq|nfYY">
                                                             <field name="BOOL">TRUE</field>
                                                           </block>
                                                         </value>
                                                         <next>
                                                           <block type="update" id="CqBYKGD%HdGVtp.D-`=}">
                                                             <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                                             <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                                             <field name="WITH_DELAY">TRUE</field>
                                                             <field name="DELAY_MS">2</field>
                                                             <field name="UNIT">min</field>
                                                             <field name="CLEAR_RUNNING">FALSE</field>
                                                             <value name="VALUE">
                                                               <block type="logic_boolean" id="U6f`+?oKBw0xTIG*|lsb">
                                                                 <field name="BOOL">FALSE</field>
                                                               </block>
                                                             </value>
                                                             <next>
                                                               <block type="telegram" id="pB:;!`u9TxYb{eB+GSJO">
                                                                 <field name="INSTANCE"></field>
                                                                 <field name="LOG"></field>
                                                                 <field name="SILENT">FALSE</field>
                                                                 <field name="PARSEMODE">default</field>
                                                                 <value name="MESSAGE">
                                                                   <shadow type="text" id="`w]AkcjR$}Tus_1HsmPo">
                                                                     <field name="TEXT">Testnachricht: Kurbeln längere Zeit gedreht</field>
                                                                   </shadow>
                                                                 </value>
                                                                 <value name="USERNAME">
                                                                   <block type="text" id="%?/-9(?N0.HXoD4gOL:l">
                                                                     <field name="TEXT">Patrick</field>
                                                                   </block>
                                                                 </value>
                                                               </block>
                                                             </next>
                                                           </block>
                                                         </next>
                                                       </block>
                                                     </statement>
                                                   </block>
                                                 </next>
                                               </block>
                                             </statement>
                                           </block>
                                         </next>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                           </block>
                         </next>
                       </block>
                      </xml>
                      

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        PatrickFro @paul53 last edited by

                        @paul53 Super, vielen Dank.

                        Ich glaube, ich habe mich unglücklich ausgedrückt.

                        Bei Start des möglichen Trainings, also der auf/zu-Schaltung, soll nicht sofort eine Benachrichtigung per Telegram kommen. Nach den ersten 20 Sekunden soll geschaut werden, ob innerhalb der letzten 10 Sekunden eine Bewegung, also eine auf/zu-Schaltung passierte. Ob danach weitere Schaltungen registriert werden, ist egal. Eine Benachrichtigung per Telegram erfolgt nur einmalig, wenn nach erster Schaltung weitere folgen. Nach der ersten Benachrichtigung ist eine Sperre von 60 Minuten (ich habe aus Testgründen 2 Minuten eingetragen). Würde die Aktion länger als eine Stunde durchgeführt werden, so erhielte ich eben eine weitere Nachricht.

                        Ich hoffe, das ist verständlicher. Es soll also geprüft werden, ob die fortlaufenden Schaltungen nur sehr kurz (<10 Sekunden) oder länger (> 10 Sekunden) durchgeführt werden.

                        paul53 1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @PatrickFro last edited by paul53

                          @patrickfro sagte: Nach den ersten 20 Sekunden soll geschaut werden, ob innerhalb der letzten 10 Sekunden eine Bewegung, also eine auf/zu-Schaltung passierte.

                          Dann versuche es mal so:

                          Bild_2021-12-08_172640.png

                          <xml xmlns="https://developers.google.com/blockly/xml">
                           <variables>
                             <variable id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</variable>
                             <variable type="timeout" id="timeout">timeout</variable>
                           </variables>
                           <block type="on" id="jK!Srf4|s?My,i]Z?.e_" x="63" y="41">
                             <field name="OID">zigbee.1.00158d000799f9ae.opened</field>
                             <field name="CONDITION">ne</field>
                             <field name="ACK_CONDITION"></field>
                             <statement name="STATEMENT">
                               <block type="variables_set" id="zqFe_u[sWLj;+]dMW##1">
                                 <field name="VAR" id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</field>
                                 <value name="VALUE">
                                   <block type="math_arithmetic" id="MQ6nN[*zAT8GVfWg1;-O">
                                     <field name="OP">MINUS</field>
                                     <value name="A">
                                       <shadow type="math_number" id="uvD{f=e]!:O/B,9ALM*y">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="on_source" id="y=]AFt2r|~27tDV]yONe">
                                         <field name="ATTR">state.lc</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <shadow type="math_number" id="Bz#Vj4[#pNfW8n`Wr+[m">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="on_source" id="^rsOSwuTg[J@hdSSu2~l">
                                         <field name="ATTR">oldState.lc</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="controls_if" id=":rgk1rFp!Sf@d6G86`4P">
                                     <value name="IF0">
                                       <block type="logic_negate" id="]`I~gk6?fLvb}jm+$u5`">
                                         <value name="BOOL">
                                           <block type="get_value" id="~`RyQBMVd+],i;a3%/Ou">
                                             <field name="ATTR">val</field>
                                             <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="update" id="x]/[eU$U^~U?E~Yb%2Z)">
                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                         <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="logic_boolean" id="i.NxT_cZm:D3pDq|nfYY">
                                             <field name="BOOL">TRUE</field>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="update" id="CqBYKGD%HdGVtp.D-`=}">
                                             <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                             <field name="OID">0_userdata.0.Hometrainer_Skripte.Aussetzung_Benachrichtigungen</field>
                                             <field name="WITH_DELAY">TRUE</field>
                                             <field name="DELAY_MS">2</field>
                                             <field name="UNIT">min</field>
                                             <field name="CLEAR_RUNNING">FALSE</field>
                                             <value name="VALUE">
                                               <block type="logic_boolean" id="U6f`+?oKBw0xTIG*|lsb">
                                                 <field name="BOOL">FALSE</field>
                                               </block>
                                             </value>
                                             <next>
                                               <block type="timeouts_settimeout" id="-@~Mtif+cgDPP[L:r-Nh">
                                                 <field name="NAME">timeout</field>
                                                 <field name="DELAY">20</field>
                                                 <field name="UNIT">sec</field>
                                                 <statement name="STATEMENT">
                                                   <block type="comment" id="dKTi=DXeE:d~t:`oElVJ">
                                                     <field name="COMMENT">Zeitdifferenz darf maximal &lt;10 Sekunden sein</field>
                                                     <next>
                                                       <block type="controls_if" id="HMVL(8UgPCqNF2+seN/5">
                                                         <value name="IF0">
                                                           <block type="logic_compare" id=":GPAg!:7I%ju?fd)KX0E">
                                                             <field name="OP">LT</field>
                                                             <value name="A">
                                                               <block type="variables_get" id="SROQT(0H9:`1U/|,B7Fc">
                                                                 <field name="VAR" id="xE-PO6fl5.;X+JU}_9rQ">Zeitdifferenz in ms</field>
                                                               </block>
                                                             </value>
                                                             <value name="B">
                                                               <block type="math_number" id="0unIA@)v2Q~w@0CT[C%F">
                                                                 <field name="NUM">10000</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                         <statement name="DO0">
                                                           <block type="telegram" id="pB:;!`u9TxYb{eB+GSJO">
                                                             <field name="INSTANCE"></field>
                                                             <field name="LOG"></field>
                                                             <field name="SILENT">FALSE</field>
                                                             <field name="PARSEMODE">default</field>
                                                             <value name="MESSAGE">
                                                               <shadow type="text" id="`w]AkcjR$}Tus_1HsmPo">
                                                                 <field name="TEXT">Testnachricht: Kurbeln längere Zeit gedreht</field>
                                                               </shadow>
                                                             </value>
                                                             <value name="USERNAME">
                                                               <block type="text" id="%?/-9(?N0.HXoD4gOL:l">
                                                                 <field name="TEXT">Patrick</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </statement>
                                                       </block>
                                                     </next>
                                                   </block>
                                                 </statement>
                                               </block>
                                             </next>
                                           </block>
                                         </next>
                                       </block>
                                     </statement>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                           </block>
                          </xml>
                          

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            PatrickFro @paul53 last edited by PatrickFro

                            @paul53 Vielen Dank für die Arbeit.

                            Ich bin gerade "schon" auf eine Lösung gekommen. Dein erster Code hat mir mit etwas Zeitversatz viel gebracht. Ich achte nun nicht mehr auf die Zeit, sondern nutze die "erhöhe um"-Funktion.

                            69551e95-446d-40df-b751-1546f529b3aa-image.png

                            Danke nochmal

                            1 Reply Last reply Reply Quote 0
                            • E
                              erazor86 @paul53 last edited by

                              @paul53 said in Zeitdifferenz berechnen:

                              @matthias-i sagte: Mein Plan ist deshalb den Zeitplan des Mähroboters zu erweitern, ihn aber nur dann mähen zu lassen, wenn die wöchentliche max. Mähzeit nicht überschritten ist und ihn bei unterschreiten einer minimalen Mähzeit am Wochenende auch außerhalb des Zeitplans mähen zulassen, um "Mähzeit nachzuholen".

                              Der Aussage entnehme ich, dass es um die wöchentliche Mäh-Dauer geht? Das Prinzip der Kumulation der Mäh-Dauer habe ich schon hier gezeigt (es wird mit ms gerechnet). Einmal in der Woche muss dann per Zeitplan die Mäh-Dauer zurück gesetzt werden. Unter der Woche kann die schon erreichte Mäh-Dauer ausgewertet werden.

                              Bild_2021-03-06_141139.png

                              Hallo, Ich habe das blockly für die Laufzeit meiner Lüftungsanlage genutzt. Allerdings habe ich es auf eine Tagesauswertung geändert. D.h. jeden Abend um 0 Uhr wird der Wert genullt.

                              Das Blockly ist bis auf den Trigger für mich nachvollziehbar. Ich verstehe die Auflösung "ist kleiner als letztes" in dem Zusammenhang nicht... Jede andere Auslösung funktioniert hingegen nicht..

                              Was mich etwas stört, ist dass der Wert nicht live aktualisiert wird... Wenn also die Anlage 4 Stunden ohne Stillstand läuft, werden die 4 Stunden erst nach der ersten Unterbrechung geschrieben. Was müsste ich ändern, wenn der Wert der tatsächlichen Laufzeit, alle 5 min aktualisiert wird?

                              paul53 1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @erazor86 last edited by paul53

                                @erazor86 sagte: Ich verstehe die Auflösung "ist kleiner als letztes" in dem Zusammenhang nicht... Jede andere Auslösung funktioniert hingegen nicht..

                                Triggert beim Ausschalten (Änderung true --> false).

                                @erazor86 sagte in Zeitdifferenz berechnen:

                                Was müsste ich ändern, wenn der Wert der tatsächlichen Laufzeit, alle 5 min aktualisiert wird?

                                Trigger auf "wurde geändert" und mit Einschalten ein 5-Minuten-Intervall starten, das beim Ausschalten gestoppt wird.

                                E 1 Reply Last reply Reply Quote 0
                                • E
                                  erazor86 @paul53 last edited by

                                  @paul53
                                  Danke für die Infos.

                                  Ich habe die Änderung mit dem Intervall getestet, leider wird die Zeit aber nicht korrekt summiert... hast du eine Idee wo der Fehler liegt?

                                  <xml xmlns="https://developers.google.com/blockly/xml">
                                    <variables>
                                      <variable id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</variable>
                                      <variable type="interval" id="Intervall">Intervall</variable>
                                    </variables>
                                    <block type="on_ext" id="$kEbY#R6hv*pK~*3s7f~" x="-137" y="-887">
                                      <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="]RDHZN_H_)V(`JXk!Elr">
                                          <field name="oid">shelly.0.SHSW-PM#76B4A1#1.Relay0.Power</field>
                                        </shadow>
                                      </value>
                                      <statement name="STATEMENT">
                                        <block type="controls_if" id="Z1deQeC:Wf9EFWSp*9d.">
                                          <mutation elseif="1"></mutation>
                                          <value name="IF0">
                                            <block type="logic_compare" id="Und_gySW1{EKGEii[HCF">
                                              <field name="OP">GT</field>
                                              <value name="A">
                                                <block type="get_value" id="||QIbPAQe`%W;0wg-{?#">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">shelly.0.SHSW-PM#76B4A1#1.Relay0.Power</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <block type="math_number" id="HqE;j0Kf4sCPS7;z?]Q^">
                                                  <field name="NUM">30</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <statement name="DO0">
                                            <block type="control" id="[,#g!m*(]K+img?eH=QG">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Lüftung</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="^Ac4Kzc_h}0.obCgF:E|">
                                                  <field name="BOOL">TRUE</field>
                                                </block>
                                              </value>
                                            </block>
                                          </statement>
                                          <value name="IF1">
                                            <block type="logic_compare" id="6KG7eQnX[B.%@aRx=z9d">
                                              <field name="OP">LT</field>
                                              <value name="A">
                                                <block type="get_value" id="=F75;y^mPd(wsy0hYvB`">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">shelly.0.SHSW-PM#76B4A1#1.Relay0.Power</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <block type="math_number" id="/!c,7EU$*|vt)O4#EhMu">
                                                  <field name="NUM">30</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <statement name="DO1">
                                            <block type="control" id="mJ:W^[k+%f!(T#!`:)qC">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Lüftung</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="gFpUSs2H!_esXCo(IRSp">
                                                  <field name="BOOL">FALSE</field>
                                                </block>
                                              </value>
                                            </block>
                                          </statement>
                                        </block>
                                      </statement>
                                    </block>
                                    <block type="variables_set" id=")vn_uk6$xwFtS;?LfqDk" x="-137" y="-588">
                                      <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                      <value name="VALUE">
                                        <block type="get_value" id="lxYUqLH.{;ScEd8_W{^t">
                                          <field name="ATTR">val</field>
                                          <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="on_ext" id="g10!%+,PQcoL^1CtCc1M">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                          <field name="CONDITION">true</field>
                                          <field name="ACK_CONDITION"></field>
                                          <value name="OID0">
                                            <shadow type="field_oid" id="1^6dn_Y//1Ld.:S1*pg/">
                                              <field name="oid">0_userdata.0.Datenpunkte.Rechengrößen.Lüftung</field>
                                            </shadow>
                                          </value>
                                          <statement name="STATEMENT">
                                            <block type="timeouts_setinterval" id="F%|n+bdyr1u[T$eOo-O+">
                                              <field name="NAME">Intervall</field>
                                              <field name="INTERVAL">1</field>
                                              <field name="UNIT">min</field>
                                              <statement name="STATEMENT">
                                                <block type="math_change" id="W|~lE[Qwmq@OL@N)v/_4">
                                                  <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                  <value name="DELTA">
                                                    <shadow type="math_number" id="fWsz,$6i4tL0Y7%pNn7F">
                                                      <field name="NUM">1</field>
                                                    </shadow>
                                                    <block type="math_arithmetic" id="8dbw%mT9A/DW6~o1_^,q" inline="false">
                                                      <field name="OP">MINUS</field>
                                                      <value name="A">
                                                        <shadow type="math_number" id="{,*U53G|oL{_f}d)G^$*">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="on_source" id="TK$!iiMRM!%JRabhC~fo">
                                                          <field name="ATTR">state.lc</field>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <shadow type="math_number" id="9`6U/6qXEXc(}AK3z5/:">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="on_source" id="MDsgyx~9/!NR^RbOGcUb">
                                                          <field name="ATTR">oldState.lc</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="update" id="+zK*btZIiTCUL)S.~[8D">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                      <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="variables_get" id="5wD}KRR8({98*0W6r6o}">
                                                          <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="update" id="g}hdq5eRT$=;qHw^zDv@">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                          <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <block type="convert_from_date" id="5zYzKU@-kYT+vYrXHim~">
                                                              <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                              <field name="OPTION">hh:mm:ss</field>
                                                              <value name="VALUE">
                                                                <block type="math_arithmetic" id="de6Osb3N2jOv]1ZE8LKs">
                                                                  <field name="OP">ADD</field>
                                                                  <value name="A">
                                                                    <shadow type="math_number" id="L,;}sdh*6EgE2`Me1YYz">
                                                                      <field name="NUM">1</field>
                                                                    </shadow>
                                                                    <block type="variables_get" id="?OEdL._f`+/(Z.!r^}`O">
                                                                      <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                                    </block>
                                                                  </value>
                                                                  <value name="B">
                                                                    <shadow type="math_number" id="v|/~JK[UhMh,%Mn!Xgh9">
                                                                      <field name="NUM">1</field>
                                                                    </shadow>
                                                                    <block type="convert_from_date" id="K:i9{k,$dbC{cRF0m%/e">
                                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                      <field name="OPTION">object</field>
                                                                      <value name="VALUE">
                                                                        <block type="text" id="qhKVkD25/vl9XM(CX`Q0">
                                                                          <field name="TEXT">1970-01-01 00:00</field>
                                                                        </block>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                            </block>
                                          </statement>
                                          <next>
                                            <block type="timeouts_clearinterval" id="PJ51GE9hrAOoR{osIItE">
                                              <field name="NAME">Intervall</field>
                                              <next>
                                                <block type="schedule" id="|kytfE5cp$@M5Mjr?=aH">
                                                  <field name="SCHEDULE">0 0 * * *</field>
                                                  <statement name="STATEMENT">
                                                    <block type="variables_set" id="eS9Yhju/DoLFarLL^QXj">
                                                      <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                      <value name="VALUE">
                                                        <block type="math_number" id="50RLcx#=~4Lt|(*Ts50@">
                                                          <field name="NUM">0</field>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="update" id="Ldq+96Oy#$LhNj2?O@o+">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                          <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <block type="math_number" id="VAB-z1%//`0bxPwp14r,">
                                                              <field name="NUM">0</field>
                                                            </block>
                                                          </value>
                                                          <next>
                                                            <block type="update" id="O-+G9zJ.R4,~Y8b,(n+!">
                                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                              <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                              <field name="WITH_DELAY">FALSE</field>
                                                              <value name="VALUE">
                                                                <block type="text" id="8jFlvBl*%rTvcjRF;3^l">
                                                                  <field name="TEXT">00:00:00</field>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </statement>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </xml>
                                  
                                  paul53 1 Reply Last reply Reply Quote 0
                                  • paul53
                                    paul53 @erazor86 last edited by paul53

                                    @erazor86 Man kann nicht den gleichen Datenpunkt für einen String ("SS:mm:ss") und auch für die Zeitdifferenz in ms verwenden. Das müssen verschiedene Datenpunkte sein.
                                    Versuche es mal hiermit:

                                    Bild_2021-12-12_234349.png

                                    <xml xmlns="https://developers.google.com/blockly/xml">
                                     <variables>
                                       <variable id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</variable>
                                       <variable id=".M;hWc%-tKkr1@W+1LrA">aktuelleED</variable>
                                       <variable type="interval" id="Intervall">Intervall</variable>
                                     </variables>
                                     <block type="on_ext" id="$kEbY#R6hv*pK~*3s7f~" x="-137" y="-887">
                                       <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="]RDHZN_H_)V(`JXk!Elr">
                                           <field name="oid">shelly.0.SHSW-PM#76B4A1#1.Relay0.Power</field>
                                         </shadow>
                                       </value>
                                       <statement name="STATEMENT">
                                         <block type="control" id="[,#g!m*(]K+img?eH=QG">
                                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                           <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Lüftung</field>
                                           <field name="WITH_DELAY">FALSE</field>
                                           <value name="VALUE">
                                             <block type="logic_compare" id="Und_gySW1{EKGEii[HCF">
                                               <field name="OP">GT</field>
                                               <value name="A">
                                                 <block type="get_value" id="||QIbPAQe`%W;0wg-{?#">
                                                   <field name="ATTR">val</field>
                                                   <field name="OID">shelly.0.SHSW-PM#76B4A1#1.Relay0.Power</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <block type="math_number" id="HqE;j0Kf4sCPS7;z?]Q^">
                                                   <field name="NUM">30</field>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                         </block>
                                       </statement>
                                       <next>
                                         <block type="variables_set" id=")vn_uk6$xwFtS;?LfqDk">
                                           <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                           <value name="VALUE">
                                             <block type="math_arithmetic" id="|OpM`7r4*#g{V(atOXeP" inline="false">
                                               <field name="OP">MINUS</field>
                                               <value name="A">
                                                 <shadow type="math_number" id="b]+0ib3EcZ~2_oMcuWye">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="convert_from_date" id="R366`43-0$M-yx[Ho$-S">
                                                   <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                   <field name="OPTION">object</field>
                                                   <value name="VALUE">
                                                     <block type="get_value" id="lxYUqLH.{;ScEd8_W{^t">
                                                       <field name="ATTR">val</field>
                                                       <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number" id="Maco,i~T7aXgM%`$#ZH=">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="convert_from_date" id="iZ|uy?-0G:C=QT{p_G.Y">
                                                   <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                   <field name="OPTION">object</field>
                                                   <value name="VALUE">
                                                     <block type="text" id="/JUQfzjSZ0|9RZsQqyYE">
                                                       <field name="TEXT">00:00:00</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="on_ext" id="g10!%+,PQcoL^1CtCc1M">
                                               <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="1^6dn_Y//1Ld.:S1*pg/">
                                                   <field name="oid">0_userdata.0.Datenpunkte.Rechengrößen.Lüftung</field>
                                                 </shadow>
                                               </value>
                                               <statement name="STATEMENT">
                                                 <block type="controls_if" id=".PO:1M;FRU?d].Nd5sPc">
                                                   <mutation else="1"></mutation>
                                                   <value name="IF0">
                                                     <block type="on_source" id="W+aPPoh~~slVC@YQcf;@">
                                                       <field name="ATTR">state.val</field>
                                                     </block>
                                                   </value>
                                                   <statement name="DO0">
                                                     <block type="variables_set" id="!OE$Ko{1N9#?t.4BPSg,">
                                                       <field name="VAR" id=".M;hWc%-tKkr1@W+1LrA">aktuelleED</field>
                                                       <value name="VALUE">
                                                         <block type="math_number" id="Re%ze)=eXwGl[S84%(G#">
                                                           <field name="NUM">0</field>
                                                         </block>
                                                       </value>
                                                       <next>
                                                         <block type="timeouts_setinterval" id="F%|n+bdyr1u[T$eOo-O+">
                                                           <field name="NAME">Intervall</field>
                                                           <field name="INTERVAL">1</field>
                                                           <field name="UNIT">min</field>
                                                           <statement name="STATEMENT">
                                                             <block type="math_change" id="4`4wkv(iK;LhA;jCuNZL">
                                                               <field name="VAR" id=".M;hWc%-tKkr1@W+1LrA">aktuelleED</field>
                                                               <value name="DELTA">
                                                                 <shadow type="math_number" id="m4-Y_9;xuDdomh3@HwQ}">
                                                                   <field name="NUM">60000</field>
                                                                 </shadow>
                                                               </value>
                                                               <next>
                                                                 <block type="update" id="+zK*btZIiTCUL)S.~[8D">
                                                                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                   <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                                   <field name="WITH_DELAY">FALSE</field>
                                                                   <value name="VALUE">
                                                                     <block type="convert_from_date" id="lFVMWNt-~#geUqV:%$YI">
                                                                       <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                       <field name="OPTION">hh:mm:ss</field>
                                                                       <value name="VALUE">
                                                                         <block type="math_arithmetic" id="Y,Wo/G)odmv`):~[qQBc">
                                                                           <field name="OP">ADD</field>
                                                                           <value name="A">
                                                                             <shadow type="math_number" id="CnZ2|N^8d|}1:oyCMS2I">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="math_arithmetic" id="FGgA^p;#:H7W;hU-LpHs">
                                                                               <field name="OP">ADD</field>
                                                                               <value name="A">
                                                                                 <shadow type="math_number" id=".=cyKFyxrA=s-Wk4Wwt#">
                                                                                   <field name="NUM">1</field>
                                                                                 </shadow>
                                                                                 <block type="variables_get" id="5wD}KRR8({98*0W6r6o}">
                                                                                   <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                                                 </block>
                                                                               </value>
                                                                               <value name="B">
                                                                                 <shadow type="math_number" id="5|iqT4XOgkKp4XTFP_,S">
                                                                                   <field name="NUM">1</field>
                                                                                 </shadow>
                                                                                 <block type="variables_get" id="%eY8G+BT{E$3`DI:)sGp">
                                                                                   <field name="VAR" id=".M;hWc%-tKkr1@W+1LrA">aktuelleED</field>
                                                                                 </block>
                                                                               </value>
                                                                             </block>
                                                                           </value>
                                                                           <value name="B">
                                                                             <shadow type="math_number" id="bnO%l+X9Gx/_M)S,d7[g">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="convert_from_date" id="K:i9{k,$dbC{cRF0m%/e">
                                                                               <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                               <field name="OPTION">object</field>
                                                                               <value name="VALUE">
                                                                                 <block type="text" id="qhKVkD25/vl9XM(CX`Q0">
                                                                                   <field name="TEXT">1970-01-01 00:00</field>
                                                                                 </block>
                                                                               </value>
                                                                             </block>
                                                                           </value>
                                                                         </block>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                 </block>
                                                               </next>
                                                             </block>
                                                           </statement>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </statement>
                                                   <statement name="ELSE">
                                                     <block type="timeouts_clearinterval" id="ii#;LBc`SXmzlL?)5[0h">
                                                       <field name="NAME">Intervall</field>
                                                       <next>
                                                         <block type="math_change" id="W|~lE[Qwmq@OL@N)v/_4">
                                                           <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                           <value name="DELTA">
                                                             <shadow type="math_number" id="fWsz,$6i4tL0Y7%pNn7F">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="math_arithmetic" id="8dbw%mT9A/DW6~o1_^,q" inline="false">
                                                               <field name="OP">MINUS</field>
                                                               <value name="A">
                                                                 <shadow type="math_number" id="{,*U53G|oL{_f}d)G^$*">
                                                                   <field name="NUM">1</field>
                                                                 </shadow>
                                                                 <block type="on_source" id="TK$!iiMRM!%JRabhC~fo">
                                                                   <field name="ATTR">state.lc</field>
                                                                 </block>
                                                               </value>
                                                               <value name="B">
                                                                 <shadow type="math_number" id="9`6U/6qXEXc(}AK3z5/:">
                                                                   <field name="NUM">1</field>
                                                                 </shadow>
                                                                 <block type="on_source" id="MDsgyx~9/!NR^RbOGcUb">
                                                                   <field name="ATTR">oldState.lc</field>
                                                                 </block>
                                                               </value>
                                                             </block>
                                                           </value>
                                                           <next>
                                                             <block type="update" id="g}hdq5eRT$=;qHw^zDv@">
                                                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                               <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                               <field name="WITH_DELAY">FALSE</field>
                                                               <value name="VALUE">
                                                                 <block type="convert_from_date" id="5zYzKU@-kYT+vYrXHim~">
                                                                   <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                   <field name="OPTION">hh:mm:ss</field>
                                                                   <value name="VALUE">
                                                                     <block type="math_arithmetic" id="de6Osb3N2jOv]1ZE8LKs">
                                                                       <field name="OP">ADD</field>
                                                                       <value name="A">
                                                                         <shadow type="math_number" id="L,;}sdh*6EgE2`Me1YYz">
                                                                           <field name="NUM">1</field>
                                                                         </shadow>
                                                                         <block type="variables_get" id="?OEdL._f`+/(Z.!r^}`O">
                                                                           <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                                         </block>
                                                                       </value>
                                                                       <value name="B">
                                                                         <shadow type="math_number" id="v|/~JK[UhMh,%Mn!Xgh9">
                                                                           <field name="NUM">1</field>
                                                                         </shadow>
                                                                         <block type="convert_from_date" id="7vdBgw4zJVyR%+9o0iuW">
                                                                           <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                           <field name="OPTION">object</field>
                                                                           <value name="VALUE">
                                                                             <block type="text" id="kNJ7`:@%CLI`KBJ:(peF">
                                                                               <field name="TEXT">1970-01-01 00:00</field>
                                                                             </block>
                                                                           </value>
                                                                         </block>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                 </block>
                                                               </value>
                                                             </block>
                                                           </next>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </statement>
                                                 </block>
                                               </statement>
                                               <next>
                                                 <block type="schedule" id="|kytfE5cp$@M5Mjr?=aH">
                                                   <field name="SCHEDULE">0 0 * * *</field>
                                                   <statement name="STATEMENT">
                                                     <block type="variables_set" id="eS9Yhju/DoLFarLL^QXj">
                                                       <field name="VAR" id="-8jUk([-^/E4KtM^jFpH">Einschaltdauer</field>
                                                       <value name="VALUE">
                                                         <block type="math_number" id="50RLcx#=~4Lt|(*Ts50@">
                                                           <field name="NUM">0</field>
                                                         </block>
                                                       </value>
                                                       <next>
                                                         <block type="update" id="O-+G9zJ.R4,~Y8b,(n+!">
                                                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                           <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                                           <field name="WITH_DELAY">FALSE</field>
                                                           <value name="VALUE">
                                                             <block type="text" id="8jFlvBl*%rTvcjRF;3^l">
                                                               <field name="TEXT">00:00:00</field>
                                                             </block>
                                                           </value>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </statement>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                    </xml>
                                    

                                    E 2 Replies Last reply Reply Quote 0
                                    • E
                                      erazor86 @paul53 last edited by

                                      @paul53 es funktioniert 👍 super und besten Dank... auch wenn ich noch nicht ganz durch steige 😉 muss ich mir nochmal in einer ruhigen Minute zu Gemüte führen 😉

                                      1 Reply Last reply Reply Quote 0
                                      • E
                                        erazor86 @paul53 last edited by erazor86

                                        @paul53 jetzt wird die Dauer der Lüftung in ss:mm:ss in den Datenpunkt geschrieben.

                                        Wie kann ich dieses Format jetzt in eine Dezimalzahl konvertieren? Bspw. aus 08:30:00 soll dann 8,5 werden.
                                        Ich habe es wie folgt probiert, allerdings wird mir nur die 8h ausgegeben..
                                        dezimal.JPG

                                        <block xmlns="https://developers.google.com/blockly/xml" type="on_ext" id="g10!%+,PQcoL^1CtCc1M" x="-162" y="-487">
                                          <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="1^6dn_Y//1Ld.:S1*pg/">
                                              <field name="oid">0_userdata.0.Datenpunkte.Rechengrößen.Dauer</field>
                                            </shadow>
                                          </value>
                                          <statement name="STATEMENT">
                                            <block type="update" id="Qg5uQ5,C~h#CP}OXp,n|">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">0_userdata.0.Datenpunkte.Rechengrößen.Dauer_dezimal</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="convert_tonumber" id="7`9D*4n16D87os~S.wgX">
                                                  <value name="VALUE">
                                                    <block type="on_source" id="6QPqXzV(jXa`:A/Jy*s|">
                                                      <field name="ATTR">state.val</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                            </block>
                                          </statement>
                                        </block>
                                        
                                        paul53 2 Replies Last reply Reply Quote 0
                                        • paul53
                                          paul53 @erazor86 last edited by

                                          @erazor86 sagte: Format jetzt in eine Dezimalzahl konvertieren?

                                          Schreibe besser den Wert als Dezimalzahl im ursprünglichen Skript:

                                          Bild_2021-12-14_214147.png

                                          Der untere Datenpunkt erhält den Dezimalwert.

                                          1 Reply Last reply Reply Quote 0
                                          • paul53
                                            paul53 @erazor86 last edited by paul53

                                            @erazor86
                                            Die Wandlung des Strings "SS:mm:ss" in eine Dezimalzahl ist etwas aufwändiger.

                                            Bild_2021-12-14_225151.png

                                            E 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            962
                                            Online

                                            31.6k
                                            Users

                                            79.4k
                                            Topics

                                            1.3m
                                            Posts

                                            blockly
                                            16
                                            89
                                            13627
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo