Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Betriebsdauer-Zähler (erledigt)

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Betriebsdauer-Zähler (erledigt)

    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      ionar last edited by ionar

      Hallo,
      ich würde gerne die Betriebsdauer eines Gerätes nach dem Einschalten in Minuten zählen und dann nach dem Ausschalten zurücksetzen.
      Ich bekomme es leider selber nicht hin..

      Bildschirmfoto 2020-06-19 um 16.31.52.png

      Vielen Dank!

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

        @ionar
        Mit Trigger (Zeitplan) innerhalb eines Triggers wird das nichts. Mit "wiederhole bis" wird eine Endlosschleife erzeugt. Vorschlag:

        Blockly_temp.JPG

        <xml xmlns="https://developers.google.com/blockly/xml">
         <variables>
           <variable id=")u|MCf/ls7zvBa;qNZWC">Zeit</variable>
           <variable type="interval" id="Intervall">Intervall</variable>
         </variables>
         <block type="on_ext" id="oaj;E-YSV!_*m8TQwu31" x="113" y="38">
           <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="wSk}$GtBZ_M8pqpv|y(u">
               <field name="oid">default</field>
             </shadow>
           </value>
           <statement name="STATEMENT">
             <block type="controls_if" id="Ln]L-E%(r62eBDNQ4Xbq">
               <mutation else="1"></mutation>
               <value name="IF0">
                 <block type="on_source" id="^;c8,2Eu3b?PO3zF*4~c">
                   <field name="ATTR">state.val</field>
                 </block>
               </value>
               <statement name="DO0">
                 <block type="variables_set" id="eY-@(O%KX8wW:P@]Z$^W">
                   <field name="VAR" id=")u|MCf/ls7zvBa;qNZWC">Zeit</field>
                   <value name="VALUE">
                     <block type="math_number" id="Y_k+HM{+dHI.gJ5t[zQs">
                       <field name="NUM">0</field>
                     </block>
                   </value>
                   <next>
                     <block type="update" id="s3/ybBOu8el5v#7W)R$6">
                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                       <field name="OID">Object ID</field>
                       <field name="WITH_DELAY">FALSE</field>
                       <value name="VALUE">
                         <block type="variables_get" id="tKbh~QvfuRKGAg^kWKbk">
                           <field name="VAR" id=")u|MCf/ls7zvBa;qNZWC">Zeit</field>
                         </block>
                       </value>
                       <next>
                         <block type="timeouts_setinterval" id="=fcydg8Y{0I-H*B%7cB?">
                           <field name="NAME">Intervall</field>
                           <field name="INTERVAL">1</field>
                           <field name="UNIT">min</field>
                           <statement name="STATEMENT">
                             <block type="math_change" id="r}XU3p^Wk~}L$EeT)$TP">
                               <field name="VAR" id=")u|MCf/ls7zvBa;qNZWC">Zeit</field>
                               <value name="DELTA">
                                 <shadow type="math_number" id="|fbWDuBrT5C}m`I4rpzN">
                                   <field name="NUM">1</field>
                                 </shadow>
                               </value>
                               <next>
                                 <block type="update" id="Qq7Km9/C^K4L|2B+fBi|">
                                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                   <field name="OID">Object ID</field>
                                   <field name="WITH_DELAY">FALSE</field>
                                   <value name="VALUE">
                                     <block type="variables_get" id="6VDO|,:J5t8^S0Q6?)Cq">
                                       <field name="VAR" id=")u|MCf/ls7zvBa;qNZWC">Zeit</field>
                                     </block>
                                   </value>
                                 </block>
                               </next>
                             </block>
                           </statement>
                         </block>
                       </next>
                     </block>
                   </next>
                 </block>
               </statement>
               <statement name="ELSE">
                 <block type="timeouts_clearinterval" id="Vb3c=Pc=g#(T-IB7YD[U">
                   <field name="NAME">Intervall</field>
                 </block>
               </statement>
             </block>
           </statement>
         </block>
        </xml>
        

        1 Reply Last reply Reply Quote 1
        • I
          ionar last edited by ionar

          Vielen Dank @paul53
          Der Wert wird verändert, aber immer "+8", also 8, 16, 24, 32, etc. (Auch wenn das Gerät aus ist, wieder von 0 startend mit "+8"-Schritten).
          Kannst du dir das erklären?

          Bildschirmfoto 2020-06-19 um 19.08.09.png


          <xml xmlns="https://developers.google.com/blockly/xml">
          <variables>
          <variable id="x9ubP]8jfhr-+qtGQ{si">Zeit</variable>
          <variable type="interval" id="Intervall">Intervall</variable>
          </variables>
          <block type="on_ext" id="oaj;E-YSV!_m8TQwu31" x="-412" y="38">
          <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="wSk}$GtBZ_M8pqpv|y(u">
          <field name="oid">deconz.0.Lights.10.on</field>
          </shadow>
          </value>
          <statement name="STATEMENT">
          <block type="controls_if" id="Ln]L-E%(r62eBDNQ4Xbq">
          <mutation else="1"></mutation>
          <value name="IF0">
          <block type="on_source" id="^;c8,2Eu3b?PO3zF
          4~c">
          <field name="ATTR">state.val</field>
          </block>
          </value>
          <statement name="DO0">
          <block type="variables_set" id="eY-@(O%KX8wW:P@]Z$^W">
          <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
          <value name="VALUE">
          <block type="math_number" id="Y_k+HM{+dHI.gJ5t[zQs">
          <field name="NUM">0</field>
          </block>
          </value>
          <next>
          <block type="update" id="s3/ybBOu8el5v#7W)R$6">
          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
          <field name="OID">0_userdata.0.USB-Kabel_Betriebsdauer</field>
          <field name="WITH_DELAY">FALSE</field>
          <value name="VALUE">
          <block type="variables_get" id="tKbh~QvfuRKGAg^kWKbk">
          <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
          </block>
          </value>
          <next>
          <block type="timeouts_setinterval" id="=fcydg8Y{0I-HB%7cB?">
          <field name="NAME">Intervall</field>
          <field name="INTERVAL">1</field>
          <field name="UNIT">min</field>
          <statement name="STATEMENT">
          <block type="math_change" id="r}XU3p^Wk~}L$EeT)$TP">
          <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
          <value name="DELTA">
          <shadow type="math_number" id="|fbWDuBrT5C}mI4rpzN"> <field name="NUM">1</field> </shadow> </value> <next> <block type="update" id="Qq7Km9/C^K4L|2B+fBi|"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.USB-Kabel_Betriebsdauer</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="6VDO|,:J5t8^S0Q6?)Cq"> <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="timeouts_clearinterval" id="Vb3c=Pc=g#(T-IB7YD[U"> <field name="NAME">Intervall</field> </block> </statement> </block> </statement> <next> <block type="on_ext" id="6lE^|Q(7A1#IQfdvd}3u"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">false</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="}?0}pp@St~k4}ac|?mE?"> <field name="oid">deconz.0.Lights.10.on</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="xoF/Y([A0X~IQxjhU?G">
          <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
          <value name="VALUE">
          <block type="math_number" id="1oI-9t]]H8V9.vY9=/Jf">
          <field name="NUM">0</field>
          </block>
          </value>
          <next>
          <block type="update" id="QLY}kgw6~/eodN6]nD:
          ">
          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
          <field name="OID">0_userdata.0.USB-Kabel_Betriebsdauer</field>
          <field name="WITH_DELAY">FALSE</field>
          <value name="VALUE">
          <block type="variables_get" id="0k}F;s|DUpXA4(GZu@VW">
          <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
          </block>
          </value>
          </block>
          </next>
          </block>
          </statement>
          </block>
          </next>
          </block>
          </xml>

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

            @ionar sagte:

            Kannst du dir das erklären?

            Ja. Du triggerst auf "ist wahr". Somit wird der sonst-Zweig nie erreicht, das Intervall also nicht gestoppt. Wenn um 8 Stellen hochgezählt wird, laufen mittlerweile 8 Intervalle parallel. Man verwendet in einem Skript keine 2 Trigger auf den gleichen Datenpunkt (Ressourcen-Verbrauch).

            1 Reply Last reply Reply Quote 1
            • I
              ionar last edited by

              Vielen Dank nochmals @paul53, jetzt funktioniert es.

              Bildschirmfoto 2020-06-19 um 19.34.48.png


              <xml xmlns="https://developers.google.com/blockly/xml">
              <variables>
              <variable id="x9ubP]8jfhr-+qtGQ{si">Zeit</variable>
              <variable type="interval" id="Intervall">Intervall</variable>
              </variables>
              <block type="on_ext" id="oaj;E-YSV!_m8TQwu31" x="-412" y="38">
              <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="wSk}$GtBZ_M8pqpv|y(u">
              <field name="oid">deconz.0.Lights.10.on</field>
              </shadow>
              </value>
              <statement name="STATEMENT">
              <block type="controls_if" id="Ln]L-E%(r62eBDNQ4Xbq">
              <mutation else="1"></mutation>
              <value name="IF0">
              <block type="logic_compare" id="t}$-;-D0S,jc+oAFGwbt">
              <field name="OP">EQ</field>
              <value name="A">
              <block type="get_value" id="0DH]}NP@^|LaXKlc2ZEi">
              <field name="ATTR">val</field>
              <field name="OID">deconz.0.Lights.10.on</field>
              </block>
              </value>
              <value name="B">
              <block type="logic_boolean" id="M(tWoO@5{a6owX,6J)">
              <field name="BOOL">TRUE</field>
              </block>
              </value>
              </block>
              </value>
              <statement name="DO0">
              <block type="variables_set" id="eY-@(O%KX8wW:P@]Z$^W">
              <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
              <value name="VALUE">
              <block type="math_number" id="Y_k+HM{+dHI.gJ5t[zQs">
              <field name="NUM">0</field>
              </block>
              </value>
              <next>
              <block type="update" id="s3/ybBOu8el5v#7W)R$6">
              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
              <field name="OID">0_userdata.0.USB-Kabel_Betriebsdauer</field>
              <field name="WITH_DELAY">FALSE</field>
              <value name="VALUE">
              <block type="variables_get" id="tKbh~QvfuRKGAg^kWKbk">
              <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
              </block>
              </value>
              <next>
              <block type="timeouts_setinterval" id="=fcydg8Y{0I-H
              B%7cB?">
              <field name="NAME">Intervall</field>
              <field name="INTERVAL">1</field>
              <field name="UNIT">min</field>
              <statement name="STATEMENT">
              <block type="math_change" id="r}XU3p^Wk~}L$EeT)$TP">
              <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
              <value name="DELTA">
              <shadow type="math_number" id="|fbWDuBrT5C}mI4rpzN"> <field name="NUM">1</field> </shadow> </value> <next> <block type="update" id="Qq7Km9/C^K4L|2B+fBi|"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.USB-Kabel_Betriebsdauer</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="6VDO|,:J5t8^S0Q6?)Cq"> <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="timeouts_clearinterval" id="Vb3c=Pc=g#(T-IB7YD[U"> <field name="NAME">Intervall</field> <next> <block type="variables_set" id="xoF/Y([A0X~IQxjhU?G">
              <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
              <value name="VALUE">
              <block type="math_number" id="1oI-9t]]H8V9.vY9=/Jf">
              <field name="NUM">0</field>
              </block>
              </value>
              <next>
              <block type="update" id="QLY}kgw6~/eodN6]nD:*">
              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
              <field name="OID">0_userdata.0.USB-Kabel_Betriebsdauer</field>
              <field name="WITH_DELAY">FALSE</field>
              <value name="VALUE">
              <block type="variables_get" id="0k}F;s|DUpXA4(GZu@VW">
              <field name="VAR" id="x9ubP]8jfhr-+qtGQ{si">Zeit</field>
              </block>
              </value>
              </block>
              </next>
              </block>
              </next>
              </block>
              </statement>
              </block>
              </statement>
              </block>
              </xml>

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

                @ionar sagte:

                jetzt funktioniert es.

                Dann markiere bitte das Thema in der Überschrift des ersten Beitrags als gelöst.

                Weshalb setzt Du den Datenpunkt "Betriebsdauer" schon beim Ausschalten auf 0 zurück. Dann ist die Information sofort weg. Es genügt das Rücksetzen beim nächsten Einschalten, so wie in meinem Vorschlag. Zweimal Rücksetzen ist ohnehin überflüssig.

                I 1 Reply Last reply Reply Quote 1
                • I
                  ionar @paul53 last edited by ionar

                  @paul53 sagte in Betriebsdauer-Zähler:

                  Weshalb setzt Du den Datenpunkt "Betriebsdauer" schon beim Ausschalten auf 0 zurück.

                  Das Ladegerät ist an einer Couch-Steckdose, das wiederum an einem Osram Smartplug hängt. Ich habe ein anderes Skript, dass die Steckdose ausschaltet, sobald das Ladegerät 90min an ist. (Das könnte dann mehrfach getriggert werden, wenn der Wert über 90 bleibt?)

                  Bei Bedarf schalten wir das Ladegerät an und vergessen meistens, es wieder auszuschalten, wenn wir das Handy abziehen. Die Betriebsdauer ist in diesem Fall keine wichtige Information sozusagen.

                  Edit: Und das Skript in anderer Form möchte ich jetzt auch nutzen, um die Kaffeemaschine automatisch abzuschalten, wenn ich länger als 30min abwesend bin, quasi als Abwesenheitszähler.

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

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  809
                  Online

                  32.0k
                  Users

                  80.4k
                  Topics

                  1.3m
                  Posts

                  2
                  7
                  565
                  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