I have like 2 "switches" in domoticz named: ZigbeeTuinhuislampen and ZigbeeGaragelampen
On these switches i use Timers for On/Off
The scripts (DzVents)
Code: Select all
return {
on = {
devices = {
'ZigbeeTuinhuislampen'
}
},
execute = function(domoticz, device)
if (domoticz.devices('ZigbeeTuinhuislampen').state == 'On') then
domoticz.devices('LampTuinhuis1').dimTo(60)
domoticz.devices('LampTuinhuis2').dimTo(60)
domoticz.devices('LampTuinhuis3').dimTo(60)
domoticz.devices('LampTuinhuis4').dimTo(60)
end
if (domoticz.devices('ZigbeeTuinhuislampen').state == 'Off') then
domoticz.devices('LampTuinhuis1').switchOff()
domoticz.devices('LampTuinhuis2').switchOff()
domoticz.devices('LampTuinhuis3').switchOff()
domoticz.devices('LampTuinhuis4').switchOff()
end
end
}
Code: Select all
return {
on = {
devices = {
'ZigbeeGaragelampen'
}
},
execute = function(domoticz, device)
if (domoticz.devices('ZigbeeGaragelampen').state == 'On') then
domoticz.devices('LampGarage1').switchOn()
domoticz.devices('LampGarage2').switchOn().afterSec(1)
domoticz.devices('LampGarage3').switchOn().afterSec(2)
domoticz.devices('LampGarage4').switchOn().afterSec(3)
end
if (domoticz.devices('ZigbeeGaragelampen').state == 'Off') then
domoticz.devices('LampGarage4').switchOff()
domoticz.devices('LampGarage3').switchOff().afterSec(1)
domoticz.devices('LampGarage2').switchOff().afterSec(2)
domoticz.devices('LampGarage1').switchOff().afterSec(3)
end
end
}
Now the problem, sometimes the lights are staying on or off. When i look in Domoticz the switch ZigbeeGaragelampen and ZigbeeTuinhuislampen are OFF but when i look at the lights (example LampGarage4) it says that device is ON! So what i do? Turn the main switch On and Off again and fixed.
I am not able to find out why this is happening, there is no error in the log and because it is only happening sometimes its hard to find the problem.
I recently updated zigbee2mqtt to the newest version but nope did not help.
Anyone that knows why this is happening? Or maybe possible to build in some kind of loop? Like switchoff and check if light is really switched off after a few seconds and try again?