Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] Schleife so lange ausführen bis Zustand richtig?

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Schleife so lange ausführen bis Zustand richtig?

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

      Habe das Problem dass ich ein Blockly suche mit dem eine Steckdose (Ein/Ausschalten) so lange bedient bis der Triggergrund weg ist. In dem Fall triggert eine über den Ping adapter kontrollierte Elektronik den Start.
      Danach wird die Steckdose die die Elektronik steuert aus- und wieder eingeschaltet. Falls der Trigger dann wieder auf true steht wäre alles gut. Aber das klappt nicht immer beim ersten Mal. Dann triggert der Ping Adapter aber nicht mehr. Daher habe ich versucht mal mehrere Schleifen hinzubauen, finde das aber ungut, da ich ja nicht weiß wieviele Schleifen man braucht.

      Geht das nicht einfacher?

      Bildschirmfoto 2023-11-27 um 12.44.59.png
      Bildschirmfoto 2023-11-27 um 12.45.41.png

      <xml xmlns="https://developers.google.com/blockly/xml">
        <block type="comment" id="_A1k=m2WI0NnuJY*b;VL" x="-1112" y="-512">
          <field name="COMMENT">ESP wird neu gestartet</field>
          <next>
            <block type="on" id="m7K*{F]5Co#4p9c5A0ST">
              <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_ESP_Status</field>
              <field name="CONDITION">ne</field>
              <field name="ACK_CONDITION"></field>
              <statement name="STATEMENT">
                <block type="debug" id="g1@VsR}-fIsioxo@DYJp">
                  <field name="Severity">log</field>
                  <value name="TEXT">
                    <shadow type="text" id="Y~aV{TP;tSild?ox*D{j">
                      <field name="TEXT">test</field>
                    </shadow>
                    <block type="on_source" id="`Ng{OIi4aNt`I8!nW$t;">
                      <field name="ATTR">state.val</field>
                    </block>
                  </value>
                  <next>
                    <block type="controls_if" id="BZ|3F9wAM;Gd?#W(~zC;">
                      <mutation elseif="2"></mutation>
                      <value name="IF0">
                        <block type="logic_operation" id="`dvX7C+34$sTF|kTO}c)" inline="false">
                          <field name="OP">AND</field>
                          <value name="A">
                            <block type="logic_compare" id="[4ztb+^?h/k]m6u1ysHR">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="NDM6{_HE+?;:Zh0q1,L3">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="lav#rnRtR1c3b8%XhNvp">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_compare" id="r[E.5+I=~N]_Wm0P(elC">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="`%]T^aa|Pmm;4s(DJbZe">
                                  <field name="ATTR">val</field>
                                  <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id=")mD$J(6x*.D`NyGrQ|K8">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO0">
                        <block type="control" id="CO+B[lH2*}%.`m!Vc8?9">
                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                          <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                          <field name="WITH_DELAY">FALSE</field>
                          <value name="VALUE">
                            <block type="logic_boolean" id="6]WPEocHgWW`Mua@*msi">
                              <field name="BOOL">FALSE</field>
                            </block>
                          </value>
                          <next>
                            <block type="debug" id="-F,t%B;]H(cO6xlhNR`B">
                              <field name="Severity">warn</field>
                              <value name="TEXT">
                                <shadow type="text" id="Y~aV{TP;tSild?ox*D{j">
                                  <field name="TEXT">test</field>
                                </shadow>
                                <block type="on_source" id="%CQ4pDLaAFkG/|F=~$s7">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="uy+.gU8E#WI##;BiP?hu">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                  <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                                  <field name="WITH_DELAY">TRUE</field>
                                  <field name="DELAY_MS">3</field>
                                  <field name="UNIT">sec</field>
                                  <field name="CLEAR_RUNNING">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="5#AV^SFEUe~WnuRRH-`J">
                                      <field name="BOOL">TRUE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="debug" id="V2+9h`FD@[GOJ[^Z#,^8">
                                      <field name="Severity">error</field>
                                      <value name="TEXT">
                                        <shadow type="text" id="Y~aV{TP;tSild?ox*D{j">
                                          <field name="TEXT">test</field>
                                        </shadow>
                                        <block type="on_source" id="O({iE~h]+r__~6nJ[l.K">
                                          <field name="ATTR">state.val</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="timeouts_wait" id="546wldbEI1G3iiGLqab1">
                                          <field name="DELAY">10</field>
                                          <field name="UNIT">sec</field>
                                          <next>
                                            <block type="debug" id="H$$|Wkli!7~FVx)Af4Is">
                                              <field name="Severity">log</field>
                                              <value name="TEXT">
                                                <shadow type="text" id="9XRWBXL+i@5thwFD/)di">
                                                  <field name="TEXT">Pause 1</field>
                                                </shadow>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                      <value name="IF1">
                        <block type="logic_operation" id="B1b/l$gt{ST)U,1YO4C1" inline="false">
                          <field name="OP">AND</field>
                          <value name="A">
                            <block type="logic_compare" id="V1ziw=_,)5}YA=^AZ!cg">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="KI[xRVj%g-gW1sV1jEbA">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="gtvLrH#k5tt#ZCrHBz2r">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_compare" id="!(Zj8,jX}Hg_Mg}Y50Kl">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="(EY00|][y7dt+X1!{tJT">
                                  <field name="ATTR">val</field>
                                  <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="zpAI1HFb!JIS)t4Z+u~_">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO1">
                        <block type="timeouts_wait" id="bW^VpYN$3ZsXX?7s+rNh">
                          <field name="DELAY">11</field>
                          <field name="UNIT">sec</field>
                          <next>
                            <block type="control" id="MdO/W~TXG,%?HS}4D#r}">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="(s{YG^nYq1!J}f|sWP@i">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="~WW27Q^J5Ck?jWOYX-PQ">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                  <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                                  <field name="WITH_DELAY">TRUE</field>
                                  <field name="DELAY_MS">3</field>
                                  <field name="UNIT">sec</field>
                                  <field name="CLEAR_RUNNING">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="D=e.y.8mY;uUaqV,2L|+">
                                      <field name="BOOL">TRUE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="debug" id="8J]l:#wXjsx-kET):k9b">
                                      <field name="Severity">error</field>
                                      <value name="TEXT">
                                        <shadow type="text" id="Y~aV{TP;tSild?ox*D{j">
                                          <field name="TEXT">test</field>
                                        </shadow>
                                        <block type="on_source" id="iEqF~#/2!K=i=,?Y-Dm}">
                                          <field name="ATTR">state.val</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="debug" id="[fsHEZdf@*JuIXvn{5Wt">
                                          <field name="Severity">log</field>
                                          <value name="TEXT">
                                            <shadow type="text" id="QO2r0]{wP~C^#E/lBgaM">
                                              <field name="TEXT">Pause 2</field>
                                            </shadow>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                      <value name="IF2">
                        <block type="logic_operation" id="ZWsTKiG?Spw{brDb7,j2" inline="false">
                          <field name="OP">AND</field>
                          <value name="A">
                            <block type="logic_compare" id="kkX5Zr9p;4+W6cbM)ta#">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="GU.|4rs]Zf$+YNs89mNx">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="S,6fL{-}ICPNVJkByy`G">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_compare" id="#CVs[mq|N+HBAYrXj0x)">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="80[K$zG6?,q;u9/p3zna">
                                  <field name="ATTR">val</field>
                                  <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="W.ogBK5o2nn`*2N$6:58">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO2">
                        <block type="timeouts_wait" id="nXl7VqiKIP[#v]@Q._4:">
                          <field name="DELAY">12</field>
                          <field name="UNIT">sec</field>
                          <next>
                            <block type="control" id="lL2~LKDKh.GV]5;k^nB{">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="_nXr_fau~-D{O*awJXc)">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="MjNO[KE!pDD-@g!e7LDf">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                  <field name="OID">alias.0.Variable.Soyo_inteligent_schalten.Soyo_Shelly_schalten</field>
                                  <field name="WITH_DELAY">TRUE</field>
                                  <field name="DELAY_MS">3</field>
                                  <field name="UNIT">sec</field>
                                  <field name="CLEAR_RUNNING">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="qFdeRjxW7@%YffQ|B4T.">
                                      <field name="BOOL">TRUE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="debug" id="ROKDFbR=J;8x`lD6]a#}">
                                      <field name="Severity">log</field>
                                      <value name="TEXT">
                                        <shadow type="text" id="@;C~W/;`4yKqj5JhaYNV">
                                          <field name="TEXT">Pause 3</field>
                                        </shadow>
                                      </value>
                                      <next>
                                        <block type="debug" id="sxssf$^=gq;Q(s}oX7}Y">
                                          <field name="Severity">error</field>
                                          <value name="TEXT">
                                            <shadow type="text" id="Y~aV{TP;tSild?ox*D{j">
                                              <field name="TEXT">test</field>
                                            </shadow>
                                            <block type="on_source" id="t-Z}m:vnbtG/!wN#M;mZ">
                                              <field name="ATTR">state.val</field>
                                            </block>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </next>
        </block>
      </xml>
      
      paul53 T 2 Replies Last reply Reply Quote 0
      • paul53
        paul53 @Peter c last edited by

        @peter-c sagte: Geht das nicht einfacher?

        Ja.

        Blockly_temp.JPG

        P 1 Reply Last reply Reply Quote 2
        • T
          TT-Tom @Peter c last edited by

          @peter-c

          Bildschirmfoto 2023-11-27 um 13.10.53.png

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

            @paul53
            Denke ich habs verstanden und das Blockly angepaßt. Aber - Muss da nicht die Bedingung Wert = wahr dazu - oder was soll sonst passieren wenn wert true / fals ist? Und braucht falls Object nicht auch so eine Bedingung?

            Bildschirmfoto 2023-11-27 um 13.34.08.png

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

              @peter-c sagte: Muss da nicht die Bedingung Wert = wahr dazu

              Nein, "falls" prüft auf wahr (für mache).

              P 2 Replies Last reply Reply Quote 1
              • P
                Peter c @paul53 last edited by

                @paul53 Wieder was gelernt - Danke

                Was hälst Du von der Lösung von TT-Tom?

                T paul53 2 Replies Last reply Reply Quote 0
                • T
                  TT-Tom @Peter c last edited by

                  @peter-c

                  Wenn Paul dir eine Lösung vorschlägt, kannst du sie einsetzen. Er ist hier im Forum der mit Abstand der Beste.

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

                    @peter-c sagte: Was hälst Du von der Lösung von TT-Tom?

                    Verzögert schon beim ersten Mal und läuft unendlich, wenn der ESP-Status nie wahr wird. Außerdem muss der Wert innerhalb des Intervalls nicht geprüft werden, da das Intervall bei wahr gestoppt wird.

                    P T 2 Replies Last reply Reply Quote 1
                    • P
                      Peter c @paul53 last edited by Peter c

                      @paul53 Alles klar. Wollte nur eine finale Antwort im Thread falls jemand anderes ein ähnliches Problem lösen muss.

                      Vielen Dank an Euch.

                      1 Reply Last reply Reply Quote 0
                      • T
                        TT-Tom @paul53 last edited by

                        @paul53

                        Danke für die Rückmeldung 👍🏻

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

                          @paul53 Leider hat das Blockly beim ersten Mal zwar ausgelöst der Effekt hat sich aber nicht eingestellt.

                          Bildschirmfoto 2023-11-27 um 17.14.12.png

                          Bildschirmfoto 2023-11-27 um 17.15.07.png

                          Frage: warum hat es nur 5 mal versucht zu reseten?
                          Gelb ist der Schalter Pink der ESP.

                          Bildschirmfoto 2023-11-27 um 17.20.15.png

                          Könnte es am Ping Adapter liegen der Standardmäßig auf 60000 ms eingestellt ist? Sollte ich den timeout höher stellen 70s?

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

                            @peter-c sagte: Könnte es am Ping Adapter liegen der Standardmäßig auf 60000 ms eingestellt ist? Sollte ich den timeout höher stellen 70s?

                            Ja, es macht keinen Sinn, es alle 10 s zu versuchen, wenn die Reaktionszeit bis zu 60 s beträgt.

                            1 Reply Last reply Reply Quote 0
                            • P
                              Peter c last edited by

                              @paul53 Hab das Skript jetzt einige Tage laufen und es funktioniert perfekt.

                              Danke

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

                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              422
                              Online

                              32.0k
                              Users

                              80.4k
                              Topics

                              1.3m
                              Posts

                              3
                              13
                              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