16 lines
483 B
JavaScript
16 lines
483 B
JavaScript
//Close all Shutters
|
|
|
|
randomPosition();
|
|
stopScript("script.js.Shelly.CloseAll");
|
|
|
|
function randomIntFromInterval(min, max) { // min and max included
|
|
return Math.floor(Math.random() * (max - min + 1) + min)
|
|
}
|
|
|
|
function randomPosition() {
|
|
$("[id=shelly.0.*.Shutter.Position]").each(function (id, i) {
|
|
let randomPosition = randomIntFromInterval(0, 100);
|
|
log("Setting position of " + id + " to " + randomPosition);
|
|
setState(id, randomPosition);
|
|
});
|
|
} |