Beiträge von tonyholy
-
-
Thank you very much . It was what I was looking for
Could you just tell me how I can change this string to make it work?[0 1 2 3, "off"],
I have to close the loop by turning off all inputs
Thank you again
Code
Alles anzeigenlet CONFIG = { /** * Pick your desired Input to be used for triggering the cycling (note: this input would be changed * to detached!) */ INPUT_ID: 0, /** * List (in the expected order) the operations that you want this script to cycle through. * E.g. [switchId, "on" or "off"] */ CYCLES: [ [0, "on"], [1, "on"], [2, "on"], [3, "on"], [0 1 2 3, "off"], ], }; let currentCycle = 0; let runCycle = function () { let currentOperation = CONFIG.CYCLES[currentCycle]; if (!currentOperation) { currentCycle = 0; currentOperation = CONFIG.CYCLES[currentCycle]; } currentCycle++; Shelly.call("switch.set", { id: JSON.stringify(currentOperation[0]), on: currentOperation[1] === "on", }); }; let setup = function () { Shelly.call( "switch.setconfig", { id: JSON.stringify(CONFIG.INPUT_ID), config: { in_mode: "detached" } }, function () { Shelly.addEventHandler(function (event) { if (event.component === "input:" + JSON.stringify(CONFIG.INPUT_ID)) { if ( event.info.state !== false && event.info.event !== "btn_up" && event.info.event !== "btn_down" ) { runCycle(); } } }, null); } ); }; setup();
-