Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst]Dimmen mit "Long Press"

    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]Dimmen mit "Long Press"

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

      @coyote sagte:

      nein leider nicht.

      Also sind die HM-Dimmer immer an und werden nur durch den LEVEL gesteuert ? Dann lasse alles mit Bezug auf idSwitch und der Variablen state weg.

      coyote 2 Replies Last reply Reply Quote 0
      • coyote
        coyote Most Active @paul53 last edited by

        @paul53 genau, werden nur über level gesteuert. Ok, werde ich testen. Danke dir.

        1 Reply Last reply Reply Quote 0
        • coyote
          coyote Most Active @paul53 last edited by coyote

          @paul53 unklar ist mir, was mit dem letzten Block ist, den brauche ich doch, damit ich überhaupt auf den LongPress reagiere, aber da ist state und switch drin. Den müsste man etwas umbauen oder?

          const idLevel = "meinAdapter.0.CC78CB0000261884.bri"; // meinAdapter anpassen !
          const idLong = "mihome.0.devices.switch_158d0001f3a5b2.long";
          
          var level = getState(idLevel).val;
          
          var down = false;
          if(level > 90) down = true;
          var timer = null;
          
          function rampe() {
             if(down) {
                level = level - 5;
                if(level < 0) down = false;
                else setState(idLevel, level);
             } else {
                level = level + 5;
                if(level > 100) down = true;
                else setState(idLevel, level);
             }
          }
          
          
          on(idLong, function(dp) {
             if(dp.state.val) {
                if(!state) setState(idSwitch, true);
                timer = setInterval(rampe, 200);
             } else clearInterval(timer);
          });
          

          Edit: Oder dann einfach die zweite if Zeile weg lassen?

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

            @coyote sagte:

            einfach die zweite if Zeile weg lassen?

            Ja, Zeile 25 weglassen.
            Sendet PRESS_LONG nicht alle 250 ms ? Dann kann man auch das Intervall weglassen und der Trigger muss anders aussehen.

            on({id: idLong}, rampe); // Triggert bei jeder Zeitstempeländerung
            
            coyote 1 Reply Last reply Reply Quote 0
            • coyote
              coyote Most Active @paul53 last edited by

              @paul53 hm, das weiß ich nicht. Kann ich aber ja ausprobieren.

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

                @coyote sagte:

                Kann ich aber ja ausprobieren.

                Ja, mache es. Hast Du HM (classic) oder HmIP ? Bei HM classic sendet PRESS_CONT alle 250 ms.

                coyote 1 Reply Last reply Reply Quote 0
                • coyote
                  coyote Most Active @paul53 last edited by

                  @paul53 HM (Classic), dann sollte es ja passen.

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

                    @coyote sagte:

                    HM (Classic)

                    Dann muss PRESS_CONT verwendet werden.

                    const idLevel = "hm-rpc.xxx.LEVEL";
                    const idLong = "hm-rpc.xxx.PRESS_CONT";
                    
                    coyote 1 Reply Last reply Reply Quote 0
                    • coyote
                      coyote Most Active @paul53 last edited by coyote

                      @paul53 ah moment, nee das geht nicht. Den DP habe ich nicht, da ich über einen Taster auf ein 12/7 wired Modul gehe, da gibts nur Press_Long und Press_Short. Das steuert mir dann den wireless HM Dimmer

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

                        @coyote sagte:

                        ein 12/7 wired Modul gehe

                        Wie verhält sich PRESS_LONG ? Testen:

                        on({id: idLong}, function(dp) {
                           log('Taste long: ' + dp.state.val;
                        });
                        
                        coyote 1 Reply Last reply Reply Quote 0
                        • coyote
                          coyote Most Active @paul53 last edited by

                          @paul53

                          javascript.0	2020-05-28 16:17:39.719	info	(18624) script.js.Skript_1: Taste long: true
                          
                          paul53 1 Reply Last reply Reply Quote 0
                          • paul53
                            paul53 @coyote last edited by

                            @coyote
                            Nur ein Log-Eintrag ? Beim Loslassen ?

                            coyote 1 Reply Last reply Reply Quote 0
                            • coyote
                              coyote Most Active @paul53 last edited by

                              @paul53 Log -Eintrag kommt immer beim Drücken, ich denke ich weiß worauf du hinaus willst, kann es aber momentan nur über die Web-Gui testen, da ich nicht vor Ort bin und da kann ich die "Taste" eben nicht einfach lang halten, dachte dass geht auch über die GUI. Muss es also direkt am Taster ausprobieren, wenn ich zu Hause bin.

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

                                @coyote sagte:

                                Muss es also direkt am Taster ausprobieren

                                Ja, das kann nur mit der physischen Taste getestet werden.

                                coyote 1 Reply Last reply Reply Quote 1
                                • coyote
                                  coyote Most Active @paul53 last edited by

                                  @paul53 also auch wenn ich den Taster lang drücke und dann halte, wird nur einmal "true" geloggt mehr nicht. Dann wird das so wohl nicht funktionieren

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

                                    @coyote sagte:

                                    wird nur einmal "true" geloggt

                                    Logge mal gleichzeitig PRESS_SHORT beim langen Drücken der Taste

                                    on({id: idLong}, function(dp) {
                                       log('Taste long: ' + dp.state.val;
                                    });
                                    on({id: idShort}, function(dp) {
                                       log('Taste short: ' + dp.state.val;
                                    });
                                    
                                    coyote 1 Reply Last reply Reply Quote 0
                                    • coyote
                                      coyote Most Active @paul53 last edited by

                                      @paul53 kommt leider auch nur einmal LONG: true

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

                                        @coyote sagte:

                                        kommt leider auch nur einmal LONG: true

                                        Dann kann man es nicht auswerten. Verwendest Du Verschlüsselung ? Beim 4-fach-Handtaster habe ich festgestellt, dass bei Verschlüsselung die Datenpunkte unbrauchbar sind.

                                        coyote 1 Reply Last reply Reply Quote 0
                                        • coyote
                                          coyote Most Active @paul53 last edited by

                                          @paul53 nein, aber eben die wired Module. Da kann ich auch nicht mehr einstellen, nur Taster oder Schalter auswählen in der CCU.
                                          Ich meine deshalb hatte ich es dasmals auch so gelöst:

                                          on({id: "hm-rpc.1.MEQ0064716.9.PRESS_SHORT"/*Kinderzimmer Taste 4.PRESS_SHORT*/, val: true, ack: true}, function() {   // Taste 4 KiZi
                                          var dimm = getState("hm-rpc.0.OEQ0851724.1.LEVEL").val;
                                          if (dimm <= 1) {
                                             setState("hm-rpc.0.OEQ0851724.1.LEVEL"/*Dimmer KiZi Spots Schräge.LEVEL*/, 40);
                                          }
                                          if (dimm >= 2) {
                                              setState("hm-rpc.0.OEQ0851724.1.LEVEL"/*Dimmer KiZi Spots Schräge.LEVEL*/, 0);
                                          }
                                          if (dimm < 75 && dimm >= 51){
                                              setState("hm-rpc.0.OEQ0851724.1.LEVEL"/*Dimmer KiZi Spots Schräge.LEVEL*/, 50);
                                          }
                                          if(dimm < 50 && dimm >= 26){
                                              setState("hm-rpc.0.OEQ0851724.1.LEVEL"/*Dimmer KiZi Spots Schräge.LEVEL*/, 25);
                                          }
                                          });
                                          

                                          Dann muss ich eben immer kurz drücken, vllt auch nicht schön, aber hat funktioniert. Auch Taster am wired Modul mit wireless Dimmer

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

                                            @coyote sagte:

                                            hatte ich es damals auch so gelöst:

                                            Da fällt mir nur noch ein, mit PRESS_SHORT den Dimmvorgang zu starten und zu stoppen und mit PRESS_LONG auszuschalten (LEVEL = 0).

                                            on({id: idLong}, function() {
                                               level = 0;
                                               setState(idLevel, 0);
                                               clearInterval(timer);
                                               timer = null;
                                            });
                                            on({id: idShort}, function() {
                                               if(timer) {
                                                  clearInterval(timer);
                                                  timer = null;
                                               } else timer = setInterval(rampe, 200);
                                            });   
                                            
                                            coyote 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            697
                                            Online

                                            31.9k
                                            Users

                                            80.2k
                                            Topics

                                            1.3m
                                            Posts

                                            8
                                            39
                                            5686
                                            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