Hello there,
I am trying to write a method that turns off a switch after 6 minutes. But I am failing.
Can you help me out what am I missing? also my aproach is correct? My sintax is following a the common practice? Most of it is from code snippet so I hope so:)
I know shelly has a built in timer for that, but I would love to know a little bit better these scripts.
Thanks!
Code
Shelly.addStatusHandler(function(e) {
if (e.component === "input:3") {
if (e.delta.state === true) {
print("uv on, waiting for failsafe");
Timer.set(6*60*1000, false, function (ud) {
Shelly.call("Switch.set", {'id': 3, 'on': false});
}, null);
}
else if (e.delta.state === false) {
print("Input is off");
}
}
});
Alles anzeigen