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.
    • Aphofis
      Aphofis @paul53 last edited by

      @paul53
      ist es so korrekt?

      var schwimmer, restzeit, Intervall, maxSchwimmer, timeout;
      
      /**
       * Beschreibe diese Funktion …
       */
      function Vliesmotor() {
        if (schwimmer && !maxSchwimmer) {
          if (!Intervall && restzeit > 0) {
            setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
            Intervall = setInterval(function () {
              if (restzeit > 0 && schwimmer) {
                restzeit = (typeof restzeit == 'number' ? restzeit : 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);
        }
      }
      
      
      // Vlies Schwimmer normal
      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();
      // Vlies Schwimmer max
      maxSchwimmer = getState("sonoff.0.Aqua_Float.POWER5").val;
      on({id: 'sonoff.0.Aqua_Float.POWER5', change: "ne"}, function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        maxSchwimmer = (obj.state ? obj.state.val : "");
        if (maxSchwimmer) {
          setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
        }
      });
      
      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @Aphofis last edited by paul53

        @Aphofis sagte:

        ist es so korrekt?

        Nicht ganz: Zeilen 41 und 43 müssen getauscht werden, damit beim Skriptstart die Variable maxSchwimmer den korrekten Wert für die Auswertung in der Funktion Vliesmotor() hat.

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

          @paul53
          Verstehe ich nicht ganz wie meinst du mit tauschen !?

          var schwimmer, maxSchwimmer, restzeit, Intervall, timeout;
          
          /**
           * Beschreibe diese Funktion …
           */
          function Vliesmotor() {
            if (schwimmer && !maxSchwimmer) {
              if (!Intervall && restzeit > 0) {
                setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
                Intervall = setInterval(function () {
                  if (restzeit > 0 && schwimmer) {
                    restzeit = (typeof restzeit == 'number' ? restzeit : 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);
            }
          }
          
          
          // Vlies Schwimmer normal
          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();
          
          // Vlies Schwimmer max
          maxSchwimmer = getState("sonoff.0.Aqua_Float.POWER5").val;
          on({id: 'sonoff.0.Aqua_Float.POWER5', change: "ne"}, function (obj) {
            var value = obj.state.val;
            var oldValue = obj.oldState.val;
            maxSchwimmer = (obj.state ? obj.state.val : "");
            if (maxSchwimmer) {
              setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
            }
          });
          
          Aphofis paul53 2 Replies Last reply Reply Quote 0
          • Aphofis
            Aphofis @Aphofis last edited by

            @paul53
            meinst du so ?

            var schwimmer, restzeit, maxSchwimmer, Intervall, timeout;
            
            /**
             * Beschreibe diese Funktion …
             */
            function Vliesmotor() {
              if (schwimmer && !maxSchwimmer) {
                if (!Intervall && restzeit > 0) {
                  setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
                  Intervall = setInterval(function () {
                    if (restzeit > 0 && schwimmer) {
                      restzeit = (typeof restzeit == 'number' ? restzeit : 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);
              }
            }
            
            
            // Vlies Schwimmer normal
            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();
            });
            maxSchwimmer = getState("sonoff.0.Aqua_Float.POWER5").val;
            
            // Vlies Schwimmer max
            Vliesmotor();
            on({id: 'sonoff.0.Aqua_Float.POWER5', change: "ne"}, function (obj) {
              var value = obj.state.val;
              var oldValue = obj.oldState.val;
              maxSchwimmer = (obj.state ? obj.state.val : "");
              if (maxSchwimmer) {
                setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
              }
            });
            
            paul53 1 Reply Last reply Reply Quote 0
            • paul53
              paul53 @Aphofis last edited by

              @Aphofis sagte:

              Verstehe ich nicht ganz wie meinst du mit tauschen !?

              Packe den Aufruf der Funktion Vliesmotor() wieder ganz nach unten, so dass der Aufruf beim Skriptstart das letzte Kommando ist.

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

                @Aphofis sagte:

                meinst du so ?

                Ja.

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

                  @paul53
                  oder so !?

                  var schwimmer, restzeit, maxSchwimmer, Intervall, timeout;
                  
                  /**
                   * Beschreibe diese Funktion …
                   */
                  function Vliesmotor() {
                    if (schwimmer && !maxSchwimmer) {
                      if (!Intervall && restzeit > 0) {
                        setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, true);
                        Intervall = setInterval(function () {
                          if (restzeit > 0 && schwimmer) {
                            restzeit = (typeof restzeit == 'number' ? restzeit : 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);
                    }
                  }
                  
                  
                  // Vlies Schwimmer normal
                  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();
                  });
                  maxSchwimmer = getState("sonoff.0.Aqua_Float.POWER5").val;
                  // Vlies Schwimmer max
                  on({id: 'sonoff.0.Aqua_Float.POWER5', change: "ne"}, function (obj) {
                    var value = obj.state.val;
                    var oldValue = obj.oldState.val;
                    maxSchwimmer = (obj.state ? obj.state.val : "");
                    if (maxSchwimmer) {
                      setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
                    }
                  });
                  Vliesmotor();
                  
                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @Aphofis last edited by

                    @Aphofis sagte:

                    oder so !?

                    Ist beides gut.

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

                      @paul53
                      ok

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

                        @paul53
                        Dann beobachte ich mal ob es klappt

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

                          @Aphofis
                          Wenn ich die Situation simoliere, sprich erst vlies schwimmer normal in true bringen dann vlies schwimmer max ins true bringe stoppt der motor. also es scheint zu laufen 👍 👍 👍

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

                            @paul53
                            Sag mal die Osmose Steuerung hattest du ja auf false getriggert !?
                            Ist es auch möglich die Steuerung auf true zu triggern!? Da immer noch Osmose zu viel dosiert wird.
                            Es sind am Tag immer so 2-3 Liter.
                            Hat zu folge, das Filter Max Schwimmer ausgelöst wird durch den leicht erhöhten Wasserstand und die Steuerung Filter Niveau Max schaltet dann den Skimmer aus und Die Osmose Steuerung.
                            Kann man das irgendwie besser steuern, das keine Ahnung alle 5 Sek geprüft wird ob false oder true und wirklich nur bei true dosiert wird und bei false nix kommt.
                            Es ist wenn ich zu Hause bin und oder Urlaub habe ja OK aber es soll ja nicht so sein, das ich 2-3 liter am Tag ständig raus holen muss.
                            Wäre Prima wenn du da noch mal drüber gucken kannst.

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

                              @Aphofis sagte:

                              die Osmose Steuerung hattest du ja auf false getriggert !?

                              Nein, auf Änderung von false auf true (change: "gt").

                              @Aphofis sagte in Schwimmer träge machen???:

                              alle 5 Sek geprüft wird ob false oder true und wirklich nur bei true dosiert wird und bei false nix kommt.

                              Wenn das Magnetventil offen ist, wird alle 2 s geprüft, ob der Schwimmer true ist und noch Restzeit vorhanden ist, andernfalls wird das Magnetventil geschlossen und das Intervall beendet. Die Restzeit wird um MItternacht auf 300 s (150 * 2 s) gesetzt.

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

                                @paul53
                                OK Danke

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

                                  @Aphofis sagte in Schwimmer träge machen???:

                                  @paul53
                                  Verstehe nicht wie du das meinst da ist doch ein Timeout und ein Intervall.
                                  Ich meine ist es möglich den Vliesfilter Max Schwimmer mit einzubauen in die steuerung, dann kann die seperate Steuerung weg! Dann habe ich nur noch diese eine die alle zwei sekunden auf true prüft und nicht mehr als 50 cm am Tag laufen darf und der Max schwimmer muss da noch irgendwie mit rein.
                                  Damit falls Sagen wir mal Schwimmer Vliesfilter normal im true zustand verklemmt ist zb durch eine Schencke oder sonst was das wenn der Vlies Filter Max true ist das dann auf jeden fall der Motor so lange gestoppt ist bis beide Schwimmer false sind ob nun durch mein bereinigen oder durch eigenes abfallen auf false.
                                  nur dann gibt es keine Irrtümer. Da die Steuerung Vliesfilter Max völlig am durchdrehen ist, wenn der Vliesfilter Normal steuerung deaktiviert ist. Da der Max Schwimmer 8mm über dem Vliesfilter Normal Schwimmer.

                                  Bildschirmfoto 2019-09-10 um 22.48.56.png

                                  Woher weiß denn die Steuerung, was intervall ist!? bzw sehe ich nirgends was intervall sein soll!?

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

                                    @Aphofis sagte:

                                    sehe ich nirgends was intervall sein soll!?

                                    Die Variable Intervall kommt in der Funktion 3 mal vor:

                                    • falls nicht Intervall und restzeit > 0
                                    • Ausführen Intervall alle 2 Sek (startet das Intervall und setzt die Variable auf einen Wert)
                                    • stop zyklische Ausführung Intervall (stoppt das Intervall und setzt die Variable Intervall auf null)
                                    Aphofis 1 Reply Last reply Reply Quote 1
                                    • Aphofis
                                      Aphofis @paul53 last edited by

                                      @paul53
                                      OK also ist eine verbindung zwischen der Variable und den intervallen vorhanden!?

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

                                        @Aphofis sagte:

                                        also ist eine verbindung zwischen der Variable und den intervallen vorhanden!?

                                        Ja.

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

                                          Dankeschön

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

                                            @paul53
                                            Ich habe Heute anscheinend zu lange die Heizung an gehabt und das Fenster geschlossen und es wurden mehr als 300 sek Osmose dosiert also genau wurden 10,4 Liter Osmose dosiert. Wie geht das !? Wenn die steuerung Osmose dosierung auf 300 sek begrenzt !? Da stimmt doch was nicht !?
                                            es werden ja 2 mal 150 sek zugelassen doch wurde weit aus mehr dosiert als zulässig.?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            567
                                            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