@asgothian Uiuiui - Okay dann stimmt was mit dem Blocklykonverter nicht - Egal - ich hab mal kurz ne JS Klasse gebaut, die man an irgendeiner Stelle als Addon für ein Lichtstate verwenden kann. Somit wird jedes Licht automatisch zu einem "Mehrfachversucher": (Bitte vergebt mir meine Klammersetzung)
class RetrySetter
{
constructor (objectid,maxretry,timeoutms)
{
var desiredstate = null;
var timeout = null;
var retrycount = 0;
on({id:objectid,change:"any"},function(obj)
{
if (obj.state.ack == false || (desiredstate!=null && obj.state.val!=desiredstate)) // we got a new state to perform on
{
if (desiredstate!=null && obj.state.val!=desiredstate)
retrycount=0;
desiredstate = obj.state.val;
console.log(objectid+" trying to get ack for state = "+desiredstate);
if (timeout) {clearTimeout(timeout);timeout=null;}
timeout = setTimeout(function()
{
retrycount++;
if (retrycount==maxretry+1)
{
retrycount=0;
desiredstate=null;
return;
}
console.log(objectid+" retry to set state = "+desiredstate+" retry = "+retrycount);
setState(objectid,desiredstate);
},timeoutms);
}
if (obj.state.ack == true && obj.state.val==desiredstate) // we got our ack
{
retrycount=0;
if (timeout) {clearTimeout(timeout);timeout=null;}
console.log(objectid+" happy to tell the ack has come with desired state = "+desiredstate);
desiredstate=null;
}
});
}
}
new RetrySetter("zigbee.0.0017880108b5533e.state",10,5000);
Macht für das im Konstruktor angegebene Zigbee Gerät max 10 Versuche mit 5000 Sekunden Timeout dazwischen.