Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] Osmose Wasser Aktuell & Max Verbrauch

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Osmose Wasser Aktuell & Max Verbrauch

    This topic has been deleted. Only users with topic management privileges can see it.
    • paul53
      paul53 @Aphofis last edited by paul53

      @Aphofis sagte:

      Normal erstelle ich eine Variable nur einmal

      Timer-Variablen dürfen gar nicht manuell erstellt werden ! Problem ist, dass sie erst sichtbar sind, wenn man eine andere Variable in das Fenster zieht und danach die Timer-Variable selektiert. Der Timer muss ebenfalls schon im Editorfenster vorhanden sein. Issue auf Github existiert bereits.

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

        @paul53
        Verstehe ich nicht wie du das meinst

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

          @Aphofis
          Wenn ein Timer erstellt wurde, sieht man die Variable timeout nicht.
          Blockly_temp.JPG
          Erst wenn man eine andere Variable (dummy) erstellt hat, kann man z.B. setze dummy auf in das Fenster ziehen und anschließend timeout selektieren.
          Blockly_temp2.JPG
          Das Problem: Da man die Variable timeout zum in das Fenster ziehen nicht zur Auswahl hat, ist man geneigt, eine weitere Variable timeout zu erstellen.
          Blockly_temp.JPG

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

            @paul53
            Cool Danke für die ausführliche Erklärung! Ich werde in Zukunft aufpassen

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

              @paul53
              Also mit der steuerung beim Vlies stimmt was nicht es soll ja nicht mehr als 50 cm laufen laut Zähler sollen heute 180 cm gelaufen sein.
              Wie kann das sein!?

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

                @Aphofis sagte:

                mit der steuerung beim Vlies stimmt was nicht es soll ja nicht mehr als 50 cm laufen laut Zähler sollen heute 180 cm gelaufen sein.

                Im Skript ist keine Begrenzung vorgesehen, sondern nur eine Erfassung. Der Faktor Zeit --> cm stimmt ?

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

                  @paul53
                  2x25 ist doch die begrenzung oder 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();
                  
                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @Aphofis last edited by paul53

                    Dieses Skript meinst Du.

                    @Aphofis sagte:

                    2x25 ist doch die begrenzung oder nicht !?

                    Ja, wären nicht zwei Variablen Intervall vorhanden (s.o.), würde es sicherlich auch funktionieren.

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

                      @paul53
                      Das kann doch nicht wahr sein!
                      Ich sollte öffters mal ins Javascript rein gucken.
                      also ohne worte

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

                        @paul53
                        So sollte es korrekt sein!!!

                        var schwimmer, restzeit, 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) {
                                  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();
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        778
                        Online

                        31.9k
                        Users

                        80.3k
                        Topics

                        1.3m
                        Posts

                        2
                        79
                        2925
                        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