Fibaro's RGBW Controllers allow you to set the colour of RGB or RGBW LED strip or run preconfigured colour changing programs. If you have several RGBW devices and want to synchronise them, you can use Lua on the Home Center 2.
The Fibaro RGBW module has the ability to show a set colour, or to run through a sequence of colours defined in 'programs'. (It can of course be off too). We need to detect when one RGBW controller changes either of its color or currentProgramID properties. When they change, the new values need to be repeated to the other RGBW devices. We also need to watch out for two pitfalls:
Two Fibaro RGBW Controllers – we will keep an eye on one of them, and if it changes, duplicate the changes onto the second one.
A Fibaro Home Center 2 – you need to use Lua which is only available on this Fibaro device.
To get the two devices talking, you will need to create the following scene:
--[[
%% properties
81 currentProgramID
81 color
%% globals
--]]
local fromID = 81
local toID = 402
-- Allows us to set the colour from a string like 'r,g,b,w'
function setTheColour (deviceID, colourString)
local RGBWTable= {}
local i = 1
for value in string.gmatch(colourString,"(%d+)") do
RGBWTable[i] = value
i = i + 1
end
fibaro:call(deviceID, "setColor", RGBWTable[1], RGBWTable[2], RGBWTable[3], RGBWTable[4])
end
local trigger = fibaro:getSourceTrigger()
if (trigger['type'] == 'property') then
if (trigger['propertyName'] == 'currentProgramID') then
fibaro:call(toID, 'startProgram', fibaro:getValue(fromID, 'currentProgramID'))
if (fibaro:getValue(fromID, 'currentProgramID') == '0') then
setTheColour(toID, fibaro:getValue(fromID, 'color'))
end
elseif (trigger['propertyName'] == 'color') then
if (fibaro:getValue(fromID, 'currentProgramID') == '0') then
setTheColour(toID, fibaro:getValue(fromID, 'color'))
end
end
end
Your two RGBW controllers can now both be controlled from the master RGBW controller. If you want to control more than one slave device, just duplicate lines 9, 27, 29 and 33 and change the variable name from toID to something else. For more information on Lua, see our support page at http://www.fibarouk.co.uk/support/lua/