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

      Bekomme folgende Fehlermeldung wenn ich das zweite Skript aktiviere:

      javascript.0	2020-06-29 13:41:43.587	error	(31835) at processTicksAndRejections (internal/process/task_queues.js:97:5)
      javascript.0	2020-06-29 13:41:43.587	error	(31835) at runMicrotasks (<anonymous>)
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at /opt/iobroker/node_modules/standard-as-callback/built/index.js:19:49
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at tryCatcher (/opt/iobroker/node_modules/standard-as-callback/built/utils.js:11:23)
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at /opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInRedis.js:608:33
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at /opt/iobroker/node_modules/iobroker.javascript/main.js:1112:17
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at /opt/iobroker/node_modules/iobroker.javascript/main.js:1521:17
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at prepareScript (/opt/iobroker/node_modules/iobroker.javascript/main.js:1468:37)
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at compile (/opt/iobroker/node_modules/iobroker.javascript/main.js:1245:28)
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at Object.createScript (vm.js:263:10)
      javascript.0	2020-06-29 13:41:43.586	error	(31835) at new Script (vm.js:88:7)
      javascript.0	2020-06-29 13:41:43.586	error	(31835) SyntaxError: Unexpected token '{'
      javascript.0	2020-06-29 13:41:43.586	error	(31835) ^
      javascript.0	2020-06-29 13:41:43.586	error	(31835) if(dp.oldState.val >= 500 {
      javascript.0	2020-06-29 13:41:43.585	error	at script.js.common.Poolpumpe_Ueberwachung:8
      javascript.0	2020-06-29 13:41:43.585	error	(31835) script.js.common.Poolpumpe_Ueberwachung compile failed:
      
      1 Reply Last reply Reply Quote 0
      • Dominik F.
        Dominik F. @paul53 last edited by

        @paul53

        Habe die Fehler glaube ich gefunden, so dass im log nix mehr angezeigt wird.
        Wie kann ich nun testen ob alles funktioniert? Ich hab die Werte mal auf 600 gestellt aber es wird nix geschaltet

        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 < 600) {
                if (dp.oldState.val >= 600) {
                    timer = setTimeout(function () {
                        setState(id_Poolpumpe, false);
                    }, 10000);
                }
                else if (timer) clearTimeout(timer);
            }
        });
        
        
        paul53 2 Replies Last reply Reply Quote 0
        • paul53
          paul53 @Dominik F. last edited by paul53

          @Dominik-F sagte:

          Ich hab die Werte mal auf 600 gestellt aber es wird nix geschaltet

          Kann auch nicht, denn der Wert müsste erst über 600 gehen, damit beim Zurückgehen unter 600 abgeschaltet wird.
          Die Pumpe wird abgeschaltet, wenn der Wert den Grenzwert(500) erstmalig unterschreitet und innerhalb von 10 s unterhalb des Grenzwertes bleibt.

          Dominik F. 1 Reply Last reply Reply Quote 0
          • 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

                              713
                              Online

                              31.8k
                              Users

                              80.0k
                              Topics

                              1.3m
                              Posts

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