@wurstdlx sagte: klappt jetzt!
Weniger komplizierte Version:
const debug = true;
const idNUKIConnectionState = '';
const wait_ms = 60*1000; // wait ms to check for state
var timeoutVar = null;
var offline = false;
on(idNUKIConnectionState, function(obj){
// check if old value was not connected for more than 1 minute
clearTimeout(timeoutVar); //reset timer
if (obj.state.val == "offline") {
timeoutVar=setTimeout(function(){
sendTo('telegram.0','NUKI Bridge ist offline nach Ablauf des Timers.');
offline = true;
}, wait_ms);
} else if(offline) {
sendTo('telegram.0','NUKI Bridge ist wieder online.');
offline = false;
}
if(debug) log('NUKI Bridge ist ' + obj.state.val);
});