Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Log Eintrag wenn Aktor in den letzten X MS aktiviert wurde

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Log Eintrag wenn Aktor in den letzten X MS aktiviert wurde

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

      funktioniert leider nicht, da das skript nicht am check vorbei kommt, da die variable "ventil_1_log_vorletze_aenderung" erst befüllt wird, wenn der Log Eintrag geschrieben wurde

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

        @Kuddel sagte:

        funktioniert leider nicht,

        Wenn Du mal das komplette Script posten würdest, könnte man vielleicht helfen.

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

          @paul53 das komplette Script ist mittlerwiele riesig

          [Vorlage] Gartenbewässerung mit 6 Ventilen

          Ich habe den entsprechenden Teil mal exportiert. Dann kann man Ventil 1 als Beispiel nehmen.

          So ist es aktuell mit Sekunden.

          fc19dfd9-c5a0-42bd-b72f-abbc7ee4055d-grafik.png

          Blockly Export

          <xml xmlns="https://developers.google.com/blockly/xml">
           <variables>
             <variable id="j,Kv~%zHrY;^mX|q-)}Z">vars_bewaesserung_aktiv</variable>
             <variable id="0WdsXwxV$C@/%hsuD}@,">vars_anzahl_aktive_ventile</variable>
             <variable id="L$dL,G^%^D+v7u5(M,!,">vars_notify_log</variable>
             <variable id=":EftQa}d_$~f56_9e@=j">vars_anzahl_ventile</variable>
             <variable id="i/gy6[~1p3HXAlIvbd%.">vars_ventil_1_name</variable>
             <variable id="OZsnED^t]8DiGW7l93m!">vars_ventil_1_aktor</variable>
           </variables>
           <block type="on_ext" id="R3|T;L6xIlwCr,QVmzNj" x="113" y="-1262">
             <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
             <field name="CONDITION">ne</field>
             <field name="ACK_CONDITION"></field>
             <value name="OID0">
               <shadow type="field_oid" id="RW,QldX-r$f|qo$)P~9c">
                 <field name="oid">default</field>
               </shadow>
               <block type="variables_get" id="m3*;W]jh!7/Zmp^2HjvR">
                 <field name="VAR" id="j,Kv~%zHrY;^mX|q-)}Z">vars_bewaesserung_aktiv</field>
               </block>
             </value>
             <value name="OID1">
               <shadow type="field_oid" id="Hw3G1s{j]?f}#9,#JP!v">
                 <field name="oid">default</field>
               </shadow>
               <block type="variables_get" id="+7iF08y`M/,J%g}z)4dy">
                 <field name="VAR" id="0WdsXwxV$C@/%hsuD}@,">vars_anzahl_aktive_ventile</field>
               </block>
             </value>
             <statement name="STATEMENT">
               <block type="controls_if" id=";tuKGEM7|KebGKC21/-m">
                 <value name="IF0">
                   <block type="logic_compare" id=":ss6*E2+OD{8$2D[w(A=">
                     <field name="OP">EQ</field>
                     <value name="A">
                       <block type="variables_get" id="@tQ$T%M{Iav,)BQ_dXg)">
                         <field name="VAR" id="L$dL,G^%^D+v7u5(M,!,">vars_notify_log</field>
                       </block>
                     </value>
                     <value name="B">
                       <block type="logic_boolean" id="{1A0@^kBm-)qP%qmi0+:">
                         <field name="BOOL">TRUE</field>
                       </block>
                     </value>
                   </block>
                 </value>
                 <statement name="DO0">
                   <block type="comment" id="~9-sFh8?la)_KUc?DHm~">
                     <field name="COMMENT">+++ Bewaesserung gestartet / beendet +++</field>
                     <next>
                       <block type="comment" id="^~ApP]IHBRerbCRNy?V+">
                         <field name="COMMENT">Ventil 1</field>
                         <next>
                           <block type="controls_if" id="NO1KwZ*=b([xWP{hDXGs">
                             <value name="IF0">
                               <block type="logic_compare" id="?zs98jj%-oLVON;AWC_Z">
                                 <field name="OP">GT</field>
                                 <value name="A">
                                   <block type="variables_get" id="LKTa@/)(j`O{wPZ{^m1L">
                                     <field name="VAR" id=":EftQa}d_$~f56_9e@=j">vars_anzahl_ventile</field>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="math_number" id="PYIniGw/ViG(~t]MUo:3">
                                     <field name="NUM">0</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <statement name="DO0">
                               <block type="controls_if" id="]9t[BAW^9m0sY2i/nC)R">
                                 <value name="IF0">
                                   <block type="logic_operation" id="j6*A*2^P@Zv^f@(cs`1Z" inline="false">
                                     <field name="OP">AND</field>
                                     <value name="A">
                                       <block type="logic_operation" id="Jr9fVloePEVsRd}+Akru" inline="false">
                                         <field name="OP">AND</field>
                                         <value name="A">
                                           <block type="logic_compare" id=",BJbYoBK!$,?E!012OmD">
                                             <field name="OP">EQ</field>
                                             <value name="A">
                                               <block type="get_value_var" id="RexV93}#,SX@wroJ#j~]">
                                                 <field name="ATTR">val</field>
                                                 <value name="OID">
                                                   <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="C0]2Pv%^GGTut7p`{2+@">
                                                     <field name="TEXT"></field>
                                                   </shadow>
                                                   <block type="variables_get" id="}eOvSbNxt!x;z4UisZwp">
                                                     <field name="VAR" id="j,Kv~%zHrY;^mX|q-)}Z">vars_bewaesserung_aktiv</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <value name="B">
                                               <block type="logic_boolean" id="ba{B,TL^%Q|@_0-F6`nx">
                                                 <field name="BOOL">TRUE</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="logic_compare" id="mv4r_84U.[O|3[eth(um">
                                             <field name="OP">EQ</field>
                                             <value name="A">
                                               <block type="get_value_var" id="s/mVXioKX|)}d5OiQ:g)">
                                                 <field name="ATTR">val</field>
                                                 <value name="OID">
                                                   <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="L0~ngEF*$AMo7uaQP$Kk">
                                                     <field name="TEXT"></field>
                                                   </shadow>
                                                   <block type="variables_get" id="Tdu|`vcq%iu(Bi42::HA">
                                                     <field name="VAR" id="OZsnED^t]8DiGW7l93m!">vars_ventil_1_aktor</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <value name="B">
                                               <block type="logic_boolean" id="JJZU~enwp1Ayrls6`#TZ">
                                                 <field name="BOOL">TRUE</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="logic_operation" id="=eFEhqV;Cw/ql{*xVA[|" inline="false">
                                         <field name="OP">AND</field>
                                         <value name="A">
                                           <block type="logic_compare" id=".CKH1DZy}`6jL7FqpW,z" inline="false">
                                             <field name="OP">EQ</field>
                                             <value name="A">
                                               <block type="time_get" id="#4B(i9?jmZx2H+T|qA`M">
                                                 <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                 <field name="OPTION">DD.MM.YYYY</field>
                                               </block>
                                             </value>
                                             <value name="B">
                                               <block type="convert_from_date" id="tmGE_5HBhk:W8GOytxRR">
                                                 <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                 <field name="OPTION">DD.MM.YYYY</field>
                                                 <value name="VALUE">
                                                   <block type="get_value_var" id="SV!`ox)nxzCc11VY)#LW">
                                                     <field name="ATTR">lc</field>
                                                     <value name="OID">
                                                       <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="C0]2Pv%^GGTut7p`{2+@">
                                                         <field name="TEXT"></field>
                                                       </shadow>
                                                       <block type="variables_get" id="Or$([,T+Ia{:vHENaF}Y">
                                                         <field name="VAR" id="OZsnED^t]8DiGW7l93m!">vars_ventil_1_aktor</field>
                                                       </block>
                                                     </value>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="logic_compare" id="m1Z|D:x_Tc]~0Bxk2Mz|" inline="false">
                                             <field name="OP">LT</field>
                                             <value name="A">
                                               <block type="math_arithmetic" id="#YzFyx65$|62#362iW]$" inline="false">
                                                 <field name="OP">MINUS</field>
                                                 <value name="A">
                                                   <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number">
                                                     <field name="NUM">1</field>
                                                   </shadow>
                                                   <block type="time_get" id="bH+14qs72UJ3/mgs1^UP">
                                                     <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                     <field name="OPTION">sid</field>
                                                   </block>
                                                 </value>
                                                 <value name="B">
                                                   <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number">
                                                     <field name="NUM">1</field>
                                                   </shadow>
                                                   <block type="convert_from_date" id=")V=czWiISK5`qw7pu#=3">
                                                     <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                     <field name="OPTION">sid</field>
                                                     <value name="VALUE">
                                                       <block type="get_value_var" id="B(c0pISaAI;1spOA8T~m">
                                                         <field name="ATTR">lc</field>
                                                         <value name="OID">
                                                           <shadow type="text" id="=gW,~gbWO$yOsOyKLl6n">
                                                             <field name="TEXT"></field>
                                                           </shadow>
                                                           <block type="variables_get" id="DSIF`($nb!k/*0t)J;NJ">
                                                             <field name="VAR" id="OZsnED^t]8DiGW7l93m!">vars_ventil_1_aktor</field>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <value name="B">
                                               <block type="math_number" id="H=YfEq2xhoZR+3l`#kn`">
                                                 <field name="NUM">1</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <statement name="DO0">
                                   <block type="debug" id="DjOBrKPAE:DPL/z:;+2r">
                                     <field name="Severity">log</field>
                                     <value name="TEXT">
                                       <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="#gPWPHyhjk/i6NV7^^BG">
                                         <field name="TEXT"></field>
                                       </shadow>
                                       <block type="text_join" id="VMO}u8o5VCY04xN|WdbE">
                                         <mutation items="3"></mutation>
                                         <value name="ADD0">
                                           <block type="text" id="I,bi$eN@$G0ly9Ny}+[1">
                                             <field name="TEXT">Bewaesserung: Ventil 1 - </field>
                                           </block>
                                         </value>
                                         <value name="ADD1">
                                           <block type="get_value_var" id=",cfY4.lO!;W@Fn(q}O|5">
                                             <field name="ATTR">val</field>
                                             <value name="OID">
                                               <shadow type="text" id="L0~ngEF*$AMo7uaQP$Kk">
                                                 <field name="TEXT"></field>
                                               </shadow>
                                               <block type="variables_get" id="Ll[WM3oN5%x0h*3%HXr,">
                                                 <field name="VAR" id="i/gy6[~1p3HXAlIvbd%.">vars_ventil_1_name</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <value name="ADD2">
                                           <block type="text" id="/.HVH=},FidB7rrwK^yr">
                                             <field name="TEXT"> aktiv</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                   </block>
                                 </statement>
                               </block>
                             </statement>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </statement>
               </block>
             </statement>
           </block>
          </xml>
          

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

            @Kuddel
            Ich verstehe den Sinn nicht. Was möchtest Du erreichen ?

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

              @paul53

              kurze erklärung.

              In meinem Bewässerungsskript sind zwei Modi möglich (parallel: true / false)

              Bei parallel starten Ventil 1 und 2 gleichzeitig.

              Wenn 2 fertig, dann 3.

              Ist für meinen Tropfschlauch gedacht, da der an Ventil 1 hängt und länger läuft als die anderen Ventile.

              In diesem Modi, werden für Ventil 1 und 2 jeweils zwei Log-Einträge generiert, da der Trigger 2 mal binnen einer Sekunde über die Anzahl der aktiven Vetile auslöst.

              Jetzt will ich die doppelten Log Einträge entfernen, in dem ich prüfe, ob der Ventil 1 Aktor in den letzten 100 MS aktiviert wurde

              5475b701-4634-44ae-93dd-c6ab31f21965-grafik.png

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

                @Kuddel sagte:

                jeweils zwei Log-Einträge generiert, da der Trigger 2 mal binnen einer Sekunde über die Anzahl der aktiven Vetile auslöst.

                Vorschlag:

                Blockly_temp.JPG

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

                  @Kuddel
                  Weshalb machst Du es so kompliziert ? Jeweils ein Trigger für jeden Ventil-Aktor würde es erheblich vereinfachen.

                  Blockly_temp.JPG

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

                    @paul53 ja ein Trigger pro Ventil wäre definitiv einfacher, macht das gesamte Skript aber noch länger ^^

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

                      @Kuddel sagte:

                      macht das gesamte Skript aber noch länger

                      Das glaube ich nicht.

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

                        @paul53 habe jetzt einen workaround gefunden.

                        der trigger wird jetzt bei jeder änderung der varibalbe restzeit_in_sek ausgelöst.

                        jetzt läuft der block zwar jede sekunde (während der Bewässerung), aber die log ausgabe funktioniert.

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        755
                        Online

                        32.0k
                        Users

                        80.4k
                        Topics

                        1.3m
                        Posts

                        2
                        19
                        364
                        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