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] Blockly - Frage bzgl. Datumvergleich/abgleich

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Blockly - Frage bzgl. Datumvergleich/abgleich

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

      Hallo.

      In dem Blockly möchte ich das Datum abgleichen und einen Zeitraum bestimmen (01.06 bis 31.08.), in dem keine Aktion ausgeführt wird.

      Bei der Datumsangabe habe ich bereits andere Formate wie "-" "/" "." erfolglos ausprobiert.

      Das Blockly funktioniert ohne den Datumsvergleich einwandfrei.

      Ich komme nicht weiter, wo ist mein Fehler?

      P1.png

      <xml xmlns="https://developers.google.com/blockly/xml">
        <variables>
          <variable type="timeout" id="timeout">timeout</variable>
          <variable id="X[o`:GhQqiB:*.8jyc0H">Liste</variable>
          <variable id="WFRN5(M2a?.m*xSqY[K3">bestandteile</variable>
          <variable type="interval" id="Intervall">Intervall</variable>
          <variable id="F.#%2wU=LjdgD_8}sN*V">Intervall</variable>
        </variables>
        <block type="on_ext" id="U6{!CVVgQv1z7.+K,._e" x="-1837" y="553">
          <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
          <field name="CONDITION">ne</field>
          <field name="ACK_CONDITION"></field>
          <value name="OID0">
            <shadow type="field_oid" id="{P/XF7f~SkI-kw}F~K,9">
              <field name="oid">0_userdata.0.FensterStatus.SummeFensterAuf</field>
            </shadow>
          </value>
          <value name="OID1">
            <shadow type="field_oid" id="ViV=}q8YZ2Z0Vdmx[(7]">
              <field name="oid">mqtt.0.WETTERSENSOR-AUSSEN.Klimasensor-BME280.AUSSENTEMPERATUR</field>
            </shadow>
          </value>
          <statement name="STATEMENT">
            <block type="controls_if" id="(|Sh2:6@1jLE!Cc/w8k4">
              <mutation elseif="1"></mutation>
              <value name="IF0">
                <block type="logic_operation" id="hho[;4g!i3{G)Kb#;tKd" inline="false">
                  <field name="OP">AND</field>
                  <value name="A">
                    <block type="logic_operation" id="d-^$o2]d#~-:f]{`,,(!" inline="false">
                      <field name="OP">AND</field>
                      <value name="A">
                        <block type="logic_compare" id="=(IF[QW3ZgarA9NB1.32">
                          <field name="OP">GT</field>
                          <value name="A">
                            <block type="get_value" id="_({q)pUe!VqR!ASW25Nf">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.FensterStatus.SummeFensterAuf</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="math_number" id=":ZTf#pJ1.QX$|ud)1xae">
                              <field name="NUM">0</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <value name="B">
                        <block type="logic_negate" id="%LY4$mIMW)EQ4Phfc3)i">
                          <value name="BOOL">
                            <block type="logic_operation" id="|JH7YfwyW,%ZB8c4~9**">
                              <field name="OP">OR</field>
                              <value name="A">
                                <block type="logic_compare" id="qOqV_-[ES5d-Fp4`y9FD">
                                  <field name="OP">GTE</field>
                                  <value name="A">
                                    <block type="time_get" id="}S|HnX,nOk}Nyb3f972*">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                      <field name="OPTION">DD.MM.</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="text" id="DHgZGf50`I!F`xXGVZ7h">
                                      <field name="TEXT">01.06.</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_compare" id="?dIhet!Z#Ogldj|KcC?x">
                                  <field name="OP">LTE</field>
                                  <value name="A">
                                    <block type="time_get" id="q@=ZSSAENL]1;.`^o`-#">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                      <field name="OPTION">DD.MM.</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="text" id=";;)7o+!?a?]}21y{*@-E">
                                      <field name="TEXT">31.08.</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </value>
                  <value name="B">
                    <block type="logic_operation" id="c]{(6QM+H{Q/G1yYYv=K" inline="false">
                      <field name="OP">AND</field>
                      <value name="A">
                        <block type="logic_compare" id="e8O7x{Gl|!x(uCxeEe7Y">
                          <field name="OP">LT</field>
                          <value name="A">
                            <block type="get_value" id="(]CyflP|5k:slKy(:hDt">
                              <field name="ATTR">val</field>
                              <field name="OID">mqtt.0.WETTERSENSOR-AUSSEN.Klimasensor-BME280.AUSSENTEMPERATUR</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="math_number" id="z/gjh7IHG?`Eh[DL2JN,">
                              <field name="NUM">17</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <value name="B">
                        <block type="logic_operation" id="|=](Fx-V.,p7o,2HihaT" inline="false">
                          <field name="OP">AND</field>
                          <value name="A">
                            <block type="logic_negate" id="Y?v}mlut-Qd]1}iWmNkk">
                              <value name="BOOL">
                                <block type="variables_get" id=",}b|OtoW{W?F]C^0?0Y8">
                                  <field name="VAR" id="timeout" variabletype="timeout">timeout</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_negate" id="[;;DLdgz#z*]CN|2IVM7">
                              <value name="BOOL">
                                <block type="variables_get" id="*ZoK#8+*:Zr]TPs/(XM;">
                                  <field name="VAR" id="F.#%2wU=LjdgD_8}sN*V">Intervall</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO0">
                <block type="timeouts_settimeout" id="?l,S%#118l~bm:=O4T+/">
                  <field name="NAME">timeout</field>
                  <field name="DELAY">40</field>
                  <field name="UNIT">min</field>
                  <statement name="STATEMENT">
                    <block type="variables_set" id="/v`;gh(~IWAfysrOjWIO">
                      <field name="VAR" id="X[o`:GhQqiB:*.8jyc0H">Liste</field>
                      <value name="VALUE">
                        <block type="lists_split" id="RE!E0lQ_]hIMaj8?1!)z">
                          <mutation mode="SPLIT"></mutation>
                          <field name="MODE">SPLIT</field>
                          <value name="INPUT">
                            <block type="get_value" id="t+.RsfpV{a;g!rM1O+56">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.FensterStatus.TextFensterAuf</field>
                            </block>
                          </value>
                          <value name="DELIM">
                            <shadow type="text" id="2@RGOeGeeAyH$Q%p+w27">
                              <field name="TEXT">,</field>
                            </shadow>
                          </value>
                        </block>
                      </value>
                      <next>
                        <block type="variables_set" id=":.1wW^BY9S-vvV]DyWWx">
                          <field name="VAR" id="WFRN5(M2a?.m*xSqY[K3">bestandteile</field>
                          <value name="VALUE">
                            <block type="lists_split" id="WHwzNheO-wTacqXVr19-">
                              <mutation mode="SPLIT"></mutation>
                              <field name="MODE">SPLIT</field>
                              <value name="INPUT">
                                <block type="lists_getIndex" id="Py}OOGtmM?{m6`60]9rA">
                                  <mutation statement="false" at="true"></mutation>
                                  <field name="MODE">GET</field>
                                  <field name="WHERE">FROM_START</field>
                                  <value name="VALUE">
                                    <block type="variables_get" id="pQCzvGab%ZL,197$EAAy">
                                      <field name="VAR" id="X[o`:GhQqiB:*.8jyc0H">Liste</field>
                                    </block>
                                  </value>
                                  <value name="AT">
                                    <block type="math_number" id="gOSuzR`=8[a]{hVuKTA+">
                                      <field name="NUM">1</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <value name="DELIM">
                                <shadow type="text" id="}!=v,UFa`$.pae,3NzDV">
                                  <field name="TEXT">,</field>
                                </shadow>
                              </value>
                            </block>
                          </value>
                          <next>
                            <block type="timeouts_setinterval" id="-{l]A|XIn8kMT62Ma!f}">
                              <field name="NAME">Intervall</field>
                              <field name="INTERVAL">60</field>
                              <field name="UNIT">sec</field>
                              <statement name="STATEMENT">
                                <block type="control" id="kud~=uJLo}8YUAPr%aip">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">alexa2.0.Echo-Devices.G090L91173840H8G.Commands.speak-volume</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="math_number" id="|XtEp.@Jw18^V3yGlGc,">
                                      <field name="NUM">90</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="control" id="]Z(.CvRGH@psCkfy(KKk">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">alexa2.0.Echo-Devices.G090L91173840H8G.Commands.speak</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="text_join" id="+2fAjOBRK|@{f4GQG3I6">
                                          <mutation items="3"></mutation>
                                          <value name="ADD0">
                                            <block type="text" id=")f$v2-Qw!fYC!%k4i$@q">
                                              <field name="TEXT">Folgende Fenster sind länger als 40 Minuten offen,</field>
                                            </block>
                                          </value>
                                          <value name="ADD1">
                                            <block type="text" id="NHMf=76s`y(O|uK$OLMR">
                                              <field name="TEXT">,</field>
                                            </block>
                                          </value>
                                          <value name="ADD2">
                                            <block type="lists_getIndex" id="!3fc0tVt1kFDJus}`RiZ">
                                              <mutation statement="false" at="true"></mutation>
                                              <field name="MODE">GET</field>
                                              <field name="WHERE">FROM_START</field>
                                              <value name="VALUE">
                                                <block type="variables_get" id="R3vNtIhob{f)G`6cez0A">
                                                  <field name="VAR" id="WFRN5(M2a?.m*xSqY[K3">bestandteile</field>
                                                </block>
                                              </value>
                                              <value name="AT">
                                                <block type="math_number" id=":S@q.;6$2we~l/Czx?s%">
                                                  <field name="NUM">1</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </statement>
                </block>
              </statement>
              <value name="IF1">
                <block type="logic_compare" id="`p83oT[PvqR-~6;cS@:=">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="get_value" id="A5:[TsUdqUG`C8{AHcA@">
                      <field name="ATTR">val</field>
                      <field name="OID">0_userdata.0.FensterStatus.SummeFensterAuf</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="math_number" id="D#4Mo5S#EO;gMV2|u}0c">
                      <field name="NUM">0</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO1">
                <block type="timeouts_clearinterval" id="}[nU#NJ2?{.%C)*`7zUs">
                  <field name="NAME">Intervall</field>
                  <next>
                    <block type="timeouts_cleartimeout" id="Mhf`T5mGZXiIbs7sauA6">
                      <field name="NAME">timeout</field>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </statement>
        </block>
      </xml>
      
      Asgothian paul53 2 Replies Last reply Reply Quote 0
      • Asgothian
        Asgothian Developer @w00dy last edited by Asgothian

        @w00dy sagte in Blockly - Frage bzgl. Datumvergleich/abgleich:

        Hallo.

        In dem Blockly möchte ich das Datum abgleichen und einen Zeitraum bestimmen (01.06 bis 31.08.), in dem keine Aktion ausgeführt wird.

        Bei der Datumsangabe habe ich bereits andere Formate wie "-" "/" "." erfolglos ausprobiert.

        Das Blockly funktioniert ohne den Datumsvergleich einwandfrei.

        Ich komme nicht weiter, wo ist mein Fehler?

        P1.png

        Dein Fehler liegt im Vergleich.

        • Der Vergleich "aktueller Tag als 'TT.MM' < "01.06." wird nur für den 1. jedes Monats wahr. ("02.05" > "01.06" weil 2 > 1)
        • Der Vergleich "aktueller Tag als 'TT.MM' < "31.08" wird nur für die jeweiligen 31. jedes Monats falsch ("30.09" < "31.08." weil 1 > 0)
        • Das "oder" ist falsch. Wenn ich dich richtig verstehe willst du Prüfen ob der aktuelle Monat Jan-Mai oder Sep-Dez ist. Wenn die eigentliche Prüfung Erfolg hätte müsste da stehen ("nicht tag >= 01.06. und tag <= 31.08.")

        Einfacher ist es den Monat im Jahr als Zahl zu holen und auf "Monat < 6 oder Monat > 8" zu prüfen.

        Screenshot 2021-10-26 at 13.40.40.png

        A.

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

          @w00dy sagte: einen Zeitraum bestimmen (01.06 bis 31.08.)

          Bei einem String-Vergleich muss der höherwertige Teil (Monat) vorn stehen.

          Bild_2021-10-26_135453.png

          W 1 Reply Last reply Reply Quote 1
          • W
            w00dy @paul53 last edited by

            @Asgothian
            @paul53

            Mit der und-Verknüpfung sowie Umstellung auf "MM.TT" läufts.

            Super, vielen Dank! 👍

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

            Support us

            ioBroker
            Community Adapters
            Donate

            598
            Online

            32.0k
            Users

            80.5k
            Topics

            1.3m
            Posts

            blockly
            3
            4
            180
            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