i have my current script below which is designed to control two lights that are dimming capable, im trying to work out how i would word the logic so that if i dim the "Master "Fan Lights" Switch both of the other lights "Fan 1/Fan2" dim to match it as if working as the same light?
im sure i need to do something like, if dim state change, get dim level and then send that to the other two lights, but i cant think of how it would actually look
Code: Select all
return {
on = {
devices = { 38 }
},
execute = function(dz, item)
dz.log('fan lights switch activated')
if item.state == 'On' then
dz.log('fan lights master turned on')
dz.devices('Fan1').switchOn()
dz.devices('Fan2').switchOn()
elseif item.state == 'Off' then
dz.log('fan lights master turned off')
dz.devices('Fan1').switchOff()
dz.devices('Fan2').switchOff()
end
end
}