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] Bewässerung, nicht so simpel - variables Timeout

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Bewässerung, nicht so simpel - variables Timeout

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

      Hi,

      ich weiß es gibt schon einige Beregungsadapter und Scripte, aber alle durchwegs komplex. Ich brauche nur 6 Kreise mit 6 Magneventilen.
      Es gibt 2 Betriebsmodi:
      0 - Aus / Manuell
      1 - Auto

      Ich habe für jeden Kreis eine Start-, Stopp-, (Dauer ergibt sich dann) und Pausenzeit. Zusätzlich für jeden Kreis einen Tagesmarker (Mo - So ... ) - Tag an dem der Kreis im Auto-Modus aktiv sein soll.

      Soweit ich gestestet habe, funktioniert mein Blockly, nur ein Problem konnte ich nicht lösen: Das Timeout für die Bewässerungszeit ist ja dynamisch und das konnte ich noch nicht im Blockly realisieren.

      Hier ein Kreis für den Montag:
      2021-05-17_BlocklyBew.png
      Wenn ich das Timeout K1On fest auf 1 Minute setzte funktioniert das Skript und das Ventil bleibt für 1 Minute offen und wird dann wieder geschlossen.

      Sobald ich versuche, das Ganze über eine Variable zu steuern, geht der Steuerausgang des Ventils kurz auf ein und sofort wieder auf Aus, das Timeout wird also nicht ausgeführt.
      2021-05-17_BlocklyBew2.png

      Ich nehme an, daß es mit dem Format zu tun hat mit dem die Variable geladen wird. Den DP Bewaess_Dauer01 habe ich als String und als Zahl getestet, beides ging leider nicht.

      Code noch nicht fertig, nur mal 1 Tag und 2 Kreise zum testen:

      <xml xmlns="https://developers.google.com/blockly/xml">
        <variables>
          <variable id="o0i;r,T0e.pHjAD_C(.Q">Wochentagnummer</variable>
          <variable id="q/{=J}z!HmE~Ge9a(a?P">variableZeitK1</variable>
          <variable id="!Y]knWg@w?B2r0TK@g`.">K2OnZeit</variable>
          <variable type="timeout" id="K1On">K1On</variable>
          <variable type="timeout" id="K2On">K2On</variable>
        </variables>
        <block type="schedule" id="V=EF*{|lH3/yU=vJ3r%M" x="-1112" y="-462">
          <field name="SCHEDULE">*/10 * 5-16 * * *</field>
          <statement name="STATEMENT">
            <block type="controls_if" id="J{Paf!c~%k;e;B2(V!O(">
              <value name="IF0">
                <block type="logic_compare" id="uTZcCx[At2r,1;Ni3dTF">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="get_value" id="8Hp44w[xFsG;$ge3vLpV">
                      <field name="ATTR">val</field>
                      <field name="OID">javascript.0.BewaesserungV1.Betriebsart</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="math_number" id="#ZyoZ{@W*.Ix!E}EMV7$">
                      <field name="NUM">1</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO0">
                <block type="timeouts_cleartimeout" id="H*@TZ$S[M$rf*UB?seuX">
                  <field name="NAME">K1On</field>
                  <next>
                    <block type="timeouts_cleartimeout" id="*@%aufICzq*x,iEaN)D_">
                      <field name="NAME">K2On</field>
                      <next>
                        <block type="variables_set" id="kIKlu/X3u|51m)#(;+{U">
                          <field name="VAR" id="o0i;r,T0e.pHjAD_C(.Q">Wochentagnummer</field>
                          <value name="VALUE">
                            <block type="time_get" id="B9^8.?~0o,Lb~,J=;Tx]">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                              <field name="OPTION">wd</field>
                            </block>
                          </value>
                          <next>
                            <block type="logic_switch_case" id="XZ,ezZZapw#i3IK=$I0-">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation>
                              <value name="CONDITION">
                                <block type="variables_get" id="rNn3{o3?SaKbz5{rQUtp">
                                  <field name="VAR" id="o0i;r,T0e.pHjAD_C(.Q">Wochentagnummer</field>
                                </block>
                              </value>
                              <value name="CASECONDITION0">
                                <block type="math_number" id="q)G`:Gz50iQlf`9o[{F0">
                                  <field name="NUM">1</field>
                                </block>
                              </value>
                              <statement name="CASE0">
                                <block type="controls_if" id="z[~hV+!?Y=4.Lb_6;[Q0">
                                  <value name="IF0">
                                    <block type="logic_operation" id="tL*9O$n9+vj=B?%5469b">
                                      <field name="OP">AND</field>
                                      <value name="A">
                                        <block type="logic_compare" id="z97NHtd|1z{yXXc4Cflf">
                                          <field name="OP">EQ</field>
                                          <value name="A">
                                            <block type="get_value" id="5`Ru4,?XP8W$w-H}}ngg">
                                              <field name="ATTR">val</field>
                                              <field name="OID">javascript.0.BewaesserungV1.Kreis01.Mo01</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="logic_boolean" id="+?5)0Ty6S7^),@^02G~%">
                                              <field name="BOOL">TRUE</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <block type="logic_compare" id="cjK0~u3ale%y]mf{VwIS">
                                          <field name="OP">EQ</field>
                                          <value name="A">
                                            <block type="text_join" id="Tt83J{+_k=Dk3El[8aiX">
                                              <mutation items="2"></mutation>
                                              <value name="ADD0">
                                                <block type="convert_from_date" id="ivVvnI9#q!yf)Fsu$pSB">
                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                  <field name="OPTION">hh:mm</field>
                                                  <value name="VALUE">
                                                    <block type="time_get" id="n^DRdC|QEO%^_Aago=CA">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                      <field name="OPTION">object</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="get_value" id="GYYjrRb0PMvIe7,86yqg">
                                              <field name="ATTR">val</field>
                                              <field name="OID">javascript.0.BewaesserungV1.Kreis01.Start01</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="variables_set" id="KG@{wx^+3-CwUW#A.{~}">
                                      <field name="VAR" id="q/{=J}z!HmE~Ge9a(a?P">variableZeitK1</field>
                                      <value name="VALUE">
                                        <block type="get_value" id="o*4sFM~B;2S{PDt$bCYK">
                                          <field name="ATTR">val</field>
                                          <field name="OID">javascript.0.BewaesserungV1.Kreis01.Dauer01</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="control" id="b^WI+m){g2,$UMm4xmfz">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">0_userdata.0.SmartDEN_MQTT16R.Relay.R01</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="logic_boolean" id="a=L).qXThl5Jo9m$J2}1">
                                              <field name="BOOL">TRUE</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="timeouts_settimeout" id="lR!QPt8|J|z{B+INOIsG">
                                              <field name="NAME">K1On</field>
                                              <field name="DELAY">1</field>
                                              <field name="UNIT">min</field>
                                              <statement name="STATEMENT">
                                                <block type="control" id="gCh+Yqm#x+~#^9exCDL7">
                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                  <field name="OID">0_userdata.0.SmartDEN_MQTT16R.Relay.R01</field>
                                                  <field name="WITH_DELAY">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="logic_boolean" id="@zHvN.T28fIY1juFzV`x">
                                                      <field name="BOOL">FALSE</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </statement>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                  <next>
                                    <block type="controls_if" id="g=R_WGL,rb(G]JEQyz$u">
                                      <value name="IF0">
                                        <block type="logic_operation" id="x8E1[dK;Py93R;cJm.AV">
                                          <field name="OP">AND</field>
                                          <value name="A">
                                            <block type="logic_compare" id="dV_J(V;xU[z=zi7N4fu6">
                                              <field name="OP">EQ</field>
                                              <value name="A">
                                                <block type="get_value" id="Hwpcincl2:|FUvr!A8RN">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">javascript.0.BewaesserungV1.Kreis02.Mo02</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <block type="logic_boolean" id="t^}s/Ej]]_bYPt7NoK0E">
                                                  <field name="BOOL">TRUE</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="logic_compare" id="^L%DB]Hb~jUIU7xxRZ3L">
                                              <field name="OP">EQ</field>
                                              <value name="A">
                                                <block type="text_join" id="0p[F@hU)Y6?g8d-/){sT">
                                                  <mutation items="2"></mutation>
                                                  <value name="ADD0">
                                                    <block type="convert_from_date" id="z`XaeFm8Nh=}h#]EN.p=">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                      <field name="OPTION">hh:mm</field>
                                                      <value name="VALUE">
                                                        <block type="time_get" id="4|)+z{Albo`l8iWVTV3G">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                          <field name="OPTION">object</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <block type="get_value" id="YW0N|m3/QwIxQ#^pNWL{">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">javascript.0.BewaesserungV1.Kreis02.Start02</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <statement name="DO0">
                                        <block type="variables_set" id="_VGw6]T1]{eqDCf*31r3">
                                          <field name="VAR" id="!Y]knWg@w?B2r0TK@g`.">K2OnZeit</field>
                                          <value name="VALUE">
                                            <block type="get_value" id="Q4;T+li7sV;xw8qSsCAw">
                                              <field name="ATTR">val</field>
                                              <field name="OID">javascript.0.BewaesserungV1.Kreis02.Dauer02</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="control" id="=YerFfcDw~0v}fM([l}4">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">0_userdata.0.SmartDEN_MQTT16R.Relay.R02</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="aaNuQT+mi3GI`v$!EFe=">
                                                  <field name="BOOL">TRUE</field>
                                                </block>
                                              </value>
                                              <next>
                                                <block type="timeouts_settimeout" id="b5EUW7jwJ6)bGl?hv|M3">
                                                  <field name="NAME">K2On</field>
                                                  <field name="DELAY">1</field>
                                                  <field name="UNIT">min</field>
                                                  <statement name="STATEMENT">
                                                    <block type="control" id="MPwI7G)FP$;~~QZ[R[TF">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                      <field name="OID">0_userdata.0.SmartDEN_MQTT16R.Relay.R01</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="logic_boolean" id="+v|I1gmX`Wb`/U`hN*^j">
                                                          <field name="BOOL">FALSE</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </statement>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </statement>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                              <value name="CASECONDITION1">
                                <block type="math_number" id="8*9+h`rHXbI{jjOA(qc}">
                                  <field name="NUM">2</field>
                                </block>
                              </value>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </statement>
        </block>
      </xml>
      
      

      Hoffe auf eine Tipp, wie ich das Timeout mit dem Wert eines DP laden kann.

      Vielen Dank

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

        @tritor Wenn Du die Dauer des Timeouts über eine Variable steuerst, ist der Wert immer in Millisekunden, egal was im gelben Blockly gewählt wurde.

        dslraser 1 Reply Last reply Reply Quote 0
        • dslraser
          dslraser Forum Testing Most Active @Ahnungsbefreit last edited by

          @ahnungsbefreit sagte in Bewässerung, doch nicht so simpel - variables Timeout:

          @tritor Wenn Du die Dauer des Timeouts über eine Variable steuerst, ist der Wert immer in Millisekunden, egal was im gelben Blockly gewählt wurde.

          wollte es auch gerade schreiben. Also am besten in einer zusätzlichen Variable die Minuten in Millisekunden umrechnen.

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

            @dslraser sagte: Minuten in Millisekunden umrechnen.

            Bild_2021-05-17_164951.png

            T 1 Reply Last reply Reply Quote 1
            • T
              tritor @paul53 last edited by

              @paul53, @dslraser, @Ahnungsbefreit

              hab es gerade eingebaut und getestet: ihr seid die Besten.

              Funzt perfekt.

              Danke

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

              Support us

              ioBroker
              Community Adapters
              Donate

              580
              Online

              32.0k
              Users

              80.4k
              Topics

              1.3m
              Posts

              blockly
              4
              5
              255
              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