I solved it. With this script:
Code
let alertTimer = '';
function startMonitor() {
alertTimer = Timer.set(10000,
true,
function status() {
Shelly.call(
"HTTP.GET", {
"url": "http://192.168.1.81/rpc/Shelly.GetStatus",
},
function(result, error_code, error_msg, ud) {
if (error_code === 0) {
switchOn()
}
else {
switchOff()
}
}
);
},
null);
}
function switchOn() {
Shelly.call(
"switch.set",
{ id: 0, on: true},
function (result, code, msg, ud) {
},
null
);
}
function switchOff() {
Shelly.call(
"switch.set",
{ id: 0, on: false},
function (result, code, msg, ud) {
},
null
);
}
function switchOn() {
Shelly.call(
"switch.set",
{ id: 0, on: true},
function (result, code, msg, ud) {
},
null
);
}
startMonitor();
Alles anzeigen