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

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

                                also so ???

                                Nein: erhöhe restzeit um -1

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

                                  @paul53
                                  Mann o Mann
                                  ja fehler gefunden.
                                  Sag mal würdest du mir vielleicht bei meiner PWM Steuerung mit den Strömungspumpen helfen!?
                                  Ich hatte zwar mal zwischen Pin 1 und 3 am DIN 5 Pol kabel gemessen das an dem Controller hängt wo einer aktive Pumpe gesteuert wird nur gab es da keine Volt anzeige. normal was ich im Netz gefunden habe soll der Tunze Controller über Pin 1 und 3 die 0-8 Volt PWM Steuerung haben. Sprich um die Pumpen ohne den Multi Controller zu steuern.

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

                                    @Aphofis sagte:

                                    die 0-8 Volt PWM Steuerung

                                    Entweder 0-8 V (analog) oder PWM (variables Tastverhältnis) !

                                    @Aphofis sagte:

                                    bei meiner PWM Steuerung mit den Strömungspumpen helfen!?

                                    Ja, wenn Du mir eine verständliche Aufgabenstellung lieferst.

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

                                      @paul53
                                      Es soll per PWM Steuerung laufen. Da Hersteller wie GHL etc die pumpen auch per PWM ansteuerun und im Internet habe ich dazu gefunden das Pin 1 und 3 dazu dienen sollen.
                                      vielleicht unterhalten wir und darüber in dem Thread PWM Steuerung mit Fade

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

                                        @paul53
                                        ein Problem gibt es noch!
                                        Wenn schwimmer vliesfilter_normal und Vliesfilter_Max true sind soll der Motor abgeschaltet sein bis
                                        beide schwimmer wieder false sind. dann soll der motor wieder frei gegeben werden.
                                        Da dadurch dann die Steuerung Vliesfilter Max weg kann. die momentan nicht greift.

                                        on({id: "sonoff.0.Aqua_Float.POWER5"/*Vliesfilter_Max*/, change: "ne"}, function (obj) {
                                          var value = obj.state.val;
                                          var oldValue = obj.oldState.val;
                                          if (getState("sonoff.0.Aqua_Float.POWER5").val == true) {
                                            setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false);
                                            sendTo("telegram.0", "send", {
                                                text: 'Vliesfilter Max erreicht Motor wurde gestoppt'
                                            });
                                            console.log('Vliesfilter Max erreicht Motor wurde gestoppt');
                                          } else if (getState("sonoff.0.Aqua_Float.POWER5").val == false) {
                                            setState("sonoff.0.Aqua_Control.POWER2"/*Vliesmotor*/, false, true);
                                          } else if (getState("Aqua_Control.0.System.Aquarium_ausschalten").val == true) {
                                            setState("javascript.0.scriptEnabled.Technik_Steuerung.Vliesfilter_Niveau_Max"/*scriptEnabled.Technik_Steuerung.Vliesfilter_Niveau_Max*/, false);
                                          } else if (getState("javascript.0.scriptEnabled.Automatik_Steuerung.Aquarium_ausschalten").val == false) {
                                            setStateDelayed("javascript.0.scriptEnabled.Technik_Steuerung.Vliesfilter_Niveau_Max"/*scriptEnabled.Technik_Steuerung.Vliesfilter_Niveau_Max*/, true, 180000, false);
                                          }
                                        });
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • 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
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            836
                                            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