Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Vergleichen und Berechnen - Falls Blockly

    NEWS

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    Vergleichen und Berechnen - Falls Blockly

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

      Hallo,
      ich benötige Unterstützung für ein Teil / Mathe Blockly - "Falls..."
      Ich habe 2 Objekte mit Temperatur Werten.
      Es soll eine Pumpe gesteuert werden wen der Wert von Objekt1 (sonoff.0.creationx), 5 Grad Wärmer, zu Objekt 2 (fritzdect.0.DECT200) gemessen wurde.Ist der Unterschied dann wieder kleiner 5 Grade soll die Pumpe wieder ausgeschaltet werden.
      Für viele von euch sicherlich sehr einfach , aber unter den Mathe Blocklys finde ich leider nichts passendes.
      Kann mir bitte jemand kurz weiterhelfen.

      <xml xmlns="http://www.w3.org/1999/xhtml">
        <block type="controls_if" id="f`]_ZnrJPO+/s2gj8/sr" x="-412" y="-262">
          <mutation elseif="1"></mutation>
          <value name="IF0">
            <block type="get_value" id="ArjRgSLH@Qg`u.X6fgoj">
              <field name="ATTR">val</field>
              <field name="OID">sonoff.0.creationx-1023.DS18B20_Temperature</field>
            </block>
          </value>
          <statement name="DO0">
            <block type="control" id="fn32UPV8!EY@LVl@l441">
              <mutation delay_input="false"></mutation>
              <field name="OID">tuya.0.0320037068c63abb872f.1</field>
              <field name="WITH_DELAY">FALSE</field>
              <value name="VALUE">
                <block type="logic_boolean" id="qANq2i^?87M8iiIJ5)Q!">
                  <field name="BOOL">TRUE</field>
                </block>
              </value>
            </block>
          </statement>
          <statement name="DO1">
            <block type="control" id="gG{^EIio~OS*1nMq(CEu">
              <mutation delay_input="false"></mutation>
              <field name="OID">tuya.0.0320037068c63abb872f.1</field>
              <field name="WITH_DELAY">FALSE</field>
              <value name="VALUE">
                <block type="logic_boolean" id="C_xtJ}B3Z+oFPE:v?=+w">
                  <field name="BOOL">FALSE</field>
                </block>
              </value>
            </block>
          </statement>
        </block>
        <block type="math_number" id="vZqy];;Q1`wB9p]#nx_8" x="137" y="-263">
          <field name="NUM">5</field>
        </block>
        <block type="get_value" id="kF4YOVaPllDcMoQ6CE%V" x="188" y="-263">
          <field name="ATTR">val</field>
          <field name="OID">fritzdect.0.DECT200_087610178347.temp</field>
        </block>
      </xml>
      
      
      1 Reply Last reply Reply Quote 0
      • iomountain
        iomountain last edited by iomountain

        @Mento sagte in Vergleichen und Berechnen - Falls Blockly:

        Versuch mal:
        a68e129f-d3ad-447b-a9bf-bc946129c3c7-image.png

        des Grüne natürlich passend ersetzen
        0f7e38a4-47e7-464c-9b85-ee1121359d4a-image.png

        <xml xmlns="http://www.w3.org/1999/xhtml">
          <block type="on_ext" id="wNNWp~Y_FZe|v#%-dVwx" x="-413" y="-463">
            <mutation items="2"></mutation>
            <field name="CONDITION">ne</field>
            <field name="ACK_CONDITION"></field>
            <value name="OID0">
              <shadow type="field_oid" id="~?t}50$cE*vhNwt/9d{k">
                <field name="oid">default</field>
              </shadow>
              <block type="text" id="`OU;{Ts83:{NIDVe#_vB">
                <field name="TEXT">sonoff Temp sensor</field>
              </block>
            </value>
            <value name="OID1">
              <shadow type="field_oid" id="Hpa0]B73T)Sl=V{evgz2">
                <field name="oid">default</field>
              </shadow>
              <block type="text" id=")N1;gD!Ns!iwMZbQYYv.">
                <field name="TEXT">fritz temp sensor</field>
              </block>
            </value>
            <statement name="STATEMENT">
              <block type="controls_if" id="f`]_ZnrJPO+/s2gj8/sr">
                <mutation elseif="1"></mutation>
                <value name="IF0">
                  <block type="logic_compare" id="uLfZ.8ij68Im%Zp4D[K^">
                    <field name="OP">GT</field>
                    <value name="A">
                      <block type="get_value" id="kF4YOVaPllDcMoQ6CE%V">
                        <field name="ATTR">val</field>
                        <field name="OID">fritzdect.0.DECT200_087610178347.temp</field>
                      </block>
                    </value>
                    <value name="B">
                      <block type="math_arithmetic" id="kO*{.nQyNy]#0AQMs^@E">
                        <field name="OP">ADD</field>
                        <value name="A">
                          <shadow type="math_number" id="S-?[ltaJSwGg=L^bp!Mh">
                            <field name="NUM">1</field>
                          </shadow>
                          <block type="get_value" id="ArjRgSLH@Qg`u.X6fgoj">
                            <field name="ATTR">val</field>
                            <field name="OID">sonoff.0.creationx-1023.DS18B20_Temperature</field>
                          </block>
                        </value>
                        <value name="B">
                          <shadow type="math_number" id="MuGm=)+OJsJ.%A.7J70)">
                            <field name="NUM">1</field>
                          </shadow>
                          <block type="math_number" id="vZqy];;Q1`wB9p]#nx_8">
                            <field name="NUM">5</field>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="control" id="fn32UPV8!EY@LVl@l441">
                    <mutation delay_input="false"></mutation>
                    <field name="OID">tuya.0.0320037068c63abb872f.1</field>
                    <field name="WITH_DELAY">FALSE</field>
                    <value name="VALUE">
                      <block type="logic_boolean" id="qANq2i^?87M8iiIJ5)Q!">
                        <field name="BOOL">TRUE</field>
                      </block>
                    </value>
                  </block>
                </statement>
                <value name="IF1">
                  <block type="logic_compare" id="gJ(-S([ECw`S;(0i=r+M">
                    <field name="OP">LT</field>
                    <value name="A">
                      <block type="get_value" id=":;OaqB@6DgEvHKMx[Z/=">
                        <field name="ATTR">val</field>
                        <field name="OID">fritzdect.0.DECT200_087610178347.temp</field>
                      </block>
                    </value>
                    <value name="B">
                      <block type="math_arithmetic" id="!,vG%j$6J{Ikzg:x~x?U">
                        <field name="OP">ADD</field>
                        <value name="A">
                          <shadow type="math_number" id="S-?[ltaJSwGg=L^bp!Mh">
                            <field name="NUM">1</field>
                          </shadow>
                          <block type="get_value" id="C-xfh:R`9N#Rsvj7?gaz">
                            <field name="ATTR">val</field>
                            <field name="OID">sonoff.0.creationx-1023.DS18B20_Temperature</field>
                          </block>
                        </value>
                        <value name="B">
                          <shadow type="math_number" id="MuGm=)+OJsJ.%A.7J70)">
                            <field name="NUM">1</field>
                          </shadow>
                          <block type="math_number" id="B5/nTLNzT9]2HGKj)k=M">
                            <field name="NUM">5</field>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO1">
                  <block type="control" id="gG{^EIio~OS*1nMq(CEu">
                    <mutation delay_input="false"></mutation>
                    <field name="OID">tuya.0.0320037068c63abb872f.1</field>
                    <field name="WITH_DELAY">FALSE</field>
                    <value name="VALUE">
                      <block type="logic_boolean" id="C_xtJ}B3Z+oFPE:v?=+w">
                        <field name="BOOL">FALSE</field>
                      </block>
                    </value>
                  </block>
                </statement>
              </block>
            </statement>
          </block>
        </xml>
        
        M 1 Reply Last reply Reply Quote 0
        • M
          Mento @iomountain last edited by

          @iomountain Danke ich habe es mal so angepasst.

          Habe erst mal eine Test Objekt zum Schalten genommen und logge es per Historie. Mal sehen wie es sich verhält. muss mal ein paar Daten Sammeln.
          Blocky sieht so aus:

          <xml xmlns="http://www.w3.org/1999/xhtml">
            <block type="on_ext" id="wNNWp~Y_FZe|v#%-dVwx" x="-413" y="-287">
              <mutation items="2"></mutation>
              <field name="CONDITION">ne</field>
              <field name="ACK_CONDITION"></field>
              <value name="OID0">
                <shadow type="field_oid" id="~?t}50$cE*vhNwt/9d{k">
                  <field name="oid">sonoff.0.creationx-1023.DS18B20_Temperature</field>
                </shadow>
              </value>
              <value name="OID1">
                <shadow type="field_oid" id="Hpa0]B73T)Sl=V{evgz2">
                  <field name="oid">fritzdect.0.DECT200_087610178347.temp</field>
                </shadow>
              </value>
              <statement name="STATEMENT">
                <block type="controls_if" id="_iCR_}a.Vspq-@AqD~9^">
                  <mutation elseif="1"></mutation>
                  <value name="IF0">
                    <block type="logic_compare" id="uLfZ.8ij68Im%Zp4D[K^">
                      <field name="OP">GT</field>
                      <value name="A">
                        <block type="get_value" id="0MF^84cfN$rvZt-sMm7V">
                          <field name="ATTR">val</field>
                          <field name="OID">fritzdect.0.DECT200_087610178347.temp</field>
                        </block>
                      </value>
                      <value name="B">
                        <block type="math_arithmetic" id="kO*{.nQyNy]#0AQMs^@E">
                          <field name="OP">ADD</field>
                          <value name="A">
                            <shadow type="math_number" id="S-?[ltaJSwGg=L^bp!Mh">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="get_value" id="fUzf0{W!S.r?tCW2os-8">
                              <field name="ATTR">val</field>
                              <field name="OID">sonoff.0.creationx-1023.DS18B20_Temperature</field>
                            </block>
                          </value>
                          <value name="B">
                            <shadow type="math_number" id="MuGm=)+OJsJ.%A.7J70)">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="math_number" id="u9EWK?-EMe(imqdeoX54">
                              <field name="NUM">5</field>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </value>
                  <statement name="DO0">
                    <block type="control" id="/-2XhHkBmKey*R%[!n?d">
                      <mutation delay_input="false"></mutation>
                      <field name="OID">kamera.0.Pool_Trigger</field>
                      <field name="WITH_DELAY">FALSE</field>
                      <value name="VALUE">
                        <block type="logic_boolean" id="q7t)HORVod)v9]3W}jo2">
                          <field name="BOOL">TRUE</field>
                        </block>
                      </value>
                    </block>
                  </statement>
                  <value name="IF1">
                    <block type="logic_compare" id="gJ(-S([ECw`S;(0i=r+M">
                      <field name="OP">LT</field>
                      <value name="A">
                        <block type="get_value" id=":;OaqB@6DgEvHKMx[Z/=">
                          <field name="ATTR">val</field>
                          <field name="OID">fritzdect.0.DECT200_087610178347.temp</field>
                        </block>
                      </value>
                      <value name="B">
                        <block type="math_arithmetic" id="!,vG%j$6J{Ikzg:x~x?U">
                          <field name="OP">ADD</field>
                          <value name="A">
                            <shadow type="math_number" id="S-?[ltaJSwGg=L^bp!Mh">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="get_value" id="C-xfh:R`9N#Rsvj7?gaz">
                              <field name="ATTR">val</field>
                              <field name="OID">sonoff.0.creationx-1023.DS18B20_Temperature</field>
                            </block>
                          </value>
                          <value name="B">
                            <shadow type="math_number" id="MuGm=)+OJsJ.%A.7J70)">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="math_number" id="B5/nTLNzT9]2HGKj)k=M">
                              <field name="NUM">5</field>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </value>
                  <statement name="DO1">
                    <block type="control" id="-n]~.72(WFCl(||}MlRa">
                      <mutation delay_input="false"></mutation>
                      <field name="OID">kamera.0.Pool_Trigger</field>
                      <field name="WITH_DELAY">FALSE</field>
                      <value name="VALUE">
                        <block type="logic_boolean" id="Zj5F[{eEWHKo]Qm/qo-)">
                          <field name="BOOL">FALSE</field>
                        </block>
                      </value>
                    </block>
                  </statement>
                </block>
              </statement>
            </block>
          </xml>
          
          

          Hier versuche ich nun heraus zu finden wann ich schalten sollte und ob ich dann auch den Pool Schalte.
          2019-06-29 13_49_10-vis.png

          1 Reply Last reply Reply Quote 0
          • iomountain
            iomountain last edited by

            @Mento sagte in Vergleichen und Berechnen - Falls Blockly:
            Mit dem "debug output" Baustein kannst du auch schön ins Logfile loggen:
            z.B.:
            9c1c871e-f846-413c-93ce-d38b923e8438-image.png

            Den steuere Pool_Trigger könntest du noch mit falls abfragen wie er gerade steht und nur bei Bedarf schalten. Minimiert die Schaltvorgänge.

            Pool heizen? Abhängig von Tageszeit, Außentemperatur und Anwesenheit usw. viel Spass.

            M 1 Reply Last reply Reply Quote 1
            • M
              Mento @iomountain last edited by

              @iomountain
              auch eine gute Idee,
              mal sehen ob und wie ich es verwerten umsetzten kann. Muss nun erst einmal herausfinden ob ich den Wert Unterschied tatsächlich nehmen kann.
              Also ob sich aus den Werten eine klare Regel erkennbar / ableiten lässt.

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

              Support us

              ioBroker
              Community Adapters
              Donate

              628
              Online

              32.1k
              Users

              80.6k
              Topics

              1.3m
              Posts

              2
              5
              426
              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