i have a zigbee switch with 6 buttons and i want to control 2 dimmers with it.
this is the situation i want:
- button 1 > turn on/off dimmer 1
- button 2 > turn on/off dimmer 2
- button 3 > subtract 10% of the dimming value of dimmer 1 and dim to that level
- button 4 > add 10% to the dimming value of dimmer 1 and dim to that level
- button 5 > subtract 10% of the dimming value of dimmer 2 and dim to that level
- button 6 > add 10% to the dimming value of dimmer 2 and dim to that level
this is how far i have come:
Code: Select all
return {
on = {
devices = {
'multibutton'
}
},
execute = function(dz, device)
local button = dz.devices("multibutton") -- has states 1, 2, 3, 4, 5, 6
local lamp1 = dz.devices("dimmer 1") -- is a simple dimmer just on/off and 1-100%
local lamp2 = dz.devices("dimmer 2") -- is a simple dimmer just on/off and 1-100%
if button.state == "1" and lamp1.state == "Off" then
lamp1.switchOn()
elseif button.state == "1" and lamp1.state == "On" then
lamp1.switchOff()
elseif button.state == "2" and lamp2.state == "Off" then
lamp2.switchOn()
elseif button.state == "2" and lamp2.state == "On" then
lamp2.switchOff()
elseif button.state == "3" then
-- dim lamp 1 10% less
elseif button.state == "4" then
-- dim lamp 1 10% more
elseif button.state == "5" then
-- dim lamp 2 10% less
elseif button.state == "6" then
-- dim lamp 2 10% more
end
end
}any help would be appreciated.