NEWS
[gelöst]Dimmen mit "Long Press"
-
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?
-
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?
-
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?
@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); }); -
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 :-)
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