Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] Schleife funktioniert nicht

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Schleife funktioniert nicht

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

      Hallo,

      ich möchte meine Bewässerungsventile nach einer bestimmten Zeit nacheinander öffnen und schließen. Wenn das Blockly am letzen Ventil angekommen ist, soll es wieder beim ersten Ventil ankommen. Erst wenn ein Ereigniss eintritt, soll diese Schleife unterbrochen werden. Leider schieß ich mir durch das Blockly jedesmal meine Java Instanz ab.
      Hat jemand eine Idee, wie ich das über Blockly am besten realisiren kann?
      Ich versuche den Zähler der Variable immer um "1" zu erhöhen und dann wieder auf "0" zu setzen, damit die Bedingung immer stimmt und die Schleife von vorn anfängt. (Die eingestellten Zeiten sind nur zum Test und sollen später erhöht werden)

      DANKE!

      2020-06-30_061842.png

      <block xmlns="https://developers.google.com/blockly/xml" type="on_ext" id="5jeZCV=J35gArxQ~TSn}" x="-1187" y="-1087">
       <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
       <field name="CONDITION">any</field>
       <field name="ACK_CONDITION"></field>
       <value name="OID0">
         <shadow type="field_oid" id=";`,3XA`J.K+:WVxnU}d,">
           <field name="oid">hm-rpc.1.CUX2801002.6.PRESS_SHORT</field>
         </shadow>
       </value>
       <statement name="STATEMENT">
         <block type="variables_set" id=",FL{SvTp{/7I0yp.7{JG">
           <field name="VAR" id="=E6],=yxq_!UyitioeR!">Zähler</field>
           <value name="VALUE">
             <block type="math_number" id="ON@9-?TvM1gE:f1sqN@_">
               <field name="NUM">0</field>
             </block>
           </value>
           <next>
             <block type="controls_whileUntil" id="m0XQifk%Rceu9Kwj7?3#">
               <field name="MODE">WHILE</field>
               <value name="BOOL">
                 <block type="logic_compare" id="4E2^c|2-eEFa06iD1Hw;">
                   <field name="OP">LT</field>
                   <value name="A">
                     <block type="variables_get" id="D0=uAG2j1Xg1WTpeFds:">
                       <field name="VAR" id="=E6],=yxq_!UyitioeR!">Zähler</field>
                     </block>
                   </value>
                   <value name="B">
                     <block type="math_number" id="zXG_R+]EM%n,q#u(S@x{">
                       <field name="NUM">10</field>
                     </block>
                   </value>
                 </block>
               </value>
               <statement name="DO">
                 <block type="timeouts_settimeout" id="5tO:0]VtEQj.{A=q$[IQ">
                   <field name="NAME">timeout</field>
                   <field name="DELAY">20</field>
                   <field name="UNIT">sec</field>
                   <statement name="STATEMENT">
                     <block type="control" id="X]?JJ|`2UWBl_2o]8NQm">
                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                       <field name="OID">sonoff.0.Bewaesserung.POWER1</field>
                       <field name="WITH_DELAY">FALSE</field>
                       <value name="VALUE">
                         <block type="logic_boolean" id="d}!x~,~FVRaC}iD-_TTM">
                           <field name="BOOL">FALSE</field>
                         </block>
                       </value>
                       <next>
                         <block type="control" id="]6gH]FN!E$p=wI+^r$R/">
                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                           <field name="OID">sonoff.0.Bewaesserung.POWER1</field>
                           <field name="WITH_DELAY">TRUE</field>
                           <field name="DELAY_MS">20</field>
                           <field name="UNIT">sec</field>
                           <field name="CLEAR_RUNNING">FALSE</field>
                           <value name="VALUE">
                             <block type="logic_boolean" id="ae[k*KlN0Q;c(:uRIcvb">
                               <field name="BOOL">FALSE</field>
                             </block>
                           </value>
                           <next>
                             <block type="math_change" id="$4r[DC{E#Y@[l#Y_a#,^">
                               <field name="VAR" id="=E6],=yxq_!UyitioeR!">Zähler</field>
                               <value name="DELTA">
                                 <shadow type="math_number" id="PyHVfmz3D.sYv3,rIRea">
                                   <field name="NUM">1</field>
                                 </shadow>
                               </value>
                               <next>
                                 <block type="timeouts_settimeout" id="Gl9,]]x0Q99xZp,e4HZL">
                                   <field name="NAME">timeout3</field>
                                   <field name="DELAY">20</field>
                                   <field name="UNIT">sec</field>
                                   <statement name="STATEMENT">
                                     <block type="control" id="v@klFXZzmB0AurOj=Ha[">
                                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                       <field name="OID">sonoff.0.Bewaesserung.POWER2</field>
                                       <field name="WITH_DELAY">FALSE</field>
                                       <value name="VALUE">
                                         <block type="logic_boolean" id="KHvz0TS?gO;aQI6`HF$u">
                                           <field name="BOOL">FALSE</field>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="control" id="u[x4,$-y*{]Cl(-)J^fQ">
                                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                           <field name="OID">sonoff.0.Bewaesserung.POWER2</field>
                                           <field name="WITH_DELAY">TRUE</field>
                                           <field name="DELAY_MS">20</field>
                                           <field name="UNIT">sec</field>
                                           <field name="CLEAR_RUNNING">FALSE</field>
                                           <value name="VALUE">
                                             <block type="logic_boolean" id="d^i49M0+ck9cur-_Dq.6">
                                               <field name="BOOL">FALSE</field>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="math_change" id=")B5D.emSZWoj|)M|r,9:">
                                               <field name="VAR" id="=E6],=yxq_!UyitioeR!">Zähler</field>
                                               <value name="DELTA">
                                                 <shadow type="math_number" id=";SyH$-(u7MxU4FPW!]cY">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                               </value>
                                               <next>
                                                 <block type="timeouts_settimeout" id="^`IRs?cr,kZ+vHr;rtWB">
                                                   <field name="NAME">timeout2</field>
                                                   <field name="DELAY">20</field>
                                                   <field name="UNIT">sec</field>
                                                   <statement name="STATEMENT">
                                                     <block type="control" id="L*GqVZX?{xdvbY$.,i!|">
                                                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                       <field name="OID">sonoff.0.Bewaesserung.POWER3</field>
                                                       <field name="WITH_DELAY">FALSE</field>
                                                       <value name="VALUE">
                                                         <block type="logic_boolean" id="4Gyb#~Fd4H($A?wfi[~0">
                                                           <field name="BOOL">TRUE</field>
                                                         </block>
                                                       </value>
                                                       <next>
                                                         <block type="control" id="$94[ZP%@B0CYjurVFL[6">
                                                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                                           <field name="OID">sonoff.0.Bewaesserung.POWER3</field>
                                                           <field name="WITH_DELAY">TRUE</field>
                                                           <field name="DELAY_MS">20</field>
                                                           <field name="UNIT">sec</field>
                                                           <field name="CLEAR_RUNNING">FALSE</field>
                                                           <value name="VALUE">
                                                             <block type="logic_boolean" id="xZ[x!vsmU:=D^$Pa06zl">
                                                               <field name="BOOL">FALSE</field>
                                                             </block>
                                                           </value>
                                                           <next>
                                                             <block type="variables_set" id="EJ6)i!H)WJ.[IBGE`o%s">
                                                               <field name="VAR" id="=E6],=yxq_!UyitioeR!">Zähler</field>
                                                               <value name="VALUE">
                                                                 <block type="math_number" id="!uv*K;0!j,,~nSCI)=hT">
                                                                   <field name="NUM">0</field>
                                                                 </block>
                                                               </value>
                                                               <next>
                                                                 <block type="timeouts_cleartimeout" id="`sE1-|kgb(L),(U8A^yP">
                                                                   <field name="NAME">timeout</field>
                                                                 </block>
                                                               </next>
                                                             </block>
                                                           </next>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </statement>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </statement>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                   </statement>
                 </block>
               </statement>
             </block>
           </next>
         </block>
       </statement>
      </block>
      

      L paul53 2 Replies Last reply Reply Quote 0
      • L
        lesiflo Most Active @falke69 last edited by

        @falke69 Im letzten timeout2 setzt du den Zähler wieder auf 0. Die Schleife soll aber solange laufen bis sie auf 10 ist. Der Wert wert wird aber nie erreicht. Somit hast du eine Endloßschleife.
        Kennst du eigentlich den Adapter für die Gartenbewässerung?

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

          @falke69
          "Wiederhole solange" erzeugt regelmäßig eine Endlosschleife !
          Verwende stattdessen ein Intervall, das gestoppt wird wenn das letzte Ventil schließt.

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

            Hallo @lesiflo lesiflo; @paul53

            das mit der Endloßschleife ist eigentlich auch so gewollt. Wenn ich einmal rum bin, soll es auch wieder von vorn beginnen. Daher setze ich auch den Zähler zum Schluss auch wieder auf 0.
            Aber so schießt es mir aktuell immer meine Java Instanz ab. Den Adapter für die Gartenbewässerung kenne ich noch nicht. Ich habe nur einen für Gardena und einen Rain Bird gefunden - gibt es noch einen anderen? Da ich diese System nicht habe, wollte ich das halt ganz schlicht und einfach über ein Blockly lösen.

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

              @falke69 sagte:

              das mit der Endloßschleife ist eigentlich auch so gewollt.

              Das glaube ich nicht: "Wiederhole solange" erzeugt im ms-Rhythmus neue Timeouts und zwingt so die CPU in die Knie.

              Versuche es mal so:

              Blockly_temp.JPG

              falke69 1 Reply Last reply Reply Quote 1
              • falke69
                falke69 @paul53 last edited by

                @paul53

                Vielen DANK! 👍 👏

                läuft. 🙂

                1 Reply Last reply Reply Quote 0
                • L
                  lesiflo Most Active @falke69 last edited by

                  @falke69 Der Adapter ist an keinen Hersteller gebunden. Gerade für die Sonoff ist der sehr gut. Gucks du hier: https://forum.iobroker.net/topic/32213/test-adapter-gartenbewässerung-v0-0-x

                  falke69 1 Reply Last reply Reply Quote 0
                  • falke69
                    falke69 @lesiflo last edited by

                    @lesiflo

                    Danke!

                    schau ich mir mal mit an. 🙂

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

                    Support us

                    ioBroker
                    Community Adapters
                    Donate

                    956
                    Online

                    31.9k
                    Users

                    80.2k
                    Topics

                    1.3m
                    Posts

                    blockly
                    3
                    8
                    415
                    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