The scene
Now that scene activation is enabled, we can write a scene that can be triggered by it. In the following example, the dimmer’s device ID is 30, change it as necessary:
--[[
%% properties
30 sceneActivation
%% globals
--]]
local lightID = 30
local scene = fibaro:getValue(lightID, 'sceneActivation')
-- 16 == single click: ignore it - let light turn on and off as normal.
if (scene == '14') then -- double click
-- actions for double clicks go here
elseif (scene == '15') then -- tripple click
-- actions for tripple clicks go here
end
- Line 3 is the trigger of this scene
- Lines 7 and 9 are defining the variables. In this case, the ID of the dimmer and the scene activation ID the dimmer has sent.
- The rest of the lines are defining what will happen when different scene activation IDs are received.
Because each ID can trigger different actions, this means that from one Fibaro Dimmer with a toggle switch you are able to trigger up to 6 different actions and up to 10 with a momentary switch.
You can add the Lua code fibaro:call() to perform the actions turnOn, turnOff and setValue on different devices, or fibaro:startScene() to run a specific scene (perhaps a graphics block scene) to keep this code neat and tidy.
Graphics Block Scene Activation
Graphics blocks can be used for Scene Activation instead of Lua. Below is a simple example of how a the scene would look.
The first blue block is the device that has Scene Activation turned on - in this case a Fibaro Dimmer Module. The green block has been changed from ‘On’ to ‘Scene activation’ and the number 15 has been typed into the dark green box that appears. This represents the scene activation ID the dimmer sends when switch 1 (S1) is triple clicked.
Once this block has been created, the next part of the scene can run a scene or set the value of any device that you wish.