Code: Select all
-- Wissel living
local MASTER = 'Licht_Living'
local SLAVE = 'Wissel_Living'
return {
on = {
devices = {
MASTER,
SLAVE
}
},
execute = function(domoticz, device, triggerInfo)
if (domoticz.EVENT_TYPE_TIMER == triggerInfo.type) then
domoticz.log( 'timer event: '..tostring(triggerInfo.trigger)..'.', domoticz.LOG_INFO)
elseif (domoticz.EVENT_TYPE_DEVICE == triggerInfo.type) then
if (device.name == MASTER) then
if (device.state ~= domoticz.devices(SLAVE).state) then
domoticz.devices(SLAVE).setState(device.state).silent()
end
elseif (device.name == SLAVE) then
if (device.state ~= domoticz.devices(MASTER).state) then
domoticz.devices(MASTER).setState(device.state).silent()
end
end
end
end
}
meaning the first switch go on the other off then the first one go off but the second one go on and so on.
The only thing to stop it for now is reset domoticz container.
I there a way in the script that i can change to prevent this loop?
Thx,