Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. [gelöst]Dimmen mit "Long Press"

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    780

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    6.2k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.5k

[gelöst]Dimmen mit "Long Press"

Scheduled Pinned Locked Moved JavaScript
4 Posts 2 Posters 344 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Sorry wenn ich nochmal das Thema aufmache. Ich versuche das Script auf eine weitere Lampe zu erweitern. Hört sich simpel an aber anscheinend zu schwierig für mich 😉 Also die Aufgabe wäre ein Taster zwei Lampen die synchron laufen. Kann mir jemand einen Tipp geben?

    paul53P 2 Replies Last reply
    0
    • ? A Former User

      Sorry wenn ich nochmal das Thema aufmache. Ich versuche das Script auf eine weitere Lampe zu erweitern. Hört sich simpel an aber anscheinend zu schwierig für mich 😉 Also die Aufgabe wäre ein Taster zwei Lampen die synchron laufen. Kann mir jemand einen Tipp geben?

      paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #2

      @noah3112
      Erwartest Du eine Antwort, wenn das Thema mit [gelöst] markiert ist ?

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      1 Reply Last reply
      0
      • ? A Former User

        Sorry wenn ich nochmal das Thema aufmache. Ich versuche das Script auf eine weitere Lampe zu erweitern. Hört sich simpel an aber anscheinend zu schwierig für mich 😉 Also die Aufgabe wäre ein Taster zwei Lampen die synchron laufen. Kann mir jemand einen Tipp geben?

        paul53P Offline
        paul53P Offline
        paul53
        wrote on last edited by
        #3

        @noah3112 sagte:

        ein Taster zwei Lampen die synchron laufen.

        // IDs anpassen !
        const idLevel1 = "meinAdapter.0.CC78CB0000261884.bri"; 
        const idSwitch1 = "meinAdapter.0.CC78CB0000261884.on"; 
        const idLevel2 = "...bri";
        const idSwitch2 = "...on";
        const idLong = "mihome.0.devices.switch_158d0001f3a5b2.long";
         
        var level = getState(idLevel1).val;
        var state1 = getState(idSwitch1).val;
        var state2 = getState(idSwitch2).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(idLevel1, level);
                 setState(idLevel2, level);
              }
           } else {
              level = level + 5;
              if(level > 100) down = true;
              else {
                 setState(idLevel1, level);
                 setState(idLevel2, level);
              }
           }
        }
         
        on({id: idSwitch1, ack: true}, function(dp) {
           state1 = dp.state.val;
        });
        
        on({id: idSwitch2, ack: true}, function(dp) {
           state2 = dp.state.val;
        });
         
        on(idLong, function(dp) {
           if(dp.state.val) {
              if(!state1) setState(idSwitch1, true);
              if(!state2) setState(idSwitch2, true);
              timer = setInterval(rampe, 200);
           } else clearInterval(timer);
        });
        

        Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
        Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Ja ich weiß, aber neues Thema wollte ich dafür nicht extra aufmachen. Und dein Beispiel funktionierte bei mir bisher wunderbar. Danke das du trotzdem geantwortet hast. Du hast es einfach drauf :-)

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          Support us

          ioBroker
          Community Adapters
          Donate

          514

          Online

          32.8k

          Users

          82.7k

          Topics

          1.3m

          Posts
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
          ioBroker Community 2014-2025
          logo
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Home
          • Recent
          • Tags
          • Unread 0
          • Categories
          • Unreplied
          • Popular
          • GitHub
          • Docu
          • Hilfe