Also das hier ist mein Blocky für die Tradfri Bedienung:
var buttonpressed, Intervall3, Intervall4, Intervall, Intervall2;
on({id: "deconz.0.Sensors.5.buttonpressed"/*WZ Fernbedienung buttonpressed*/, change: "ne"}, function (obj) {
var value = obj.state.val;
var oldValue = obj.oldState.val;
buttonpressed = parseFloat(getState("deconz.0.Sensors.5.buttonpressed").val);
if (buttonpressed == 1002) {
setState("deconz.0.Lights.2.on"/*WZ Stehlampe on*/, (!getState("deconz.0.Lights.2.on").val));
} else if (buttonpressed == 2002) {
setState("deconz.0.Lights.2.dimspeed"/*WZ Stehlampe dimspeed*/, 75);
setState("deconz.0.Lights.2.dimup"/*WZ Stehlampe dimup*/, true);
} else if (buttonpressed == 3002) {
setState("deconz.0.Lights.2.dimspeed"/*WZ Stehlampe dimspeed*/, 75);
setState("deconz.0.Lights.2.dimdown"/*WZ Stehlampe dimdown*/, true);
} else if (buttonpressed == 4002) {
setState("0_userdata.0.WZ_Stehlampe_ct_fake"/*WZ Stehlampe ct fake*/, (parseFloat(getState("0_userdata.0.WZ_Stehlampe_ct_fake").val) - 90), true);
setState("deconz.0.Lights.2.ct"/*WZ Stehlampe ct*/, getState("0_userdata.0.WZ_Stehlampe_ct_fake").val);
} else if (buttonpressed == 5002) {
setState("0_userdata.0.WZ_Stehlampe_ct_fake"/*WZ Stehlampe ct fake*/, (parseFloat(getState("0_userdata.0.WZ_Stehlampe_ct_fake").val) + 90), true);
setState("deconz.0.Lights.2.ct"/*WZ Stehlampe ct*/, getState("0_userdata.0.WZ_Stehlampe_ct_fake").val);
} else if (buttonpressed == 2001) {
setState("deconz.0.Lights.2.dimspeed"/*WZ Stehlampe dimspeed*/, 20);
Intervall = setInterval(function () {
setState("deconz.0.Lights.2.dimup"/*WZ Stehlampe dimup*/, true);
}, 1000);
} else if (buttonpressed == 2003) {
(function () {if (Intervall) {clearInterval(Intervall); Intervall = null;}})();
} else if (buttonpressed == 3001) {
setState("deconz.0.Lights.2.dimspeed"/*WZ Stehlampe dimspeed*/, 20);
Intervall2 = setInterval(function () {
setState("deconz.0.Lights.2.dimdown"/*WZ Stehlampe dimdown*/, true);
}, 1000);
} else if (buttonpressed == 3003) {
(function () {if (Intervall2) {clearInterval(Intervall2); Intervall2 = null;}})();
} else if (buttonpressed == 4001) {
Intervall3 = setInterval(function () {
setState("0_userdata.0.WZ_Stehlampe_ct_fake"/*WZ Stehlampe ct fake*/, (parseFloat(getState("0_userdata.0.WZ_Stehlampe_ct_fake").val) - 25), true);
setState("deconz.0.Lights.2.ct"/*WZ Stehlampe ct*/, getState("0_userdata.0.WZ_Stehlampe_ct_fake").val);
}, 500);
} else if (buttonpressed == 4003) {
(function () {if (Intervall3) {clearInterval(Intervall3); Intervall3 = null;}})();
} else if (buttonpressed == 5001) {
Intervall4 = setInterval(function () {
setState("0_userdata.0.WZ_Stehlampe_ct_fake"/*WZ Stehlampe ct fake*/, (parseFloat(getState("0_userdata.0.WZ_Stehlampe_ct_fake").val) + 25), true);
setState("deconz.0.Lights.2.ct"/*WZ Stehlampe ct*/, getState("0_userdata.0.WZ_Stehlampe_ct_fake").val);
}, 500);
} else if (buttonpressed == 5003) {
(function () {if (Intervall4) {clearInterval(Intervall4); Intervall4 = null;}})();
}
});
false && false;
WZ Stehlampe ct fake ist die Hilfsvariable (mußt initial mit nen vernünftigen Wert füllen wie z.B. "100". Der Rest sind alles Verweise auf die Tradfri Bedienung und eine Tradfri LED.