Code: Select all
local MASTER = 'Switch MASTER'
local SLAVE1 = 'Lamp SLAVE1'
local SLAVE2 = 'Lamp SLAVE2'
return {
active = true,
-- active = false,
on = { devices = { MASTER, SLAVE1, SLAVE2 }
},
logging = {
-- level = domoticz.LOG_INFO,
level = domoticz.LOG_DEBUG,
},
execute = function(dz, device, triggerInfo)
if device.name == MASTER then
if device.state == 'On' then
dz.devices(SLAVE1).switchOn().silent()
dz.devices(SLAVE2).switchOn().silent()
else
dz.devices(SLAVE1).switchOff().silent()
dz.devices(SLAVE2).switchOff().silent()
end
else
if dz.devices(SLAVE1).state == 'On' or dz.devices(SLAVE2).state == 'On' then
dz.devices(MASTER).switchOn().silent()
else
dz.devices(MASTER).switchOff().silent()
end
end
end
}
The problem is with zigbee. Both SLAVE1 and SLAVE2 are this bulb https://www.zigbee2mqtt.io/devices/LED1 ... Fled1835c6
SLAVE1 behaves normal with 1 zigbee message, but SLAVE2 send 1 second later a second message, and of course on that second message the 'silent()' does not apply and that triggers an unwanted script activation.
The script also has an strange (and unwanted) side effect that every third click on MASTER is NOT processed by Domoticz.
So what am I doing wrong? What could be better? Who has a better Master/Slave script. How can I prevent the second zigbee message?