Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Schwimmer träge machen???

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Schwimmer träge machen???

    This topic has been deleted. Only users with topic management privileges can see it.
    • FredF
      FredF Most Active Forum Testing @Aphofis last edited by

      @Aphofis
      Entpreller?
      Das nutze ich für meinen Briefkasten. Mit dem Timeout wird die "Reaktionszeit" eingestellt:
      80735c59-bbc3-4ef6-81a0-41ca97bb5bdf-grafik.png

      paul53 2 Replies Last reply Reply Quote 1
      • paul53
        paul53 @FredF last edited by

        @FredF sagte:

        Entpreller?

        Ja, entprellen sollte helfen.

        Blockly_temp.JPG

        Nicht wundern: Bevor auf die Variable timeout zugegriffen werden kann, muss erst die Verzögerung und eine Dummy-Variable erzeugt werden.

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

          @paul53
          also könnte ich das so realisieren ???

          <xml xmlns="http://www.w3.org/1999/xhtml">
            <variables>
              <variable type="" id="m)7Im6q=OM@`E$B^zJA8">Entpreller</variable>
              <variable type="undefined" id="timeout">timeout</variable>
            </variables>
            <block type="variables_set" id="cZx[D;c!8dg?hRD%Cg?C" x="-1638" y="-862">
              <field name="VAR" id="m)7Im6q=OM@`E$B^zJA8" variabletype="">Entpreller</field>
              <value name="VALUE">
                <block type="math_number" id="IEej!n.DBgjZpSIu?V6l">
                  <field name="NUM">0</field>
                </block>
              </value>
              <next>
                <block type="on" id="NpCJd9st%*${~aYJ98s_">
                  <field name="OID">sonoff.0.Aqua_Float.POWER3</field>
                  <field name="CONDITION">gt</field>
                  <field name="ACK_CONDITION"></field>
                  <statement name="STATEMENT">
                    <block type="controls_if" id="{6HESZ~.#;Tt=Qu7~LSG">
                      <value name="IF0">
                        <block type="logic_operation" id="I@jN(=SGo3[x{rE!}IGF" inline="false">
                          <field name="OP">AND</field>
                          <value name="A">
                            <block type="logic_compare" id="mjT6Z`Ol_zp?c%RdLO:`">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="variables_get" id=")@y(-D~Du-s~Al}sBS3x">
                                  <field name="VAR" id="m)7Im6q=OM@`E$B^zJA8" variabletype="">Entpreller</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="math_number" id="Bg|**1#RYqGr;wlEm;*s">
                                  <field name="NUM">0</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_compare" id="S!Dj!NhgM6U+[TS1?VS$">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id=",D4B1|wSr6}o9K.nAxZR">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="ALsBR.mLXLdrn|9vvlCQ">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO0">
                        <block type="variables_set" id="j9bqc1L@RRUY0N`KI_CP">
                          <field name="VAR" id="m)7Im6q=OM@`E$B^zJA8" variabletype="">Entpreller</field>
                          <value name="VALUE">
                            <block type="math_number" id="I/5qJ9],h_LPd_wcT!3J">
                              <field name="NUM">1</field>
                            </block>
                          </value>
                          <next>
                            <block type="control" id="VnjQxNIYwLDlo[I%P%ir">
                              <mutation delay_input="false"></mutation>
                              <field name="OID">sonoff.0.Aqua_Control.POWER2</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="4B!lWyTt6#V^uhJLbS2V">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                              <next>
                                <block type="timeouts_settimeout" id="ds(P.J-;H|$.}q4@${q7">
                                  <field name="NAME">timeout</field>
                                  <field name="DELAY">2</field>
                                  <field name="UNIT">sec</field>
                                  <statement name="STATEMENT">
                                    <block type="variables_set" id="|4xmLfQou}Qm,nl}:W?@">
                                      <field name="VAR" id="m)7Im6q=OM@`E$B^zJA8" variabletype="">Entpreller</field>
                                      <value name="VALUE">
                                        <block type="math_number" id="VkR;uUUm~0YKAg{R:vOk">
                                          <field name="NUM">0</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="control" id="`-{Ks@NkjVxcq_oMUiWO">
                                          <mutation delay_input="false"></mutation>
                                          <field name="OID">sonoff.0.Aqua_Control.POWER2</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="logic_boolean" id="_]ypttal!yH89J7?)A-e">
                                              <field name="BOOL">FALSE</field>
                                            </block>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                  </statement>
                </block>
              </next>
            </block>
          </xml>
          

          Bildschirmfoto 2019-09-09 um 13.26.55.png

          var Entpreller, timeout;
          
          
          Entpreller = 0;
          on({id: "sonoff.0.Aqua_Float.POWER3"/*Vliesfilter_Normal*/, change: "gt"}, function (obj) {
            var value = obj.state.val;
            var oldValue = obj.oldState.val;
            if (Entpreller == 0 && (obj.state ? obj.state.val : "") == true) {
              Entpreller = 1;
              setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
              timeout = setTimeout(function () {
                Entpreller = 0;
                setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
              }, 2000);
            }
          });
          
          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Aphofis last edited by

            @Aphofis sagte:

            also könnte ich das so realisieren ???

            Soll der Vliesmotor wirklich schon nach 2 s wieder abschalten ?

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

              @paul53
              Naja er soll nur anspringen wenn der Schwimmer definitiv im true zustand ist und dann auch nur so lange bis der schwimmer auf false wechselt. Da durch Einströmendes Wasseer dieser Zustand schwer zu ermitteln ist, wäre so eine entprellung schon gut, damit der Motor nicht immer nur für ein paar millisekunden anspringt und im Enteffekt garnicht gedreht wird.
              Vlies Schwimmer Video
              Wenn die Server Qualität ausreicht ist vielleicht ein Video ganz hilfreich, damit man es sich besser vorstellen kann, was ich mit dem schwankendem Wasser meine. links der große Schwimmer ist für Vliesfilter Max und der kleine in der mitte ist der Schwimmer der den Vliesmotor betätigen soll. Der aber ständig angetippt wird durch das Wasser.

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

                @Aphofis sagte:

                wenn der Schwimmer definitiv im true zustand ist und dann auch nur so lange bis der schwimmer auf false wechselt.

                Dann würde ich erst schalten, wenn der Schwimmerschalter für eine bestimmte Zeit einen konstanten Wert hat, also so:

                Blockly_temp.JPG

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

                  @FredF
                  Wenn auf "ist größer als letztes" getriggert wird, kann die Abfrage "und Wert = wahr" entfallen, denn sie ist bereits in der Triggerbedingung enthalten.

                  Aphofis 1 Reply Last reply Reply Quote 2
                  • Aphofis
                    Aphofis @paul53 last edited by Aphofis

                    @paul53
                    OK ich teste mal

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

                      Das ja mal sehr simpel! aufgebaut

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

                        Wann wird dann der Motor eingeschaltet wenn schwimmer 2 sek. auf true steht und wann wird der Motor wieder abgeschaltet!?

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

                          @Aphofis sagte:

                          wann wird der Motor wieder abgeschaltet!?

                          Wenn der Schwimmer 2 s lang auf false stand.

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

                            @paul53 ok!

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

                              ist es vielleicht möglich diese beiden steuerungen zusammen zu führen ?
                              Damit der motor nur dreht wenn wirklich true ist und auch nicht mehr als 50 cm am Tag

                              var Restzeit, Vliesmotor_Kontrolle, Vliesmotor_Kontrolle;
                              
                              /**
                               * Beschreibe diese Funktion …
                               */
                              function Vliesmotor_Ein() {
                                if (!Vliesmotor_Kontrolle && Restzeit > 0) {
                                  Vliesmotor_Kontrolle = setInterval(function () {
                                    if (Restzeit > 0 && getState("sonoff.0.Aqua_Float.POWER3").val) {
                                      Restzeit = (typeof Restzeit == 'number' ? Restzeit : 0) + -1;
                                    } else {
                                      setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
                                      (function () {if (Vliesmotor_Kontrolle) {clearInterval(Vliesmotor_Kontrolle); Vliesmotor_Kontrolle = null;}})();
                                    }
                                  }, 2000);
                                  setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
                                }
                              }
                              
                              
                              Restzeit = 25;
                              Vliesmotor_Kontrolle = null;
                              
                              on({id: 'sonoff.0.Aqua_Float.POWER3', change: "gt"}, function (obj) {
                                var value = obj.state.val;
                                var oldValue = obj.oldState.val;
                                Vliesmotor_Ein();
                              });
                              schedule("0 0 * * *", function () {
                                Restzeit = 25;
                                if (getState("sonoff.0.Aqua_Float.POWER3").val) {
                                  Vliesmotor_Ein();
                                }
                              });
                              
                              var timeout;
                              
                              
                              on({id: "sonoff.0.Aqua_Float.POWER3"/*Vliesfilter_Normal*/, change: "ne"}, function (obj) {
                                var value = obj.state.val;
                                var oldValue = obj.oldState.val;
                                (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                                timeout = setTimeout(function () {
                                  setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, (obj.state ? obj.state.val : ""));
                                }, 2000);
                              });
                              
                              
                              paul53 1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @Aphofis last edited by paul53

                                @Aphofis sagte:

                                ist es vielleicht möglich diese beiden steuerungen zusammen zu führen ?

                                Ist es.

                                const idSchwimmer = 'sonoff.0.Aqua_Float.POWER3';
                                const idMotor     = 'sonoff.0.Aqua_Control.POWER2';
                                
                                var schwimmer = getState(idSchwimmer).val;
                                var restzeit  = 25;
                                var entprell  = null;
                                var intervall = null;
                                
                                function Vliesmotor() {
                                  if(schwimmer) {
                                    if (!intervall && restzeit > 0) {
                                      setState(idMotor, true);
                                      intervall = setInterval(function () {
                                        if (restzeit > 0 && schwimmer) {
                                          restzeit--;
                                        } else {
                                          setState(idMotor, false);
                                          clearInterval(intervall); 
                                          intervall = null;
                                        }
                                      }, 2000);
                                    }
                                  } else if(getState(idMotor).val) setState(idMotor, false);	
                                }
                                
                                Vliesmotor(); // Skriptstart
                                
                                on(idSchwimmer, function(dp) {
                                  if(entprell) clearTimeout(entprell);
                                  entprell = setTimeout(function() {
                                     schwimmer = dp.state.val;	
                                     Vliesmotor();
                                  }, 2000);
                                });
                                
                                schedule('0 0 * * *', function () {
                                  restzeit = 25;
                                  Vliesmotor();
                                });
                                
                                Aphofis 1 Reply Last reply Reply Quote 1
                                • Aphofis
                                  Aphofis @paul53 last edited by

                                  @paul53
                                  Magst du das in Blockly Blöcken hier rein packen???
                                  Danke

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

                                    @Aphofis

                                    Blockly_Vlies.JPG

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

                                      @paul53
                                      Dankeschön

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

                                        Ist es so korrekt ???

                                        var schwimmer, restzeit, Intervall, timeout, Intervall;
                                        
                                        /**
                                         * Beschreibe diese Funktion …
                                         */
                                        function Vliesmotor() {
                                          if (schwimmer) {
                                            if (!Intervall && restzeit > 0) {
                                              setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
                                              Intervall = setInterval(function () {
                                                if (restzeit > 0 && schwimmer) {
                                                  Intervall = (typeof Intervall == 'number' ? Intervall : 0) - 1;
                                                } else {
                                                  setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
                                                  (function () {if (Intervall) {clearInterval(Intervall); Intervall = null;}})();
                                                }
                                              }, 2000);
                                            }
                                          } else if (getState("sonoff.0.Aqua_Control.POWER2").val) {
                                            setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
                                          }
                                        }
                                        
                                        
                                        schwimmer = getState("sonoff.0.Aqua_Float.POWER3").val;
                                        restzeit = 25;
                                        on({id: 'sonoff.0.Aqua_Float.POWER3', change: "ne"}, function (obj) {
                                          var value = obj.state.val;
                                          var oldValue = obj.oldState.val;
                                          (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                                          timeout = setTimeout(function () {
                                            schwimmer = (obj.state ? obj.state.val : "");
                                            Vliesmotor();
                                          }, 2000);
                                        });
                                        schedule("0 0 * * *", function () {
                                          restzeit = 25;
                                          Vliesmotor();
                                        });
                                        Vliesmotor();
                                        
                                        paul53 1 Reply Last reply Reply Quote 0
                                        • paul53
                                          paul53 @Aphofis last edited by

                                          @Aphofis sagte:

                                          Ist es so korrekt ???

                                          Nicht ganz: Du hast zwei Variablen Intervall und zählst eine davon runter anstelle von restzeit (Zeile 12).

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

                                            @paul53
                                            also so ???Bildschirmfoto 2019-09-10 um 13.05.43.png

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            747
                                            Online

                                            32.0k
                                            Users

                                            80.4k
                                            Topics

                                            1.3m
                                            Posts

                                            3
                                            60
                                            2834
                                            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