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

      @Aphofis
      Was ist der Unterschied zwischen "cm_pro_Tag" und "cm_pro_Tag_count" ? Ich kann keinen Unterschied erkennen.
      Für Telegram und Log verwende die Variablen cm_Aktuell, cm_komulativ und cm_pro_Tag, denn das Einlesen der Datenpunkte liefert einen veralteten Wert vom vorherigen Trigger.

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

        @paul53
        count war eigntl gedacht um zu zählen wie oft bzw wie lange osmose oder der vlies filter am tag läuft also wie lange auf true stand und wie oft true an war.
        dH. ich muss count raus nehmen !?
        Die werte kommen doch aus den Datenpunkten doch wenn ich die beiden scripte stoppe dann die Daten in den Datenpunkten so einstelle wie es gehört und die Scripte wieder starte schmeissen beide die Daten raus bei max und bei tages verbrauch.

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

          Vliesverbrauch sieht dann so aus:

          var cm_pro_Tag, cm_komulativ, Differenz, cm_Aktuell;
          
          
          cm_pro_Tag = getState("Aqua_Control.0.Vliesfilter.cm_pro_Tag").val;
          cm_komulativ = getState("Aqua_Control.0.Vliesfilter.cm_Max").val;
          on({id: 'rpi2.0.gpio.20.state', change: "ne"}, function (obj) {
            var value = obj.state.val;
            var oldValue = obj.oldState.val;
            if (!(obj.state ? obj.state.val : "")) {
              Differenz = (obj.state ? obj.state.lc : "") - (obj.oldState ? obj.oldState.lc : "");
              cm_Aktuell = Differenz * getState("Aqua_Control.0.Vliesfilter.cm_multiplikator").val;
              setState("Aqua_Control.0.Vliesfilter.cm_Aktuell"/*cm_Aktuell*/, Math.round(cm_Aktuell*100)/100, true);
              cm_komulativ = (typeof cm_komulativ == 'number' ? cm_komulativ : 0) + cm_Aktuell;
              cm_pro_Tag = (typeof cm_pro_Tag == 'number' ? cm_pro_Tag : 0) + cm_Aktuell;
              setState("Aqua_Control.0.Vliesfilter.cm_Max"/*cm_Max*/, Math.round(cm_komulativ*100)/100, true);
              setState("Aqua_Control.0.Vliesfilter.cm_pro_Tag"/*cm_pro_Tag*/, (Math.round(cm_pro_Tag)), true);
              sendTo("telegram.0", "send", {
                  text: (['Vliesverbrauch Aktuell ',Math.round(getState("Aqua_Control.0.Vliesfilter.cm_Aktuell").val*100)/100,' cm','\n','Vlies Tagesverbrauch ',Math.round(getState("Aqua_Control.0.Vliesfilter.cm_pro_Tag").val*100)/100,' cm','\n','Vliesverbrauch gesamt ',Math.round((getState("Aqua_Control.0.Vliesfilter.cm_Max").val / 100)*100)/100,' Meter'].join(''))
              });
              console.log((['Vliesverbrauch Aktuell ',Math.round(getState("Aqua_Control.0.Vliesfilter.cm_Aktuell").val*100)/100,' cm'].join('')));
              console.log((['Vliesverbrauch Gesamt ',Math.round((getState("Aqua_Control.0.Vliesfilter.cm_Max").val / 100)*100)/100,'  cm'].join('')));
            }
          });
          schedule("0 0 * * *", function () {
            cm_pro_Tag = 0;
            setState("Aqua_Control.0.Vliesfilter.cm_pro_Tag"/*cm_pro_Tag*/, 0, true);
          });
          

          Osmose Verbrauch:

          var ml_pro_Tag, ml_Kumulativ, Differenz, ml_Aktuell;
          
          
          ml_pro_Tag = getState("Aqua_Control.0.Osmose_System.ml_pro_Tag").val;
          ml_Kumulativ = getState("Aqua_Control.0.Osmose_System.Osmose_Max").val;
          // Magnetventil
          on({id: 'rpi2.0.gpio.21.state', change: "ne"}, function (obj) {
            var value = obj.state.val;
            var oldValue = obj.oldState.val;
            if (!(obj.state ? obj.state.val : "")) {
              Differenz = (obj.state ? obj.state.lc : "") - (obj.oldState ? obj.oldState.lc : "");
              ml_Aktuell = Differenz * getState("Aqua_Control.0.Osmose_System.ml_multiplikator").val;
              setState("Aqua_Control.0.Osmose_System.Osmose_Aktuell"/*Osmose_Aktuell*/, Math.round(ml_Aktuell*100)/100, true);
              ml_Kumulativ = (typeof ml_Kumulativ == 'number' ? ml_Kumulativ : 0) + ml_Aktuell;
              ml_pro_Tag = (typeof ml_pro_Tag == 'number' ? ml_pro_Tag : 0) + ml_Aktuell;
              setState("Aqua_Control.0.Osmose_System.Osmose_Max"/*Osmose_Max*/, Math.round(ml_Kumulativ*100)/100, true);
              setState("Aqua_Control.0.Osmose_System.Osmose_Gesamtverbrauch"/*Osmose_Gesamtverbrauch*/, Math.round((ml_Kumulativ / 1000)*1000)/1000, true);
              setState("Aqua_Control.0.Osmose_System.ml_pro_Tag"/*ml_pro_Tag*/, (Math.round(ml_pro_Tag)), true);
              console.log((['Dosierung aktuell ',Math.round(ml_Aktuell),' ml'].join('')));
              console.log((['Dosierung Gesamt ',Math.round((ml_Kumulativ / parseFloat(1000))*1000)/1000,' Liter'].join('')));
              sendTo("telegram.0", "send", {
                  text: (['Osmose Dosierung aktuell ',Math.round(getState("Aqua_Control.0.Osmose_System.Osmose_Aktuell").val),' ml','\n','Osmose Tages Dosierung ',Math.round((getState("Aqua_Control.0.Osmose_System.ml_pro_Tag").val / 1000)*100)/100,' Liter','\n','Osmose Gesamtverbrauch ',Math.round(getState("Aqua_Control.0.Osmose_System.Osmose_Gesamtverbrauch").val),' Liter'].join(''))
              });
            }
          });
          schedule("0 0 * * *", function () {
            ml_pro_Tag = 0;
            setState("Aqua_Control.0.Osmose_System.ml_pro_Tag"/*ml_pro_Tag*/, 0, true);
          });
          

          wäre es dann so korrekt und die steuerungen nehmen beim starten die werte aus den datenpunkten ?

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

            Ich habe jetzt ml_pr_Tag_count und cm_pro_Tag_count raus geschmissen aus den steuerungen und zum testen nicht das magnet ventil oder den vlies motor manuell betätigt sondern die beiden schwimmer und siehe da, es funktioniert wieder.
            Was ich nur nicht verstehe wieso ging es die ganze Zeit und jetzt nicht mehr.
            Kann es mit den neu angelegten und neu verknüpften Datenpunkten zu tun haben !?
            Hatte ja vorher alle scripte gestoppt und dann die datenpunkt änderungen vorgenommen.
            Da ja noch reichlich Steuerungen dazu kommen musste ich aufräumen.
            Sonst wird es nachher ein unübersichtlicher Haufen Datenpunkte.
            Dazu kommen noch zwei TDS ppm Meter dann eine Leitwert Sonde, eine PH Sonde und wenns klappt die Steuerung Zeitgesteuert zu dem Tunze Controller senden.

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

              @Aphofis

              Wandle am Besten den Wert vom Multiplikator nach Zahl, weil auch ein String in den Datenpunkt gelangen kann. Also:

              setze Aktuell auf Differenz * nach Zahl Wert vom Multiplikator

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

                @paul53
                Meinst du so:

                Bildschirmfoto 2019-08-16 um 22.00.06.png
                Bildschirmfoto 2019-08-16 um 22.00.51.png

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

                  @Aphofis sagte:

                  Meinst du so:

                  Ja.

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

                    OK, dann hoffe ich, das jetzt alles reibungslos läuft.

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

                      Bis jetzt scheinen beide Steuerungen endlich wieder das zu tun was sie sollen.
                      Sie zählen fleißig. 😊

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

                        Bis auf Osmose Verbrauch, die Verbrauchssteuerung haut manchmal komische werte rein.
                        Es werden normal immer so 50-300 ml dosiert am stück und manchmal steht dann in der aktuellen dosierung 4000ml aufwärts aber auch nur zwischendurch.
                        Woran kann das liegen !?

                        var ml_pro_Tag, ml_Kumulativ, Differenz, ml_Aktuell;
                        
                        
                        ml_pro_Tag = getState("Aqua_Control.0.Osmose_System.ml_pro_Tag").val;
                        ml_Kumulativ = getState("Aqua_Control.0.Osmose_System.Osmose_Max").val;
                        // Magnetventil
                        on({id: 'rpi2.0.gpio.21.state', change: "ne"}, function (obj) {
                          var value = obj.state.val;
                          var oldValue = obj.oldState.val;
                          if (!(obj.state ? obj.state.val : "")) {
                            Differenz = (obj.state ? obj.state.lc : "") - (obj.oldState ? obj.oldState.lc : "");
                            ml_Aktuell = Differenz * parseFloat(getState("Aqua_Control.0.Osmose_System.ml_multiplikator").val);
                            setState("Aqua_Control.0.Osmose_System.Osmose_Aktuell"/*Osmose_Aktuell*/, Math.round(ml_Aktuell*100)/100, true);
                            ml_Kumulativ = (typeof ml_Kumulativ == 'number' ? ml_Kumulativ : 0) + ml_Aktuell;
                            ml_pro_Tag = (typeof ml_pro_Tag == 'number' ? ml_pro_Tag : 0) + ml_Aktuell;
                            setState("Aqua_Control.0.Osmose_System.Osmose_Max"/*Osmose_Max*/, Math.round(ml_Kumulativ*100)/100, true);
                            setState("Aqua_Control.0.Osmose_System.Osmose_Gesamtverbrauch"/*Osmose_Gesamtverbrauch*/, Math.round((ml_Kumulativ / 1000)*1000)/1000, true);
                            setState("Aqua_Control.0.Osmose_System.ml_pro_Tag"/*ml_pro_Tag*/, (Math.round(ml_pro_Tag)), true);
                            console.log((['Dosierung aktuell ',Math.round(ml_Aktuell),' ml'].join('')));
                            console.log((['Dosierung Gesamt ',Math.round((ml_Kumulativ / parseFloat(1000))*1000)/1000,' Liter'].join('')));
                            sendTo("telegram.0", "send", {
                                text: (['Osmose Dosierung aktuell ',Math.round(getState("Aqua_Control.0.Osmose_System.Osmose_Aktuell").val),' ml','\n','Osmose Tages Dosierung ',Math.round((getState("Aqua_Control.0.Osmose_System.ml_pro_Tag").val / 1000)*100)/100,' Liter','\n','Osmose Gesamtverbrauch ',Math.round(getState("Aqua_Control.0.Osmose_System.Osmose_Gesamtverbrauch").val),' Liter'].join(''))
                            });
                          }
                        });
                        schedule("0 0 * * *", function () {
                          ml_pro_Tag = 0;
                          setState("Aqua_Control.0.Osmose_System.ml_pro_Tag"/*ml_pro_Tag*/, 0, true);
                        });
                        
                        paul53 1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @Aphofis last edited by

                          @Aphofis sagte:

                          Woran kann das liegen !?

                          Nicht am Skript, denn im Skript passieren keine zufälligen Sachen.
                          Hast Du den Datenpunkt 'rpi2.0.gpio.21.state' historisiert ? Falls nicht, solltest Du es machen.

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

                            @paul53
                            ja wird in der Datenbank geloggt, nur Flot Adapter funktioniert immer noch nicht.
                            Wie gesagt, wenn ich die Geräte über einen ESP laufen lasse denke ich werden auch keine komischen werte mehr zustande kommen. ich denke das passiert wenn der Pi neu startet. spinnt die Relais Karte und alle Relais leuchten obwohl standard sind alle relais auf low getriggert und sind somit beim start eigntl false.

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

                              So sieht dann momentan die Zählung aus,
                              Wenn normal Osmose dosiert wird!

                              3F8ADEF3-0D9A-4144-9E09-BB4B6A1DBBC4.jpeg

                              Seid dem Umbau auf ESP8266 läuft alles perfekt

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

                                @paul53
                                Ich hatte das Script ja umgemodelt auch auf meine Triton Lösungszählung.
                                Dazu wollte ich einen Zähler mit einem Datenpunkt nutzen der jeden Tag um 23:59 den ml_pro_Tag datenpunkt vom Verbrauch von dem Füllstand abzieht. Damit ich zb bei Rest 500 ml eine Meldung rausgeben kann das ich neue Triton Lösungen kaufen muss. Bzw damit ich weiss wie viel Lösung noch übrig ist.
                                Wäre das so korrekt?

                                var Triton_L_C3_B6sung_1_F_C3_BCllstand, Abzug;
                                
                                
                                Triton_L_C3_B6sung_1_F_C3_BCllstand = getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand").val;
                                schedule("59 23 * * *", function () {
                                  Abzug = Triton_L_C3_B6sung_1_F_C3_BCllstand - getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_pro_Tag").val;
                                  setState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand"/*Triton_Lösung_1_Füllstand*/, Abzug, true);
                                });
                                
                                paul53 1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 @Aphofis last edited by

                                  @Aphofis sagte:

                                  Wäre das so korrekt?

                                  Nein, Zeile 4 muss als erstes innerhalb des Schedule ausgeführt werden, da der Wert sonst nur einmal bei Skriptstart ermittelt wird.

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

                                    @paul53
                                    also so?

                                    var Triton_L_C3_B6sung_1_F_C3_BCllstand, Abzug;
                                    
                                    
                                    Triton_L_C3_B6sung_1_F_C3_BCllstand = getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand").val;
                                    schedule("59 23 * * *", function () {
                                      setState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand"/*Triton_Lösung_1_Füllstand*/, Abzug, true);
                                      Abzug = Triton_L_C3_B6sung_1_F_C3_BCllstand - getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_pro_Tag").val;
                                    });
                                    
                                    paul53 1 Reply Last reply Reply Quote 0
                                    • paul53
                                      paul53 @Aphofis last edited by

                                      @Aphofis sagte:

                                      also so?

                                      Nein, so:

                                      var Triton_L_C3_B6sung_1_F_C3_BCllstand, Abzug;
                                       
                                       
                                      schedule("59 23 * * *", function () {
                                        Triton_L_C3_B6sung_1_F_C3_BCllstand = getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand").val;
                                        Abzug = Triton_L_C3_B6sung_1_F_C3_BCllstand - getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_pro_Tag").val;
                                        setState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand"/*Triton_Lösung_1_Füllstand*/, Abzug, true);
                                      });
                                      
                                      Aphofis 1 Reply Last reply Reply Quote 0
                                      • Aphofis
                                        Aphofis @paul53 last edited by Aphofis

                                        @paul53
                                        OK hab ich !

                                        var Triton_L_C3_B6sung_2_F_C3_BCllstand, Abzug;
                                        
                                        
                                        schedule("59 23 * * *", function () {
                                          Triton_L_C3_B6sung_2_F_C3_BCllstand = getState("Aqua_Control.0.Triton.Lösung_2.Verbrauch.Triton_Lösung_2_Füllstand").val;
                                          Abzug = Triton_L_C3_B6sung_2_F_C3_BCllstand - getState("Aqua_Control.0.Triton.Lösung_2.Verbrauch.Triton_Lösung_2_Füllstand").val;
                                          setState("Aqua_Control.0.Triton.Lösung_2.Verbrauch.Triton_Lösung_2_Füllstand"/*Triton_Lösung_2_Füllstand*/, Abzug, true);
                                        });
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • Aphofis
                                          Aphofis last edited by

                                          @paul53
                                          Ich hatte das so erstellt, nur leider wird so nix von dem Füllstand Datenpunkt (5000ml) abgezogen.

                                          var Triton_L_C3_B6sung_1_F_C3_BCllstand, Abzug;
                                          
                                          
                                          schedule("59 23 * * *", function () {
                                            Triton_L_C3_B6sung_1_F_C3_BCllstand = getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand").val;
                                            Abzug = Triton_L_C3_B6sung_1_F_C3_BCllstand - getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_pro_Tag").val;
                                            setState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand"/*Triton_Lösung_1_Füllstand*/, Abzug, true);
                                          });
                                          

                                          vorher war es so:

                                          var Triton_L_C3_B6sung_1_F_C3_BCllstand, Abzug;
                                          
                                          
                                          Triton_L_C3_B6sung_1_F_C3_BCllstand = getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand").val;
                                          schedule("59 23 * * *", function () {
                                            Abzug = Triton_L_C3_B6sung_1_F_C3_BCllstand - getState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_pro_Tag").val;
                                            setState("Aqua_Control.0.Triton.Lösung_1.Verbrauch.Triton_Lösung_1_Füllstand"/*Triton_Lösung_1_Füllstand*/, Abzug, true);
                                          });
                                          

                                          Da wurde vom Füllstand Datenpunkt abgezogen. vllt sollte ich nicht ml_pro_Tag abziehen sindern jedes mal nur ml_Aktuell dann ist es vllt einfacher ohne die Zeit Steuerung um 23:59

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

                                            @Aphofis sagte:

                                            leider wird so nix von dem Füllstand Datenpunkt (5000ml) abgezogen.

                                            Der Abzug des Tagesverbrauchs erfolgt täglich um 23:59 Uhr.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            477
                                            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