Hello All,
Surfing on this forum, I understand that many of you would dream of a native event handler on Fibaro HC3. jgab made a huge library that provides it - and much more.
Unfortunately as a rookie I have a hard time to figure out how to use it. I designed a couple of LUA scenes that work nicely. I often use sourceTrigger to figure out what event triggered the scene.
An example will be much better than a long description:
hub.debug("Scene81", json.encode(sourceTrigger))
if sourceTrigger.property == "execute" then -- i.e. this scene is called from another scene
-- [do this...]
else -- i.e. this scene was triggered by a user clicking on a Fibaro wall switch
local Switch = tonumber(sourceTrigger.id) -- allows to understand which switch it was
local Button = tonumber(sourceTrigger.value.keyId) -- upper or lower button
local Press = tostring(sourceTrigger.value.keyAttribute) -- single click, double click, triple click, held down
-- from there, a series of if then else end and different actions
end
I have transformed some of my LUA scenes into QuickApps, using small Block Scenes to trigger them.
I'd love to get rid of the Block Scenes and implement an event handler into each QuickApp, but frankly it's above my reach for the time being. I tried using jgab's "Fibaro Extra" but I don't understand what I'm doing.
I also tried to connect to my HC3 (defining variables ip = 192.168.1.123 and port = 22) and the connection worked, but from there I'm still incapable of getting "woken up" by an event such us "Device Id 88, Button #2, Pressed twice".
There is surely a missing link, I probably should send an http request of some sort but I have no clue about the syntax, and if it would end up giving me what I need (device, button, how it was pressed).
Just to tell you that I tried to get rid of Block Scenes, without success so far... that said, I could still cope with Block Scenes triggering my QuickApp, if I had a means to check what I described above for LUA scenes, i.e. a way to implement a sourceTrigger equivalent.
Have a great day!
JP