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 last edited by Aphofis

      Das Vlies läuft trotz der steuerung weiter irgendwas stimmt noch nicht.

      var schwimmer, restzeit, timeout, Intervall, 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) {
                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);
        }
      }
      
      
      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();
      

      Aktuelle Steuerung
      Vielleicht kann man ja einbauen das der Vliesmotor nicht länger als 5 sek laufen darf und prüft dann erneut da der motor nie weiter gedreht hatte als 2-3 cm wo der motor noch direkt mit einem Schwimmer geschaltet wurde also ohne steuerung. Hatte den Nachteil das der Vliesmotor bei Futter Pause also steigendem Wasserstand gelaufen ist bis der Vliesfilter Max Schwimmer den Motor gestoppt hatte.

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

        @Aphofis sagte:

        irgendwas stimmt noch nicht.

        Du hast zwei Variablen Intervall. Wähle mal bei falls nicht Intervall die andere mit dem gleichen Bezeichner aus. Im Javascript-Code darf oben nur einmal Intervall auftauchen.

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

          @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

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

            falsche Abteilung

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

              @paul53
              ist es möglich den Vliesmotor 1-2 sek später zu schalten !? da das Vlies noch zu sauber ist.?

              var schwimmer, restzeit, timeout, Intervall, 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) {
                        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);
                }
              }
              
              
              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:

                Vliesmotor 1-2 sek später zu schalten !? da das Vlies noch zu sauber ist.?

                ?? Es schaltet schon 2 s verzögert, oder meinst Du um Mitternacht ?

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

                  @paul53
                  ja das weiß ich nur ist das vlies noch zu sauber also muss der motor noch später schalten oder früher abschalten.
                  Den Bypass habe ich schon komplett offen da geht nichts mehr. ich kann höchstens den Überlauf weiter hoch setzten nur dann ist die Distanz zwischen dem normalen schwimmer und dem Vlies Schwimmer Max zu niedrig.
                  Der Vlies Max Schwimmer ist leider auch noch nicht mit eingebunden.
                  warum der Vliesverbrauch 180 cm am Tag zählt weiss ich auch nicht.
                  normal braucht der Motor für 1 cm 990 ms und die Verbrauchssteuerung rechnet 1ms => 0,0010101 cm x gelaufene zeit in ms. und errechnet daraus den Tages und den Gesamtverbrauch.
                  Doch sollte laut der Steuerung für den Motor nach 50 cm Schluß sein.

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

                    @Aphofis sagte:

                    Der Vlies Max Schwimmer ist leider auch noch nicht mit eingebunden.

                    Was soll er bewirken (Aufgabenstellung) ?

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

                      @paul53
                      Vlies Max soll einfach verhindern, das dass Vlies immer weiter dreht im falle das die normale Steuerung versagt oder der normal schwimmer in true verklemmt ist dann soll der vlies max schwimmer den motor so lange stoppen bis beide schwimmer false sind

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

                        @Aphofis
                        Dann setze einen weiteren Trigger und ergänze die Abfrage in der Funktion:

                        Blockly_temp.JPG

                        Aphofis 1 Reply Last reply Reply Quote 1
                        • 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
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            783
                                            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