Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Hilfe bei Skript

    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

    Hilfe bei Skript

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

      @paul53

      Okay, das ist genau das was ich möchte. Was muss ich denn einstellen, damit er zu testzwecken abschaltet? oder muss ich dafür die Pumpe einmal kein Wasser ziehen lassen?

      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @Dominik F. last edited by paul53

        @Dominik-F sagte:

        muss ich dafür die Pumpe einmal kein Wasser ziehen lassen?

        Das ist der beste Test, denn zu diesem Zweck soll es dienen.

        Dominik F. 1 Reply Last reply Reply Quote 0
        • Dominik F.
          Dominik F. @paul53 last edited by

          @paul53

          Mir ist gerade aufgefallen, dass die Pumpe immer ausgeschaltet wird obwohl sie Wasser zieht und Power über 500 W war

          1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Dominik F. last edited by

            @Dominik-F sagte:

                    else if (timer) clearTimeout(timer);
                }
            

            Richtig (Zeile 13 und 14 vertauschen):

                }
                else if (timer) clearTimeout(timer);
            
            Dominik F. 2 Replies Last reply Reply Quote 0
            • Dominik F.
              Dominik F. @paul53 last edited by

              @paul53

              alles klar. ich werde es gleich mal testen und dann Rückmeldung geben. Vielen Dank schonmal.

              1 Reply Last reply Reply Quote 0
              • Dominik F.
                Dominik F. @paul53 last edited by Dominik F.

                @paul53

                Das Skript funktioniert soweit. Wenn man nun die Poolpumpe manuell ausschaltet, dann geht ja logischerweise die Leistung auf 0 und das Skript schaltet die Poolpumpe "nochmal" aus und gibt im Log aus, dass die Pumpe überprüft werden soll.
                Ich möchte später noch Pushnachrichten zu dem Skript hinzufügen (Sollte ich eigentlich selber hinbekommen) und das würde dann zur Verwirrung führen wenn ich 3 mal am Tag ne Nachricht bekomme das etwas mit der Pumpe nicht stimmt. Hast du ne Idee wie man das Problem lösen kann?

                Hier die aktuelle Version:

                const logging = true;
                const id_Power_Poolpumpe = 'hm-rpc.0.OEQ0572933.2.POWER'/*Steckdose Poolpumpe Garage Messwert POWER*/;
                const id_Poolpumpe = 'hm-rpc.0.OEQ0572933.1.STATE'/*Steckdose Poolpumpe Garage STATE*/;
                
                var timer = null;
                
                on(id_Power_Poolpumpe, function (dp) {
                    if (dp.state.val < 500) {
                        if (dp.oldState.val >= 500) {
                            timer = setTimeout(function () {
                                setState(id_Poolpumpe, false);
                                if (logging) { log('Poolpumpe ausgeschaltet - Poolpumpe überprüfen') };
                            }, 10000);
                        }
                    }
                    else if (timer) clearTimeout(timer);
                
                });
                
                
                paul53 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @Dominik F. last edited by paul53

                  @Dominik-F sagte in Hilfe bei Skript:

                  Hast du ne Idee wie man das Problem lösen kann?

                  Es wir hoffentlich nicht 3 mal am Tag durch ein Script ausgeschaltet ?

                  const logging = true; 
                  const id_Power_Poolpumpe = 'hm-rpc.0.OEQ0572933.2.POWER'/*Steckdose Poolpumpe Garage Messwert POWER*/;
                  const id_Poolpumpe = 'hm-rpc.0.OEQ0572933.1.STATE'/*Steckdose Poolpumpe Garage STATE*/;
                  
                  var timer = null;
                   
                  on(id_Power_Poolpumpe, function (dp) {
                      if (dp.state.val < 500) {
                          if (dp.oldState.val >= 500) {
                              timer = setTimeout(function () {
                                  setState(id_Poolpumpe, false);
                              }, 10000);
                          }
                      } else if (timer) clearTimeout(timer);
                  });
                  
                  on({id: id_Poolpumpe, change: 'lt', from: 'system.adapter.javascript.0'}, function() { // triggert beim Ausschalten
                      if (logging) log('Poolpumpe ausgeschaltet - Poolpumpe überprüfen');
                  });
                  
                  Dominik F. 1 Reply Last reply Reply Quote 0
                  • Dominik F.
                    Dominik F. @paul53 last edited by

                    @paul53 sagte in Hilfe bei Skript:

                    Es wir hoffentlich nicht 3 mal am Tag durch ein Script ausgeschaltet ?

                    Doch, genau das wird es 😄 Die Pumpe läuft 3 mal pro Tag für 2h

                    paul53 1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 @Dominik F. last edited by paul53

                      @Dominik-F sagte:

                      Doch, genau das wird es

                      Dann anders.

                      const logging = true; 
                      const id_Power_Poolpumpe = 'hm-rpc.0.OEQ0572933.2.POWER'/*Steckdose Poolpumpe Garage Messwert POWER*/;
                      const id_Poolpumpe = 'hm-rpc.0.OEQ0572933.1.STATE'/*Steckdose Poolpumpe Garage STATE*/;
                       
                      var timer = null;
                       
                      on(id_Power_Poolpumpe, function (dp) {
                          if (dp.state.val < 500) {
                              if (dp.oldState.val >= 500) {
                                  timer = setTimeout(function () {
                                      if(getState(id_Poolpumpe).val) {
                                          setState(id_Poolpumpe, false);
                                          if (logging) log('Poolpumpe ausgeschaltet - Poolpumpe überprüfen');
                                      }
                                  }, 10000);
                              }
                          } else if (timer) clearTimeout(timer);
                      });
                      
                      Dominik F. 1 Reply Last reply Reply Quote 0
                      • Dominik F.
                        Dominik F. @paul53 last edited by

                        @paul53

                        Vielen Dank, ich werde es morgen testen

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        921
                        Online

                        31.8k
                        Users

                        80.0k
                        Topics

                        1.3m
                        Posts

                        javascript
                        3
                        21
                        721
                        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