Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Is there an equivalent of sourceTrigger allowing to figure out which event triggered a given method (e.g. turnOn) in a given QuickApp?


JP Fuchs

Recommended Posts

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

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...