Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Wartezeit einfügen ?

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Wartezeit einfügen ?

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

      Hallo,
      hatte schon im Discord Channel mal nachgehakt aber ich poste es hier auch noch einmal.

      Szenario:
      1x Bewegungsmelder sowie zwei Magnetventile, die angesteuert werden müssen.

      Prinzipiell soll der Ablauf so sein, dass wenn Bewegung erkannt wird, dass zuerst das Magnetventil 1 für 3 Sek öffnet und das Magnetventil 2 nach 4 Sekunden für 3 Sekunden öffnet.
      Dies funktioniert auch bereits eigentlich ganz gut.

      Allerdings möchte ich nun einen Timer haben, dass wenn Magnetventil 2 geschlossen wurde eine Zeit abläuft, so dass innerhalb dieses Counters nicht wieder die Sequenz aufgerufen wird. Also zB erst nach 20 Sekunden wieder bei Bewegung erkannt die Magnetventile öffnen. Vorher aber nicht. Bin für jeden Tipp dankbar.

      Mein Hirn ist für Blockeis einfach nicht gemacht.

      Anbei das bisherige Blockly:
      Bildschirmfoto 2021-04-24 um 08.35.05.png

      A BBTown 2 Replies Last reply Reply Quote 0
      • A
        Adnim @Segway last edited by Adnim

        @segway
        noch ne variable "Sperrzeit" mit stop und Timeout block. setzen bei magnetventil 2 dann im timeout block 20sek später zurück nehmen.
        Dann muss das nur noch als abfrage oben mit rein. ist sperrzeit falsch.

        Edith: dein Timeout sollte auch nen Stopp block davor haben, immer damit nicht unzählige Timeouts gestartet werden können...

        Segway 3 Replies Last reply Reply Quote 0
        • Segway
          Segway @Adnim last edited by Segway

          @adnim
          Puh, das überfordert meine Kenntnisse und Verständnis aber ich versuch mal was zu "basteln".

          1 Reply Last reply Reply Quote 0
          • Segway
            Segway @Adnim last edited by

            @adnim
            Ne keine Ahnung, wie ich das machen muss. Kann ich nicht die variable timeout3 dafür nehmen ?

            1 Reply Last reply Reply Quote 0
            • Segway
              Segway @Adnim last edited by

              @adnim
              so gehts leider nicht
              bb0fb198-6e6b-4a46-84f7-4857deab38cc-image.png

              A 1 Reply Last reply Reply Quote 0
              • A
                Ahnungsbefreit @Segway last edited by Ahnungsbefreit

                @segway ok, dann setzen wir das Gespräch eben hier fort, ich bin halt nicht 24/7 im Discord.

                Ich würde folgenden Aufbau vorschlagen (kann aber natürlich nicht selbst testen, da andere Hardware):

                8353e8fa-318c-45d7-a3f8-4bbdd96e65cf-image.png

                Die Datenpunkte von Dir sind natürlich noch anzupassen auf Deine.

                Noch ein Nachtrag: "Duration" wird nur einmalig gesetzt auf die gewünschte Verzögerung in ms, Du könntest natürlich statt dessen auch direkt unten in den Timeout 20 schreiben und die Einheit auf "Sek" setzen.

                Segway 1 Reply Last reply Reply Quote 0
                • BBTown
                  BBTown @Segway last edited by

                  @segway das könnte funktionieren
                  d93d579b-b652-4d4b-a66f-973a5844bdcf-image.png

                  <xml xmlns="https://developers.google.com/blockly/xml">
                    <variables>
                      <variable id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</variable>
                      <variable type="timeout" id="Ventil1_stop">Ventil1_stop</variable>
                      <variable type="timeout" id="timeout">timeout</variable>
                      <variable type="timeout" id="Ventil_2_start">Ventil_2_start</variable>
                      <variable type="timeout" id="Ventil_2_stop">Ventil_2_stop</variable>
                    </variables>
                    <block type="variables_set" id=".IyR|dKbBHY(HSaqiF8?" x="37" y="63">
                      <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                      <value name="VALUE">
                        <block type="logic_boolean" id="!aBm4iUz`fnZn2T_Z.i;">
                          <field name="BOOL">FALSE</field>
                        </block>
                      </value>
                      <next>
                        <block type="on_ext" id="8c:5/j}2MF(BG|y*0J#o">
                          <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="Z6p9/fXp3P!q*4tX7l6r">
                              <field name="oid">Test.0.Bewegung erkannt</field>
                            </shadow>
                          </value>
                          <statement name="STATEMENT">
                            <block type="controls_if" id="U-$j{_R^2eU890|Txwfa">
                              <value name="IF0">
                                <block type="logic_negate" id="G_+fbtI)Mlp=1TacY,x-">
                                  <value name="BOOL">
                                    <block type="variables_get" id="Vt:j7mq^:%H)!$8UcFs3">
                                      <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="variables_set" id="3dVcIf=aE.,c(:gHy/$I">
                                  <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="E?rB;m,9_yPJiPca2k4r">
                                      <field name="BOOL">TRUE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="procedures_callnoreturn" id="LvhL:mqabp@P#-XUY!*v">
                                      <mutation name="Ventile"></mutation>
                                      <next>
                                        <block type="timeouts_settimeout" id="p/Ds)7xp1-24/W8/C2EF">
                                          <field name="NAME">timeout</field>
                                          <field name="DELAY">20</field>
                                          <field name="UNIT">sec</field>
                                          <statement name="STATEMENT">
                                            <block type="variables_set" id="vdI%JZZD8Oa!umNH*R!m">
                                              <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="vc[;DmrA`r.G_zv.T?P(">
                                                  <field name="BOOL">FALSE</field>
                                                </block>
                                              </value>
                                            </block>
                                          </statement>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </statement>
                        </block>
                      </next>
                    </block>
                    <block type="procedures_defnoreturn" id="1my6gN63s_D{X)kD.EOi" x="537" y="62">
                      <field name="NAME">Ventile</field>
                      <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                      <statement name="STACK">
                        <block type="timeouts_cleartimeout" id="sqn};d/?zBr-A|`,s(GR">
                          <field name="NAME">Ventil1_stop</field>
                          <next>
                            <block type="timeouts_cleartimeout" id="iotG*7Y(l{]FkDTQ$iQ=">
                              <field name="NAME">Ventil_2_start</field>
                              <next>
                                <block type="timeouts_cleartimeout" id="[*qJ.As1h?SlxHz@AU,h">
                                  <field name="NAME">Ventil_2_stop</field>
                                  <next>
                                    <block type="control" id="epcUw;kJ(%V1~pIqI4AH">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">Test.0.DP1</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="logic_boolean" id="WalLuAs)cAL8=`pL?Xpg">
                                          <field name="BOOL">TRUE</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="timeouts_settimeout" id="1#z+yc@n-ZL2pd0@2bEN">
                                          <field name="NAME">Ventil1_stop</field>
                                          <field name="DELAY">3</field>
                                          <field name="UNIT">sec</field>
                                          <statement name="STATEMENT">
                                            <block type="control" id="[8GY3Bg0a+bW/,?j(-ch">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">Test.0.DP1</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="eSgmN@b6%[Vo}]yYIZ;r">
                                                  <field name="BOOL">FALSE</field>
                                                </block>
                                              </value>
                                            </block>
                                          </statement>
                                          <next>
                                            <block type="timeouts_settimeout" id=";jxyI]C=B!;M74AUz=@d">
                                              <field name="NAME">Ventil_2_start</field>
                                              <field name="DELAY">4</field>
                                              <field name="UNIT">sec</field>
                                              <statement name="STATEMENT">
                                                <block type="control" id="e`#M,q.mO0Q;(MJh`c*^">
                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                  <field name="OID">Test.0.DP2</field>
                                                  <field name="WITH_DELAY">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="logic_boolean" id="R`2l`[z$6#^7BRVqh{pj">
                                                      <field name="BOOL">TRUE</field>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="timeouts_settimeout" id="}y{!T:3j=c,RWq,pZJGz">
                                                      <field name="NAME">Ventil_2_stop</field>
                                                      <field name="DELAY">3</field>
                                                      <field name="UNIT">sec</field>
                                                      <statement name="STATEMENT">
                                                        <block type="control" id="u8zm}xKqd!60J)hD6LE!">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                          <field name="OID">Test.0.DP2</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <block type="logic_boolean" id="WctIHM?ATNW/|($!@[K:">
                                                              <field name="BOOL">FALSE</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </statement>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                  </xml>
                  

                  BBTown 1 Reply Last reply Reply Quote 0
                  • Segway
                    Segway @Ahnungsbefreit last edited by

                    @ahnungsbefreit

                    Ich hab das jetzt so gelöst. Es scheint zu funktionieren. Oder ist das nicht gut ?

                    3be72500-a94a-42da-b1ef-c05140774c9e-image.png

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      Ahnungsbefreit @Segway last edited by

                      @segway Ja, sollte soweit klappen. In meiner Variante braucht es keine "Duration" zum Prüfen, ob der Timeout läuft, denn dann ist ja der Counter>0. Deswegen auch kein StopTimeout. Aber egal, sollte so auch gehen.

                      Noch eine Anregung: Ich würde (wie gepostet) beim Trigger "Falls Objekt" nicht auf "wurde geändert" prüfen, sondern auf "größer als letztes". Grund: Der BWM wird normalerweise "true", wenn er Bewegung erkennt und dann wieder "false". In Deiner Variante löst Du also 2x aus.

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        Ahnungsbefreit @Ahnungsbefreit last edited by

                        @Segway Das "setze duration auf 0" ganz am Anfang bitte noch wieder aktivieren, sonst startet Dein Script mit einem undefinierten Zustand.

                        Segway 1 Reply Last reply Reply Quote 0
                        • Segway
                          Segway @Ahnungsbefreit last edited by

                          @ahnungsbefreit

                          Okay duration am Anfang aktiviert und Falls Objekt geändert.
                          ... ich teste

                          1 Reply Last reply Reply Quote 0
                          • BBTown
                            BBTown @BBTown last edited by

                            @Segway

                            @segway das könnte funktionieren
                            d93d579b-b652-4d4b-a66f-973a5844bdcf-image.png

                            <xml xmlns="https://developers.google.com/blockly/xml">
                              <variables>
                                <variable id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</variable>
                                <variable type="timeout" id="Ventil1_stop">Ventil1_stop</variable>
                                <variable type="timeout" id="timeout">timeout</variable>
                                <variable type="timeout" id="Ventil_2_start">Ventil_2_start</variable>
                                <variable type="timeout" id="Ventil_2_stop">Ventil_2_stop</variable>
                              </variables>
                              <block type="variables_set" id=".IyR|dKbBHY(HSaqiF8?" x="37" y="63">
                                <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                <value name="VALUE">
                                  <block type="logic_boolean" id="!aBm4iUz`fnZn2T_Z.i;">
                                    <field name="BOOL">FALSE</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="on_ext" id="8c:5/j}2MF(BG|y*0J#o">
                                    <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="Z6p9/fXp3P!q*4tX7l6r">
                                        <field name="oid">Test.0.Bewegung erkannt</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="controls_if" id="U-$j{_R^2eU890|Txwfa">
                                        <value name="IF0">
                                          <block type="logic_negate" id="G_+fbtI)Mlp=1TacY,x-">
                                            <value name="BOOL">
                                              <block type="variables_get" id="Vt:j7mq^:%H)!$8UcFs3">
                                                <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="variables_set" id="3dVcIf=aE.,c(:gHy/$I">
                                            <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="E?rB;m,9_yPJiPca2k4r">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="procedures_callnoreturn" id="LvhL:mqabp@P#-XUY!*v">
                                                <mutation name="Ventile"></mutation>
                                                <next>
                                                  <block type="timeouts_settimeout" id="p/Ds)7xp1-24/W8/C2EF">
                                                    <field name="NAME">timeout</field>
                                                    <field name="DELAY">20</field>
                                                    <field name="UNIT">sec</field>
                                                    <statement name="STATEMENT">
                                                      <block type="variables_set" id="vdI%JZZD8Oa!umNH*R!m">
                                                        <field name="VAR" id="DcPt@TXQz4F+T;n[hn{y">SteuerungAusgelöst</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="vc[;DmrA`r.G_zv.T?P(">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                              <block type="procedures_defnoreturn" id="1my6gN63s_D{X)kD.EOi" x="537" y="62">
                                <field name="NAME">Ventile</field>
                                <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                <statement name="STACK">
                                  <block type="timeouts_cleartimeout" id="sqn};d/?zBr-A|`,s(GR">
                                    <field name="NAME">Ventil1_stop</field>
                                    <next>
                                      <block type="timeouts_cleartimeout" id="iotG*7Y(l{]FkDTQ$iQ=">
                                        <field name="NAME">Ventil_2_start</field>
                                        <next>
                                          <block type="timeouts_cleartimeout" id="[*qJ.As1h?SlxHz@AU,h">
                                            <field name="NAME">Ventil_2_stop</field>
                                            <next>
                                              <block type="control" id="epcUw;kJ(%V1~pIqI4AH">
                                                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                <field name="OID">Test.0.DP1</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="WalLuAs)cAL8=`pL?Xpg">
                                                    <field name="BOOL">TRUE</field>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="timeouts_settimeout" id="1#z+yc@n-ZL2pd0@2bEN">
                                                    <field name="NAME">Ventil1_stop</field>
                                                    <field name="DELAY">3</field>
                                                    <field name="UNIT">sec</field>
                                                    <statement name="STATEMENT">
                                                      <block type="control" id="[8GY3Bg0a+bW/,?j(-ch">
                                                        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                        <field name="OID">Test.0.DP1</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="eSgmN@b6%[Vo}]yYIZ;r">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </statement>
                                                    <next>
                                                      <block type="timeouts_settimeout" id=";jxyI]C=B!;M74AUz=@d">
                                                        <field name="NAME">Ventil_2_start</field>
                                                        <field name="DELAY">4</field>
                                                        <field name="UNIT">sec</field>
                                                        <statement name="STATEMENT">
                                                          <block type="control" id="e`#M,q.mO0Q;(MJh`c*^">
                                                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                            <field name="OID">Test.0.DP2</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <block type="logic_boolean" id="R`2l`[z$6#^7BRVqh{pj">
                                                                <field name="BOOL">TRUE</field>
                                                              </block>
                                                            </value>
                                                            <next>
                                                              <block type="timeouts_settimeout" id="}y{!T:3j=c,RWq,pZJGz">
                                                                <field name="NAME">Ventil_2_stop</field>
                                                                <field name="DELAY">3</field>
                                                                <field name="UNIT">sec</field>
                                                                <statement name="STATEMENT">
                                                                  <block type="control" id="u8zm}xKqd!60J)hD6LE!">
                                                                    <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                    <field name="OID">Test.0.DP2</field>
                                                                    <field name="WITH_DELAY">FALSE</field>
                                                                    <value name="VALUE">
                                                                      <block type="logic_boolean" id="WctIHM?ATNW/|($!@[K:">
                                                                        <field name="BOOL">FALSE</field>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </statement>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </statement>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                              </block>
                            </xml>
                            

                            Dir scheint mein Lösungsvorschlag nicht zu gefallen 😉

                            Segway 1 Reply Last reply Reply Quote 0
                            • Segway
                              Segway @BBTown last edited by

                              @bbtown
                              Doch klar aber ich bin froh das es überhaupt funktioniert jetzt und habe mich dann an diese Philosophie gehalten. Dein Vorschlag sieht ja irgendwie komplett anders anders - daher blieb ich erstmal bei dem anderen 🙂

                              Aber vielleicht teste ich das mal --> momentan zu viel Baustellen 🙂

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

                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              821
                              Online

                              32.0k
                              Users

                              80.5k
                              Topics

                              1.3m
                              Posts

                              4
                              13
                              303
                              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