Trigger scenes from Fibaro dimmer or roller shutter module

Fibaro dimmer and roller shutter modules can be set up as scene controllers (param 41 for FGD-211 and FGR-221, param 50 for FGRM-222).
However, the Vera UI doesn’t regognize those modules as scene controllers/triggers (even though we can see the events from the scene controller in the logs). Some people have used PLEG in order to associate double/triple click events on S1/S2 switches from those modules, including myself. The issue is that now that I’ve upgraded to UI7, PLEG is a bit problematic.

So if you are in the same situation as myself, and you would like to benefit from the ability to trigger scenes from double/triple clicks on switches connected to fibaro dimmer/roller shutter modules, here is the code to add to your startup.lua:

[code]function dispatch_roller_shutter(dev_id, service, variable, old_val, new_val)

– retrieve LastSceneID from the device
new_scene = luup.variable_get(service, “LastSceneID”, dev_id)
new_scene = tonumber(new_scene)
luup.log(“dispatcher - roller shutter”)

– trigger the related scene
if (new_scene==14) then
luup.log(“double click up”)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“3” }, 0)
elseif (new_scene==15) then
luup.log(“triple click up”)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“3” }, 0)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“4” }, 0)
elseif (new_scene==24) then
luup.log(“double click down”)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“2” }, 0)
elseif (new_scene==25) then
luup.log(“triple click down”)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“2” }, 0)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“5” }, 0)
end
return true
end

luup.variable_watch(“dispatch_roller_shutter”, “urn:micasaverde-com:serviceId:SceneController1”,“LastSceneTime”, 31)[/code]

In luup.variable_watch, replace “31” by your Fibaro device number, and that should work.

Hi

I just got my vera lite controller with ui7. I’m testing it before I instal it in my house. How do I create I scene that is triggered by dobbel/triple click. I see you use scene 2,3,4 and 5 in you’re example. I can only make a scene triggered with a physical device, schedule or manual. Witch one should I use to create a scene? I would like to use my fibaro dimmer to activate a scene but only when dimmer is on/ off I can use as a scene in ui7

You can have any trigger you want for the scene, as anyhow using my lua code it is the lua code itself which triggers the scene. When you start a scene from lua code, the trigger condition you have in your scene is not checked by the vera.

Vera does not directly enable you to trigger a scene from a double/triple click of a Fibaro device. That’s we we create a scene, and “manually” handle the trigger from lua code.

Why is it not possible to measure how many times a device has been activated and use that to modify the outcome of a scene? For example, I have a Roller Shutter 2 (FGRM 222) on the wall switch that is not directly connected to the shutters because there are three shutters in that room and each needs its own FGRM 222) I have set two scenes that simply open or close all shutters according to whether the up or down button is pushed. But I would like to add a modification such that if I push the down button twice quickly, the three affected shutters will stop at 90% closure.

[quote=“Gabriel, post:1, topic:187878”]So if you are in the same situation as myself, and you would like to benefit from the ability to trigger scenes from double/triple clicks on switches connected to fibaro dimmer/roller shutter modules, here is the code to add to your startup.lua:

[code]function dispatch_roller_shutter(dev_id, service, variable, old_val, new_val)

– retrieve LastSceneID from the device[/code][/quote]

Good work, I went through the same thing with the dimmers:
http://forum.micasaverde.com/index.php/topic,15855.msg217818.html#msg217818

I had to use a delay and another variable, but it’s great yours works too.