I wrote the following dzvents script:
Code: Select all
return {
active = true,
on = {
devices = {
'Lights'
}
},
execute = function(domoticz, mySwitch)
if (mySwitch.state == 'On') then
domoticz.devices('Kankun').switchOn()
domoticz.devices('LED').dimTo(90)
domoticz.devices('BEDLED').dimTo(90)
else
domoticz.devices('Kankun').switchOff()
domoticz.devices('LED').switchOff()
domoticz.devices('BEDLED').switchOff()
end
end
}
So I wrote another script:
Code: Select all
return {
active = true,
on = {
devices = {
'LED',
'BEDLED',
'Kankun'
}
},
execute = function(domoticz, mySwitch)
if (domoticz.devices('Kankun').state == 'On') or
(domoticz.devices('LED').state == 'On') or
(domoticz.devices('BEDLED').state == 'On')
then
domoticz.devices('Lights').switchOn()
elseif
(domoticz.devices('Kankun').state == 'Off' and domoticz.devices('LED').state == 'Off' and domoticz.devices('BEDLED').state == 'Off')
then
domoticz.devices('Lights').switchOff()
end
end
}